use of net.minecraft.entity.item.EntityEnderEye in project CumServerPro by MCUmbrella.
the class ItemEnderEye method onItemRightClick.
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) {
ItemStack itemstack = playerIn.getHeldItem(handIn);
RayTraceResult raytraceresult = this.rayTrace(worldIn, playerIn, false);
if (raytraceresult != null && raytraceresult.typeOfHit == RayTraceResult.Type.BLOCK && worldIn.getBlockState(raytraceresult.getBlockPos()).getBlock() == Blocks.END_PORTAL_FRAME) {
return new ActionResult<ItemStack>(EnumActionResult.PASS, itemstack);
} else {
playerIn.setActiveHand(handIn);
if (!worldIn.isRemote) {
BlockPos blockpos = ((WorldServer) worldIn).getChunkProvider().getNearestStructurePos(worldIn, "Stronghold", new BlockPos(playerIn), false);
if (blockpos != null) {
EntityEnderEye entityendereye = new EntityEnderEye(worldIn, playerIn.posX, playerIn.posY + (double) (playerIn.height / 2.0F), playerIn.posZ);
entityendereye.moveTowards(blockpos);
worldIn.spawnEntity(entityendereye);
if (playerIn instanceof EntityPlayerMP) {
CriteriaTriggers.USED_ENDER_EYE.trigger((EntityPlayerMP) playerIn, blockpos);
}
worldIn.playSound((EntityPlayer) null, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ENTITY_ENDEREYE_LAUNCH, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
worldIn.playEvent((EntityPlayer) null, 1003, new BlockPos(playerIn), 0);
if (!playerIn.capabilities.isCreativeMode) {
itemstack.shrink(1);
}
playerIn.addStat(StatList.getObjectUseStats(this));
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemstack);
}
}
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemstack);
}
}
use of net.minecraft.entity.item.EntityEnderEye in project CumServerPro by MCUmbrella.
the class CraftWorld method createEntity.
@SuppressWarnings("unchecked")
public net.minecraft.entity.Entity createEntity(Location location, Class<? extends Entity> clazz) throws IllegalArgumentException {
if (location == null || clazz == null) {
throw new IllegalArgumentException("Location or entity class cannot be null");
}
net.minecraft.entity.Entity entity = null;
double x = location.getX();
double y = location.getY();
double z = location.getZ();
float pitch = location.getPitch();
float yaw = location.getYaw();
// order is important for some of these
if (Boat.class.isAssignableFrom(clazz)) {
entity = new EntityBoat(world, x, y, z);
entity.setLocationAndAngles(x, y, z, yaw, pitch);
} else if (FallingBlock.class.isAssignableFrom(clazz)) {
entity = new EntityFallingBlock(world, x, y, z, world.getBlockState(new BlockPos(x, y, z)));
} else if (Projectile.class.isAssignableFrom(clazz)) {
if (Snowball.class.isAssignableFrom(clazz)) {
entity = new EntitySnowball(world, x, y, z);
} else if (Egg.class.isAssignableFrom(clazz)) {
entity = new EntityEgg(world, x, y, z);
} else if (Arrow.class.isAssignableFrom(clazz)) {
if (TippedArrow.class.isAssignableFrom(clazz)) {
entity = new EntityTippedArrow(world);
((EntityTippedArrow) entity).setType(CraftPotionUtil.fromBukkit(new PotionData(PotionType.WATER, false, false)));
} else if (SpectralArrow.class.isAssignableFrom(clazz)) {
entity = new EntitySpectralArrow(world);
} else {
entity = new EntityTippedArrow(world);
}
entity.setLocationAndAngles(x, y, z, 0, 0);
} else if (ThrownExpBottle.class.isAssignableFrom(clazz)) {
entity = new EntityExpBottle(world);
entity.setLocationAndAngles(x, y, z, 0, 0);
} else if (EnderPearl.class.isAssignableFrom(clazz)) {
entity = new EntityEnderPearl(world);
entity.setLocationAndAngles(x, y, z, 0, 0);
} else if (ThrownPotion.class.isAssignableFrom(clazz)) {
if (LingeringPotion.class.isAssignableFrom(clazz)) {
entity = new EntityPotion(world, x, y, z, CraftItemStack.asNMSCopy(new ItemStack(org.bukkit.Material.LINGERING_POTION, 1)));
} else {
entity = new EntityPotion(world, x, y, z, CraftItemStack.asNMSCopy(new ItemStack(org.bukkit.Material.SPLASH_POTION, 1)));
}
} else if (Fireball.class.isAssignableFrom(clazz)) {
if (SmallFireball.class.isAssignableFrom(clazz)) {
entity = new EntitySmallFireball(world);
} else if (WitherSkull.class.isAssignableFrom(clazz)) {
entity = new EntityWitherSkull(world);
} else if (DragonFireball.class.isAssignableFrom(clazz)) {
entity = new EntityDragonFireball(world);
} else {
entity = new EntityLargeFireball(world);
}
entity.setLocationAndAngles(x, y, z, yaw, pitch);
Vector direction = location.getDirection().multiply(10);
((EntityFireball) entity).setDirection(direction.getX(), direction.getY(), direction.getZ());
} else if (ShulkerBullet.class.isAssignableFrom(clazz)) {
entity = new EntityShulkerBullet(world);
entity.setLocationAndAngles(x, y, z, yaw, pitch);
} else if (LlamaSpit.class.isAssignableFrom(clazz)) {
entity = new EntityLlamaSpit(world);
entity.setLocationAndAngles(x, y, z, yaw, pitch);
}
} else if (Minecart.class.isAssignableFrom(clazz)) {
if (PoweredMinecart.class.isAssignableFrom(clazz)) {
entity = new EntityMinecartFurnace(world, x, y, z);
} else if (StorageMinecart.class.isAssignableFrom(clazz)) {
entity = new EntityMinecartChest(world, x, y, z);
} else if (ExplosiveMinecart.class.isAssignableFrom(clazz)) {
entity = new EntityMinecartTNT(world, x, y, z);
} else if (HopperMinecart.class.isAssignableFrom(clazz)) {
entity = new EntityMinecartHopper(world, x, y, z);
} else if (SpawnerMinecart.class.isAssignableFrom(clazz)) {
entity = new EntityMinecartMobSpawner(world, x, y, z);
} else if (CommandMinecart.class.isAssignableFrom(clazz)) {
entity = new EntityMinecartCommandBlock(world, x, y, z);
} else {
// Default to rideable minecart for pre-rideable compatibility
entity = new EntityMinecartEmpty(world, x, y, z);
}
} else if (EnderSignal.class.isAssignableFrom(clazz)) {
entity = new EntityEnderEye(world, x, y, z);
} else if (EnderCrystal.class.isAssignableFrom(clazz)) {
entity = new EntityEnderCrystal(world);
entity.setLocationAndAngles(x, y, z, 0, 0);
} else if (LivingEntity.class.isAssignableFrom(clazz)) {
if (Chicken.class.isAssignableFrom(clazz)) {
entity = new EntityChicken(world);
} else if (Cow.class.isAssignableFrom(clazz)) {
if (MushroomCow.class.isAssignableFrom(clazz)) {
entity = new EntityMooshroom(world);
} else {
entity = new EntityCow(world);
}
} else if (Golem.class.isAssignableFrom(clazz)) {
if (Snowman.class.isAssignableFrom(clazz)) {
entity = new EntitySnowman(world);
} else if (IronGolem.class.isAssignableFrom(clazz)) {
entity = new EntityIronGolem(world);
} else if (Shulker.class.isAssignableFrom(clazz)) {
entity = new EntityShulker(world);
}
} else if (Creeper.class.isAssignableFrom(clazz)) {
entity = new EntityCreeper(world);
} else if (Ghast.class.isAssignableFrom(clazz)) {
entity = new EntityGhast(world);
} else if (Pig.class.isAssignableFrom(clazz)) {
entity = new EntityPig(world);
} else if (Player.class.isAssignableFrom(clazz)) {
// need a net server handler for this one
} else if (Sheep.class.isAssignableFrom(clazz)) {
entity = new EntitySheep(world);
} else if (AbstractHorse.class.isAssignableFrom(clazz)) {
if (ChestedHorse.class.isAssignableFrom(clazz)) {
if (Donkey.class.isAssignableFrom(clazz)) {
entity = new EntityDonkey(world);
} else if (Mule.class.isAssignableFrom(clazz)) {
entity = new EntityMule(world);
} else if (Llama.class.isAssignableFrom(clazz)) {
entity = new EntityLlama(world);
}
} else if (SkeletonHorse.class.isAssignableFrom(clazz)) {
entity = new EntitySkeletonHorse(world);
} else if (ZombieHorse.class.isAssignableFrom(clazz)) {
entity = new EntityZombieHorse(world);
} else {
entity = new EntityHorse(world);
}
} else if (Skeleton.class.isAssignableFrom(clazz)) {
if (Stray.class.isAssignableFrom(clazz)) {
entity = new EntityStray(world);
} else if (WitherSkeleton.class.isAssignableFrom(clazz)) {
entity = new EntityWitherSkeleton(world);
} else {
entity = new EntitySkeleton(world);
}
} else if (Slime.class.isAssignableFrom(clazz)) {
if (MagmaCube.class.isAssignableFrom(clazz)) {
entity = new EntityMagmaCube(world);
} else {
entity = new EntitySlime(world);
}
} else if (Spider.class.isAssignableFrom(clazz)) {
if (CaveSpider.class.isAssignableFrom(clazz)) {
entity = new EntityCaveSpider(world);
} else {
entity = new EntitySpider(world);
}
} else if (Squid.class.isAssignableFrom(clazz)) {
entity = new EntitySquid(world);
} else if (Tameable.class.isAssignableFrom(clazz)) {
if (Wolf.class.isAssignableFrom(clazz)) {
entity = new EntityWolf(world);
} else if (Ocelot.class.isAssignableFrom(clazz)) {
entity = new EntityOcelot(world);
} else if (Parrot.class.isAssignableFrom(clazz)) {
entity = new EntityParrot(world);
}
} else if (PigZombie.class.isAssignableFrom(clazz)) {
entity = new EntityPigZombie(world);
} else if (Zombie.class.isAssignableFrom(clazz)) {
if (Husk.class.isAssignableFrom(clazz)) {
entity = new EntityHusk(world);
} else if (ZombieVillager.class.isAssignableFrom(clazz)) {
entity = new EntityZombieVillager(world);
} else {
entity = new EntityZombie(world);
}
} else if (Giant.class.isAssignableFrom(clazz)) {
entity = new EntityGiantZombie(world);
} else if (Silverfish.class.isAssignableFrom(clazz)) {
entity = new EntitySilverfish(world);
} else if (Enderman.class.isAssignableFrom(clazz)) {
entity = new EntityEnderman(world);
} else if (Blaze.class.isAssignableFrom(clazz)) {
entity = new EntityBlaze(world);
} else if (Villager.class.isAssignableFrom(clazz)) {
entity = new EntityVillager(world);
} else if (Witch.class.isAssignableFrom(clazz)) {
entity = new EntityWitch(world);
} else if (Wither.class.isAssignableFrom(clazz)) {
entity = new EntityWither(world);
} else if (ComplexLivingEntity.class.isAssignableFrom(clazz)) {
if (EnderDragon.class.isAssignableFrom(clazz)) {
entity = new EntityDragon(world);
}
} else if (Ambient.class.isAssignableFrom(clazz)) {
if (Bat.class.isAssignableFrom(clazz)) {
entity = new EntityBat(world);
}
} else if (Rabbit.class.isAssignableFrom(clazz)) {
entity = new EntityRabbit(world);
} else if (Endermite.class.isAssignableFrom(clazz)) {
entity = new EntityEndermite(world);
} else if (Guardian.class.isAssignableFrom(clazz)) {
if (ElderGuardian.class.isAssignableFrom(clazz)) {
entity = new EntityElderGuardian(world);
} else {
entity = new EntityGuardian(world);
}
} else if (ArmorStand.class.isAssignableFrom(clazz)) {
entity = new EntityArmorStand(world, x, y, z);
} else if (PolarBear.class.isAssignableFrom(clazz)) {
entity = new EntityPolarBear(world);
} else if (Vex.class.isAssignableFrom(clazz)) {
entity = new EntityVex(world);
} else if (Illager.class.isAssignableFrom(clazz)) {
if (Spellcaster.class.isAssignableFrom(clazz)) {
if (Evoker.class.isAssignableFrom(clazz)) {
entity = new EntityEvoker(world);
} else if (Illusioner.class.isAssignableFrom(clazz)) {
entity = new EntityIllusionIllager(world);
}
} else if (Vindicator.class.isAssignableFrom(clazz)) {
entity = new EntityVindicator(world);
}
}
if (entity != null) {
entity.setPositionAndRotation(x, y, z, yaw, pitch);
// SPIGOT-3587
entity.setRotationYawHead(yaw);
}
} else if (Hanging.class.isAssignableFrom(clazz)) {
Block block = getBlockAt(location);
BlockFace face = BlockFace.SELF;
// 1 full block, also painting smallest size.
int width = 16;
// 1 full block, also painting smallest size.
int height = 16;
if (ItemFrame.class.isAssignableFrom(clazz)) {
width = 12;
height = 12;
} else if (LeashHitch.class.isAssignableFrom(clazz)) {
width = 9;
height = 9;
}
BlockFace[] faces = new BlockFace[] { BlockFace.EAST, BlockFace.NORTH, BlockFace.WEST, BlockFace.SOUTH };
final BlockPos pos = new BlockPos((int) x, (int) y, (int) z);
for (BlockFace dir : faces) {
net.minecraft.block.Block nmsBlock = CraftMagicNumbers.getBlock(block.getRelative(dir));
if (nmsBlock.getDefaultState().getMaterial().isSolid() || BlockRedstoneDiode.isDiode(nmsBlock.getDefaultState())) {
boolean taken = false;
AxisAlignedBB bb = EntityHanging.calculateBoundingBox(null, pos, CraftBlock.blockFaceToNotch(dir).getOpposite(), width, height);
List<net.minecraft.entity.Entity> list = (List<net.minecraft.entity.Entity>) world.getEntitiesWithinAABBExcludingEntity(null, bb);
for (Iterator<net.minecraft.entity.Entity> it = list.iterator(); !taken && it.hasNext(); ) {
net.minecraft.entity.Entity e = it.next();
if (e instanceof EntityHanging) {
// Hanging entities do not like hanging entities which intersect them.
taken = true;
}
}
if (!taken) {
face = dir;
break;
}
}
}
if (LeashHitch.class.isAssignableFrom(clazz)) {
entity = new EntityLeashKnot(world, new BlockPos((int) x, (int) y, (int) z));
entity.forceSpawn = true;
} else {
// No valid face found
Preconditions.checkArgument(face != BlockFace.SELF, "Cannot spawn hanging entity for %s at %s (no free face)", clazz.getName(), location);
EnumFacing dir = CraftBlock.blockFaceToNotch(face).getOpposite();
if (Painting.class.isAssignableFrom(clazz)) {
entity = new EntityPainting(world, new BlockPos((int) x, (int) y, (int) z), dir);
} else if (ItemFrame.class.isAssignableFrom(clazz)) {
entity = new EntityItemFrame(world, new BlockPos((int) x, (int) y, (int) z), dir);
}
}
if (entity != null && !((EntityHanging) entity).onValidSurface()) {
throw new IllegalArgumentException("Cannot spawn hanging entity for " + clazz.getName() + " at " + location);
}
} else if (TNTPrimed.class.isAssignableFrom(clazz)) {
entity = new EntityTNTPrimed(world, x, y, z, null);
} else if (ExperienceOrb.class.isAssignableFrom(clazz)) {
entity = new EntityXPOrb(world, x, y, z, 0);
} else if (Weather.class.isAssignableFrom(clazz)) {
// not sure what this can do
if (LightningStrike.class.isAssignableFrom(clazz)) {
entity = new EntityLightningBolt(world, x, y, z, false);
// what is this, I don't even
}
} else if (Firework.class.isAssignableFrom(clazz)) {
entity = new EntityFireworkRocket(world, x, y, z, net.minecraft.item.ItemStack.EMPTY);
} else if (AreaEffectCloud.class.isAssignableFrom(clazz)) {
entity = new EntityAreaEffectCloud(world, x, y, z);
} else if (EvokerFangs.class.isAssignableFrom(clazz)) {
entity = new EntityEvokerFangs(world, x, y, z, (float) Math.toRadians(yaw), 0, null);
}
if (entity != null) {
return entity;
}
throw new IllegalArgumentException("Cannot spawn an entity for " + clazz.getName());
}
use of net.minecraft.entity.item.EntityEnderEye in project WizClient-1.8.9-Version by WizClient.
the class NetHandlerPlayClient method handleSpawnObject.
/**
* Spawns an instance of the objecttype indicated by the packet and sets its position and momentum
*/
public void handleSpawnObject(S0EPacketSpawnObject packetIn) {
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
double d0 = (double) packetIn.getX() / 32.0D;
double d1 = (double) packetIn.getY() / 32.0D;
double d2 = (double) packetIn.getZ() / 32.0D;
Entity entity = null;
if (packetIn.getType() == 10) {
entity = EntityMinecart.getMinecart(this.clientWorldController, d0, d1, d2, EntityMinecart.EnumMinecartType.byNetworkID(packetIn.func_149009_m()));
} else if (packetIn.getType() == 90) {
Entity entity1 = this.clientWorldController.getEntityByID(packetIn.func_149009_m());
if (entity1 instanceof EntityPlayer) {
entity = new EntityFishHook(this.clientWorldController, d0, d1, d2, (EntityPlayer) entity1);
}
packetIn.func_149002_g(0);
} else if (packetIn.getType() == 60) {
entity = new EntityArrow(this.clientWorldController, d0, d1, d2);
} else if (packetIn.getType() == 61) {
entity = new EntitySnowball(this.clientWorldController, d0, d1, d2);
} else if (packetIn.getType() == 71) {
entity = new EntityItemFrame(this.clientWorldController, new BlockPos(MathHelper.floor_double(d0), MathHelper.floor_double(d1), MathHelper.floor_double(d2)), EnumFacing.getHorizontal(packetIn.func_149009_m()));
packetIn.func_149002_g(0);
} else if (packetIn.getType() == 77) {
entity = new EntityLeashKnot(this.clientWorldController, new BlockPos(MathHelper.floor_double(d0), MathHelper.floor_double(d1), MathHelper.floor_double(d2)));
packetIn.func_149002_g(0);
} else if (packetIn.getType() == 65) {
entity = new EntityEnderPearl(this.clientWorldController, d0, d1, d2);
} else if (packetIn.getType() == 72) {
entity = new EntityEnderEye(this.clientWorldController, d0, d1, d2);
} else if (packetIn.getType() == 76) {
entity = new EntityFireworkRocket(this.clientWorldController, d0, d1, d2, (ItemStack) null);
} else if (packetIn.getType() == 63) {
entity = new EntityLargeFireball(this.clientWorldController, d0, d1, d2, (double) packetIn.getSpeedX() / 8000.0D, (double) packetIn.getSpeedY() / 8000.0D, (double) packetIn.getSpeedZ() / 8000.0D);
packetIn.func_149002_g(0);
} else if (packetIn.getType() == 64) {
entity = new EntitySmallFireball(this.clientWorldController, d0, d1, d2, (double) packetIn.getSpeedX() / 8000.0D, (double) packetIn.getSpeedY() / 8000.0D, (double) packetIn.getSpeedZ() / 8000.0D);
packetIn.func_149002_g(0);
} else if (packetIn.getType() == 66) {
entity = new EntityWitherSkull(this.clientWorldController, d0, d1, d2, (double) packetIn.getSpeedX() / 8000.0D, (double) packetIn.getSpeedY() / 8000.0D, (double) packetIn.getSpeedZ() / 8000.0D);
packetIn.func_149002_g(0);
} else if (packetIn.getType() == 62) {
entity = new EntityEgg(this.clientWorldController, d0, d1, d2);
} else if (packetIn.getType() == 73) {
entity = new EntityPotion(this.clientWorldController, d0, d1, d2, packetIn.func_149009_m());
packetIn.func_149002_g(0);
} else if (packetIn.getType() == 75) {
entity = new EntityExpBottle(this.clientWorldController, d0, d1, d2);
packetIn.func_149002_g(0);
} else if (packetIn.getType() == 1) {
entity = new EntityBoat(this.clientWorldController, d0, d1, d2);
} else if (packetIn.getType() == 50) {
entity = new EntityTNTPrimed(this.clientWorldController, d0, d1, d2, (EntityLivingBase) null);
} else if (packetIn.getType() == 78) {
entity = new EntityArmorStand(this.clientWorldController, d0, d1, d2);
} else if (packetIn.getType() == 51) {
entity = new EntityEnderCrystal(this.clientWorldController, d0, d1, d2);
} else if (packetIn.getType() == 2) {
entity = new EntityItem(this.clientWorldController, d0, d1, d2);
} else if (packetIn.getType() == 70) {
entity = new EntityFallingBlock(this.clientWorldController, d0, d1, d2, Block.getStateById(packetIn.func_149009_m() & 65535));
packetIn.func_149002_g(0);
}
if (entity != null) {
entity.serverPosX = packetIn.getX();
entity.serverPosY = packetIn.getY();
entity.serverPosZ = packetIn.getZ();
entity.rotationPitch = (float) (packetIn.getPitch() * 360) / 256.0F;
entity.rotationYaw = (float) (packetIn.getYaw() * 360) / 256.0F;
Entity[] aentity = entity.getParts();
if (aentity != null) {
int i = packetIn.getEntityID() - entity.getEntityId();
for (int j = 0; j < aentity.length; ++j) {
aentity[j].setEntityId(aentity[j].getEntityId() + i);
}
}
entity.setEntityId(packetIn.getEntityID());
this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entity);
if (packetIn.func_149009_m() > 0) {
if (packetIn.getType() == 60) {
Entity entity2 = this.clientWorldController.getEntityByID(packetIn.func_149009_m());
if (entity2 instanceof EntityLivingBase && entity instanceof EntityArrow) {
((EntityArrow) entity).shootingEntity = entity2;
}
}
entity.setVelocity((double) packetIn.getSpeedX() / 8000.0D, (double) packetIn.getSpeedY() / 8000.0D, (double) packetIn.getSpeedZ() / 8000.0D);
}
}
}
use of net.minecraft.entity.item.EntityEnderEye in project WizClient-1.8.9-Version by WizClient.
the class ItemEnderEye method onItemRightClick.
/**
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
*/
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) {
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(worldIn, playerIn, false);
if (movingobjectposition != null && movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && worldIn.getBlockState(movingobjectposition.getBlockPos()).getBlock() == Blocks.end_portal_frame) {
return itemStackIn;
} else {
if (!worldIn.isRemote) {
BlockPos blockpos = worldIn.getStrongholdPos("Stronghold", new BlockPos(playerIn));
if (blockpos != null) {
EntityEnderEye entityendereye = new EntityEnderEye(worldIn, playerIn.posX, playerIn.posY, playerIn.posZ);
entityendereye.moveTowards(blockpos);
worldIn.spawnEntityInWorld(entityendereye);
worldIn.playSoundAtEntity(playerIn, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
worldIn.playAuxSFXAtEntity((EntityPlayer) null, 1002, new BlockPos(playerIn), 0);
if (!playerIn.capabilities.isCreativeMode) {
--itemStackIn.stackSize;
}
playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]);
}
}
return itemStackIn;
}
}
use of net.minecraft.entity.item.EntityEnderEye in project kull by Sxmurai.
the class NetHandlerPlayClient method handleSpawnObject.
/**
* Spawns an instance of the objecttype indicated by the packet and sets its position and momentum
*/
public void handleSpawnObject(S0EPacketSpawnObject packetIn) {
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
double d0 = (double) packetIn.getX() / 32.0D;
double d1 = (double) packetIn.getY() / 32.0D;
double d2 = (double) packetIn.getZ() / 32.0D;
Entity entity = null;
if (packetIn.getType() == 10) {
entity = EntityMinecart.func_180458_a(this.clientWorldController, d0, d1, d2, EntityMinecart.EnumMinecartType.byNetworkID(packetIn.func_149009_m()));
} else if (packetIn.getType() == 90) {
Entity entity1 = this.clientWorldController.getEntityByID(packetIn.func_149009_m());
if (entity1 instanceof EntityPlayer) {
entity = new EntityFishHook(this.clientWorldController, d0, d1, d2, (EntityPlayer) entity1);
}
packetIn.func_149002_g(0);
} else if (packetIn.getType() == 60) {
entity = new EntityArrow(this.clientWorldController, d0, d1, d2);
} else if (packetIn.getType() == 61) {
entity = new EntitySnowball(this.clientWorldController, d0, d1, d2);
} else if (packetIn.getType() == 71) {
entity = new EntityItemFrame(this.clientWorldController, new BlockPos(MathHelper.floor_double(d0), MathHelper.floor_double(d1), MathHelper.floor_double(d2)), EnumFacing.getHorizontal(packetIn.func_149009_m()));
packetIn.func_149002_g(0);
} else if (packetIn.getType() == 77) {
entity = new EntityLeashKnot(this.clientWorldController, new BlockPos(MathHelper.floor_double(d0), MathHelper.floor_double(d1), MathHelper.floor_double(d2)));
packetIn.func_149002_g(0);
} else if (packetIn.getType() == 65) {
entity = new EntityEnderPearl(this.clientWorldController, d0, d1, d2);
} else if (packetIn.getType() == 72) {
entity = new EntityEnderEye(this.clientWorldController, d0, d1, d2);
} else if (packetIn.getType() == 76) {
entity = new EntityFireworkRocket(this.clientWorldController, d0, d1, d2, (ItemStack) null);
} else if (packetIn.getType() == 63) {
entity = new EntityLargeFireball(this.clientWorldController, d0, d1, d2, (double) packetIn.getSpeedX() / 8000.0D, (double) packetIn.getSpeedY() / 8000.0D, (double) packetIn.getSpeedZ() / 8000.0D);
packetIn.func_149002_g(0);
} else if (packetIn.getType() == 64) {
entity = new EntitySmallFireball(this.clientWorldController, d0, d1, d2, (double) packetIn.getSpeedX() / 8000.0D, (double) packetIn.getSpeedY() / 8000.0D, (double) packetIn.getSpeedZ() / 8000.0D);
packetIn.func_149002_g(0);
} else if (packetIn.getType() == 66) {
entity = new EntityWitherSkull(this.clientWorldController, d0, d1, d2, (double) packetIn.getSpeedX() / 8000.0D, (double) packetIn.getSpeedY() / 8000.0D, (double) packetIn.getSpeedZ() / 8000.0D);
packetIn.func_149002_g(0);
} else if (packetIn.getType() == 62) {
entity = new EntityEgg(this.clientWorldController, d0, d1, d2);
} else if (packetIn.getType() == 73) {
entity = new EntityPotion(this.clientWorldController, d0, d1, d2, packetIn.func_149009_m());
packetIn.func_149002_g(0);
} else if (packetIn.getType() == 75) {
entity = new EntityExpBottle(this.clientWorldController, d0, d1, d2);
packetIn.func_149002_g(0);
} else if (packetIn.getType() == 1) {
entity = new EntityBoat(this.clientWorldController, d0, d1, d2);
} else if (packetIn.getType() == 50) {
entity = new EntityTNTPrimed(this.clientWorldController, d0, d1, d2, (EntityLivingBase) null);
} else if (packetIn.getType() == 78) {
entity = new EntityArmorStand(this.clientWorldController, d0, d1, d2);
} else if (packetIn.getType() == 51) {
entity = new EntityEnderCrystal(this.clientWorldController, d0, d1, d2);
} else if (packetIn.getType() == 2) {
entity = new EntityItem(this.clientWorldController, d0, d1, d2);
} else if (packetIn.getType() == 70) {
entity = new EntityFallingBlock(this.clientWorldController, d0, d1, d2, Block.getStateById(packetIn.func_149009_m() & 65535));
packetIn.func_149002_g(0);
}
if (entity != null) {
entity.serverPosX = packetIn.getX();
entity.serverPosY = packetIn.getY();
entity.serverPosZ = packetIn.getZ();
entity.rotationPitch = (float) (packetIn.getPitch() * 360) / 256.0F;
entity.rotationYaw = (float) (packetIn.getYaw() * 360) / 256.0F;
Entity[] aentity = entity.getParts();
if (aentity != null) {
int i = packetIn.getEntityID() - entity.getEntityId();
for (int j = 0; j < aentity.length; ++j) {
aentity[j].setEntityId(aentity[j].getEntityId() + i);
}
}
entity.setEntityId(packetIn.getEntityID());
this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entity);
if (packetIn.func_149009_m() > 0) {
if (packetIn.getType() == 60) {
Entity entity2 = this.clientWorldController.getEntityByID(packetIn.func_149009_m());
if (entity2 instanceof EntityLivingBase && entity instanceof EntityArrow) {
((EntityArrow) entity).shootingEntity = entity2;
}
}
entity.setVelocity((double) packetIn.getSpeedX() / 8000.0D, (double) packetIn.getSpeedY() / 8000.0D, (double) packetIn.getSpeedZ() / 8000.0D);
}
}
}
Aggregations