use of uk.co.wehavecookies56.kk.common.network.packet.client.SyncMagicData in project Kingdom-Keys-Re-Coded by Wehavecookies56.
the class MagicFire method process.
@Override
public void process(EntityPlayer player, Side side) {
if (!player.getCapability(ModCapabilities.CHEAT_MODE, null).getCheatMode())
player.getCapability(ModCapabilities.PLAYER_STATS, null).remMP(Constants.getCost(Strings.Spell_Fire));
World world = player.world;
switch(player.getCapability(ModCapabilities.MAGIC_STATE, null).getMagicLevel(Strings.Spell_Fire)) {
case 1:
world.spawnEntity(new EntityFire(world, player, player.posX, player.posY, player.posZ));
break;
case 2:
world.spawnEntity(new EntityFira(world, player, player.posX, player.posY, player.posZ));
break;
case 3:
world.spawnEntity(new EntityFiraga(world, player, player.posX, player.posY, player.posZ));
break;
}
PacketDispatcher.sendTo(new SyncMagicData(player.getCapability(ModCapabilities.MAGIC_STATE, null), player.getCapability(ModCapabilities.PLAYER_STATS, null)), (EntityPlayerMP) player);
}
use of uk.co.wehavecookies56.kk.common.network.packet.client.SyncMagicData in project Kingdom-Keys-Re-Coded by Wehavecookies56.
the class MagicThunder method process.
@Override
public void process(EntityPlayer player, Side side) {
if (!player.getCapability(ModCapabilities.CHEAT_MODE, null).getCheatMode())
player.getCapability(ModCapabilities.PLAYER_STATS, null).remMP(Constants.getCost(Strings.Spell_Thunder));
World world = player.world;
if (!world.isRemote)
switch(player.getCapability(ModCapabilities.MAGIC_STATE, null).getMagicLevel(Strings.Spell_Thunder)) {
case 1:
world.spawnEntity(new EntityThunder(world, player, player.posX, player.posY, player.posZ));
PacketDispatcher.sendToAllAround(new SpawnThunderParticles(player, 1), player, 64.0D);
break;
case 2:
world.spawnEntity(new EntityThundara(world, player, player.posX, player.posY, player.posZ));
PacketDispatcher.sendToAllAround(new SpawnThunderParticles(player, 2), player, 64.0D);
break;
case 3:
world.spawnEntity(new EntityThundaga(world, player, player.posX, player.posY, player.posZ));
PacketDispatcher.sendToAllAround(new SpawnThunderParticles(player, 3), player, 64.0D);
break;
}
PacketDispatcher.sendTo(new SyncMagicData(player.getCapability(ModCapabilities.MAGIC_STATE, null), player.getCapability(ModCapabilities.PLAYER_STATS, null)), (EntityPlayerMP) player);
}
use of uk.co.wehavecookies56.kk.common.network.packet.client.SyncMagicData in project Kingdom-Keys-Re-Coded by Wehavecookies56.
the class OrgPortal method process.
@Override
public void process(EntityPlayer player, Side side) {
if (!player.getCapability(ModCapabilities.CHEAT_MODE, null).getCheatMode())
player.getCapability(ModCapabilities.PLAYER_STATS, null).setMP(0);
PacketDispatcher.sendToAllAround(new SpawnPortalParticles(pos), player, 64.0D);
EntityOrgPortal portal = new EntityOrgPortal(player.world, player, pos, destPos, dimension, true);
player.world.spawnEntity(portal);
EntityOrgPortal destPortal = new EntityOrgPortal(player.world, player, destPos, destPos, dimension, false);
player.world.spawnEntity(destPortal);
PacketDispatcher.sendToAll(new SyncOrgPortal(pos, destPos, dimension));
PacketDispatcher.sendTo(new SyncMagicData(player.getCapability(ModCapabilities.MAGIC_STATE, null), player.getCapability(ModCapabilities.PLAYER_STATS, null)), (EntityPlayerMP) player);
}
use of uk.co.wehavecookies56.kk.common.network.packet.client.SyncMagicData in project Kingdom-Keys-Re-Coded by Wehavecookies56.
the class OpenMenu method process.
@Override
public void process(EntityPlayer player, Side side) {
PacketDispatcher.sendTo(new SyncMunnyData(player.getCapability(ModCapabilities.MUNNY, null)), (EntityPlayerMP) player);
PacketDispatcher.sendTo(new SyncMagicData(player.getCapability(ModCapabilities.MAGIC_STATE, null), player.getCapability(ModCapabilities.PLAYER_STATS, null)), (EntityPlayerMP) player);
PacketDispatcher.sendTo(new SyncDriveData(player.getCapability(ModCapabilities.DRIVE_STATE, null)), (EntityPlayerMP) player);
PacketDispatcher.sendTo(new SyncLevelData(player.getCapability(ModCapabilities.PLAYER_STATS, null)), (EntityPlayerMP) player);
}
use of uk.co.wehavecookies56.kk.common.network.packet.client.SyncMagicData in project Kingdom-Keys-Re-Coded by Wehavecookies56.
the class BlockSavePoint method updateState.
private void updateState(World world, BlockPos pos) {
List list = world.getEntitiesWithinAABBExcludingEntity((Entity) null, new AxisAlignedBB(pos.add(0, 0, 0), pos.add(1, 1, 1)));
if (!list.isEmpty())
for (int i = 0; i < list.size(); i++) {
Entity e = (Entity) list.get(i);
if (e instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) e;
IPlayerStats STATS = player.getCapability(ModCapabilities.PLAYER_STATS, null);
// System.out.println(player.getBedLocation());
// System.out.println(pos.getX());
boolean samePos;
BlockPos bedPos;
if (player.getBedLocation() == null) {
IFirstTimeJoin originalPos = player.getCapability(ModCapabilities.FIRST_TIME_JOIN, null);
bedPos = new BlockPos(originalPos.getPosX(), originalPos.getPosY(), originalPos.getPosZ());
} else {
bedPos = player.getBedLocation();
}
samePos = bedPos.getX() == pos.getX() && bedPos.getY() == pos.getY() && bedPos.getZ() == pos.getZ();
if (player.isSneaking() && !samePos) {
player.setSpawnChunk(pos, true, 0);
player.setSpawnPoint(pos, true);
TextHelper.sendFormattedChatMessage("Spawn point saved!", TextFormatting.GREEN, player);
world.playSound((EntityPlayer) null, player.getPosition(), ModSounds.savespawn, SoundCategory.BLOCKS, 1.0f, 1.0f);
}
if (player.getHealth() < player.getMaxHealth() || STATS.getMP() < STATS.getMaxMP()) {
player.heal(1);
STATS.addMP(2);
if (player.getFoodStats().getFoodLevel() < 20)
player.getFoodStats().addStats(4, 0);
if (timeHealed + 1 <= (int) Minecraft.getSystemTime() / 1000) {
world.playSound((EntityPlayer) null, player.getPosition(), ModSounds.savepoint, SoundCategory.BLOCKS, 1.0f, 1.0f);
PacketDispatcher.sendToAllAround(new SpawnCureParticles(pos, true), player, 64.0D);
}
PacketDispatcher.sendTo(new SyncMagicData(player.getCapability(ModCapabilities.MAGIC_STATE, null), STATS), (EntityPlayerMP) player);
}
}
}
world.scheduleUpdate(new BlockPos(pos), this, this.tickRate(world));
}
Aggregations