Search in sources :

Example 1 with EntityEvokerFangs

use of net.minecraft.entity.projectile.EntityEvokerFangs 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());
}
Also used : EntityShulkerBullet(net.minecraft.entity.projectile.EntityShulkerBullet) EntityMooshroom(net.minecraft.entity.passive.EntityMooshroom) Entity(org.bukkit.entity.Entity) TileEntity(net.minecraft.tileentity.TileEntity) EntityCaveSpider(net.minecraft.entity.monster.EntityCaveSpider) BlockFace(org.bukkit.block.BlockFace) EntityParrot(net.minecraft.entity.passive.EntityParrot) EntityHorse(net.minecraft.entity.passive.EntityHorse) EntityVindicator(net.minecraft.entity.monster.EntityVindicator) EntityVillager(net.minecraft.entity.passive.EntityVillager) EntitySkeletonHorse(net.minecraft.entity.passive.EntitySkeletonHorse) EntityElderGuardian(net.minecraft.entity.monster.EntityElderGuardian) EntityGuardian(net.minecraft.entity.monster.EntityGuardian) EntityWither(net.minecraft.entity.boss.EntityWither) EntityGuardian(net.minecraft.entity.monster.EntityGuardian) Vector(org.bukkit.util.Vector) EntityFireball(net.minecraft.entity.projectile.EntityFireball) EntityDragon(net.minecraft.entity.boss.EntityDragon) EntityFallingBlock(net.minecraft.entity.item.EntityFallingBlock) EntityItemFrame(net.minecraft.entity.item.EntityItemFrame) EntityElderGuardian(net.minecraft.entity.monster.EntityElderGuardian) EntityMinecartTNT(net.minecraft.entity.item.EntityMinecartTNT) EntityElderGuardian(net.minecraft.entity.monster.EntityElderGuardian) EntityEvokerFangs(net.minecraft.entity.projectile.EntityEvokerFangs) EntityExpBottle(net.minecraft.entity.item.EntityExpBottle) EntityZombie(net.minecraft.entity.monster.EntityZombie) EntitySnowball(net.minecraft.entity.projectile.EntitySnowball) EntityCaveSpider(net.minecraft.entity.monster.EntityCaveSpider) EntityRabbit(net.minecraft.entity.passive.EntityRabbit) EntityMinecartCommandBlock(net.minecraft.entity.item.EntityMinecartCommandBlock) EntitySheep(net.minecraft.entity.passive.EntitySheep) ItemStack(org.bukkit.inventory.ItemStack) CraftItemStack(org.bukkit.craftbukkit.inventory.CraftItemStack) EntityMagmaCube(net.minecraft.entity.monster.EntityMagmaCube) EntityShulker(net.minecraft.entity.monster.EntityShulker) ExplosiveMinecart(org.bukkit.entity.minecart.ExplosiveMinecart) EntityLeashKnot(net.minecraft.entity.EntityLeashKnot) EntityTNTPrimed(net.minecraft.entity.item.EntityTNTPrimed) EnumFacing(net.minecraft.util.EnumFacing) EntityRabbit(net.minecraft.entity.passive.EntityRabbit) EntityOcelot(net.minecraft.entity.passive.EntityOcelot) EntityEnderPearl(net.minecraft.entity.item.EntityEnderPearl) EntityIronGolem(net.minecraft.entity.monster.EntityIronGolem) EntityShulkerBullet(net.minecraft.entity.projectile.EntityShulkerBullet) EntityLlama(net.minecraft.entity.passive.EntityLlama) EntityBlaze(net.minecraft.entity.monster.EntityBlaze) EntityIllusionIllager(net.minecraft.entity.monster.EntityIllusionIllager) EntityEgg(net.minecraft.entity.projectile.EntityEgg) PotionData(org.bukkit.potion.PotionData) EntityLlamaSpit(net.minecraft.entity.projectile.EntityLlamaSpit) EntityEvoker(net.minecraft.entity.monster.EntityEvoker) EntityPotion(net.minecraft.entity.projectile.EntityPotion) EntityPolarBear(net.minecraft.entity.monster.EntityPolarBear) EntityWitherSkeleton(net.minecraft.entity.monster.EntityWitherSkeleton) EntityWolf(net.minecraft.entity.passive.EntityWolf) EntityWitch(net.minecraft.entity.monster.EntityWitch) EntityBat(net.minecraft.entity.passive.EntityBat) EntityMule(net.minecraft.entity.passive.EntityMule) EntityHusk(net.minecraft.entity.monster.EntityHusk) EntityEnderCrystal(net.minecraft.entity.item.EntityEnderCrystal) EntityCow(net.minecraft.entity.passive.EntityCow) EntityEnderEye(net.minecraft.entity.item.EntityEnderEye) EntityMinecartHopper(net.minecraft.entity.item.EntityMinecartHopper) EntityPig(net.minecraft.entity.passive.EntityPig) EntitySilverfish(net.minecraft.entity.monster.EntitySilverfish) EntityFireworkRocket(net.minecraft.entity.item.EntityFireworkRocket) EntityBlaze(net.minecraft.entity.monster.EntityBlaze) EntityWitherSkull(net.minecraft.entity.projectile.EntityWitherSkull) EntityEvokerFangs(net.minecraft.entity.projectile.EntityEvokerFangs) org.bukkit.craftbukkit.entity(org.bukkit.craftbukkit.entity) org.bukkit.entity(org.bukkit.entity) EntityWitherSkull(net.minecraft.entity.projectile.EntityWitherSkull) EntityBoat(net.minecraft.entity.item.EntityBoat) StorageMinecart(org.bukkit.entity.minecart.StorageMinecart) ExplosiveMinecart(org.bukkit.entity.minecart.ExplosiveMinecart) PoweredMinecart(org.bukkit.entity.minecart.PoweredMinecart) HopperMinecart(org.bukkit.entity.minecart.HopperMinecart) CommandMinecart(org.bukkit.entity.minecart.CommandMinecart) SpawnerMinecart(org.bukkit.entity.minecart.SpawnerMinecart) EntitySpectralArrow(net.minecraft.entity.projectile.EntitySpectralArrow) EntityItemFrame(net.minecraft.entity.item.EntityItemFrame) EntityMinecartFurnace(net.minecraft.entity.item.EntityMinecartFurnace) EntityFallingBlock(net.minecraft.entity.item.EntityFallingBlock) EntityZombieVillager(net.minecraft.entity.monster.EntityZombieVillager) EntityHanging(net.minecraft.entity.EntityHanging) EntitySmallFireball(net.minecraft.entity.projectile.EntitySmallFireball) BlockPos(net.minecraft.util.math.BlockPos) ArrayList(java.util.ArrayList) List(java.util.List) EntityWolf(net.minecraft.entity.passive.EntityWolf) EntitySpider(net.minecraft.entity.monster.EntitySpider) EntityGiantZombie(net.minecraft.entity.monster.EntityGiantZombie) EntityZombie(net.minecraft.entity.monster.EntityZombie) EntityPigZombie(net.minecraft.entity.monster.EntityPigZombie) EntityParrot(net.minecraft.entity.passive.EntityParrot) EntitySlime(net.minecraft.entity.monster.EntitySlime) EntityArmorStand(net.minecraft.entity.item.EntityArmorStand) EntityEnderCrystal(net.minecraft.entity.item.EntityEnderCrystal) EntityEvoker(net.minecraft.entity.monster.EntityEvoker) EntityDonkey(net.minecraft.entity.passive.EntityDonkey) EntityMule(net.minecraft.entity.passive.EntityMule) EntityHusk(net.minecraft.entity.monster.EntityHusk) EntityChicken(net.minecraft.entity.passive.EntityChicken) EntityCreeper(net.minecraft.entity.monster.EntityCreeper) PoweredMinecart(org.bukkit.entity.minecart.PoweredMinecart) EntityIllusionIllager(net.minecraft.entity.monster.EntityIllusionIllager) EntityFallingBlock(net.minecraft.entity.item.EntityFallingBlock) EntityMinecartCommandBlock(net.minecraft.entity.item.EntityMinecartCommandBlock) Block(org.bukkit.block.Block) CraftBlock(org.bukkit.craftbukkit.block.CraftBlock) EntityMinecartEmpty(net.minecraft.entity.item.EntityMinecartEmpty) EntityEnderman(net.minecraft.entity.monster.EntityEnderman) AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) EntityStray(net.minecraft.entity.monster.EntityStray) EntityTippedArrow(net.minecraft.entity.projectile.EntityTippedArrow) EntityStray(net.minecraft.entity.monster.EntityStray) EntityMinecartChest(net.minecraft.entity.item.EntityMinecartChest) EntityLargeFireball(net.minecraft.entity.projectile.EntityLargeFireball) EntityCow(net.minecraft.entity.passive.EntityCow) EntityCreeper(net.minecraft.entity.monster.EntityCreeper) EntityPig(net.minecraft.entity.passive.EntityPig) EntitySkeleton(net.minecraft.entity.monster.EntitySkeleton) EntityAreaEffectCloud(net.minecraft.entity.EntityAreaEffectCloud) EntityGhast(net.minecraft.entity.monster.EntityGhast) EntitySilverfish(net.minecraft.entity.monster.EntitySilverfish) EntitySquid(net.minecraft.entity.passive.EntitySquid) EntityLightningBolt(net.minecraft.entity.effect.EntityLightningBolt) EntityDragonFireball(net.minecraft.entity.projectile.EntityDragonFireball) EntitySpectralArrow(net.minecraft.entity.projectile.EntitySpectralArrow) EntityMinecartMobSpawner(net.minecraft.entity.item.EntityMinecartMobSpawner) EntityPigZombie(net.minecraft.entity.monster.EntityPigZombie) Iterator(java.util.Iterator) EntitySkeleton(net.minecraft.entity.monster.EntitySkeleton) EntityWitherSkeleton(net.minecraft.entity.monster.EntityWitherSkeleton) EntitySkeletonHorse(net.minecraft.entity.passive.EntitySkeletonHorse) EntityWitch(net.minecraft.entity.monster.EntityWitch) EntityPolarBear(net.minecraft.entity.monster.EntityPolarBear) SpawnerMinecart(org.bukkit.entity.minecart.SpawnerMinecart) EntityEgg(net.minecraft.entity.projectile.EntityEgg) EntityGiantZombie(net.minecraft.entity.monster.EntityGiantZombie) EntityEndermite(net.minecraft.entity.monster.EntityEndermite) EntityVex(net.minecraft.entity.monster.EntityVex) EntityZombieHorse(net.minecraft.entity.passive.EntityZombieHorse) EntityPainting(net.minecraft.entity.item.EntityPainting) EntityPainting(net.minecraft.entity.item.EntityPainting) EntitySnowman(net.minecraft.entity.monster.EntitySnowman) EntityIronGolem(net.minecraft.entity.monster.EntityIronGolem) EntityHanging(net.minecraft.entity.EntityHanging) EntityCaveSpider(net.minecraft.entity.monster.EntityCaveSpider) EntitySpider(net.minecraft.entity.monster.EntitySpider) EntitySheep(net.minecraft.entity.passive.EntitySheep) EntityXPOrb(net.minecraft.entity.item.EntityXPOrb)

Example 2 with EntityEvokerFangs

use of net.minecraft.entity.projectile.EntityEvokerFangs in project Magma by magmafoundation.

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) {
        // Spigot start
        if (entity instanceof EntityOcelot) {
            ((EntityOcelot) entity).spawnBonus = false;
        }
        // Spigot end
        return entity;
    }
    throw new IllegalArgumentException("Cannot spawn an entity for " + clazz.getName());
}
Also used : EntityShulkerBullet(net.minecraft.entity.projectile.EntityShulkerBullet) EntityMooshroom(net.minecraft.entity.passive.EntityMooshroom) Entity(org.bukkit.entity.Entity) CraftEntity(org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity) TileEntity(net.minecraft.tileentity.TileEntity) EntityCaveSpider(net.minecraft.entity.monster.EntityCaveSpider) BlockFace(org.bukkit.block.BlockFace) EntityParrot(net.minecraft.entity.passive.EntityParrot) EntityHorse(net.minecraft.entity.passive.EntityHorse) EntityVindicator(net.minecraft.entity.monster.EntityVindicator) EntityVillager(net.minecraft.entity.passive.EntityVillager) EntitySkeletonHorse(net.minecraft.entity.passive.EntitySkeletonHorse) EntityElderGuardian(net.minecraft.entity.monster.EntityElderGuardian) EntityGuardian(net.minecraft.entity.monster.EntityGuardian) EntityWither(net.minecraft.entity.boss.EntityWither) EntityGuardian(net.minecraft.entity.monster.EntityGuardian) Vector(org.bukkit.util.Vector) EntityFireball(net.minecraft.entity.projectile.EntityFireball) EntityDragon(net.minecraft.entity.boss.EntityDragon) EntityFallingBlock(net.minecraft.entity.item.EntityFallingBlock) EntityItemFrame(net.minecraft.entity.item.EntityItemFrame) EntityElderGuardian(net.minecraft.entity.monster.EntityElderGuardian) EntityMinecartTNT(net.minecraft.entity.item.EntityMinecartTNT) EntityElderGuardian(net.minecraft.entity.monster.EntityElderGuardian) EntityEvokerFangs(net.minecraft.entity.projectile.EntityEvokerFangs) EntityExpBottle(net.minecraft.entity.item.EntityExpBottle) EntityZombie(net.minecraft.entity.monster.EntityZombie) EntitySnowball(net.minecraft.entity.projectile.EntitySnowball) EntityCaveSpider(net.minecraft.entity.monster.EntityCaveSpider) EntityRabbit(net.minecraft.entity.passive.EntityRabbit) EntityMinecartCommandBlock(net.minecraft.entity.item.EntityMinecartCommandBlock) EntitySheep(net.minecraft.entity.passive.EntitySheep) CraftItemStack(org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack) ItemStack(org.bukkit.inventory.ItemStack) EntityMagmaCube(net.minecraft.entity.monster.EntityMagmaCube) EntityShulker(net.minecraft.entity.monster.EntityShulker) ExplosiveMinecart(org.bukkit.entity.minecart.ExplosiveMinecart) EntityLeashKnot(net.minecraft.entity.EntityLeashKnot) EntityTNTPrimed(net.minecraft.entity.item.EntityTNTPrimed) EnumFacing(net.minecraft.util.EnumFacing) EntityRabbit(net.minecraft.entity.passive.EntityRabbit) EntityOcelot(net.minecraft.entity.passive.EntityOcelot) EntityEnderPearl(net.minecraft.entity.item.EntityEnderPearl) EntityIronGolem(net.minecraft.entity.monster.EntityIronGolem) EntityShulkerBullet(net.minecraft.entity.projectile.EntityShulkerBullet) EntityLlama(net.minecraft.entity.passive.EntityLlama) EntityBlaze(net.minecraft.entity.monster.EntityBlaze) EntityIllusionIllager(net.minecraft.entity.monster.EntityIllusionIllager) EntityEgg(net.minecraft.entity.projectile.EntityEgg) PotionData(org.bukkit.potion.PotionData) EntityLlamaSpit(net.minecraft.entity.projectile.EntityLlamaSpit) EntityEvoker(net.minecraft.entity.monster.EntityEvoker) EntityPotion(net.minecraft.entity.projectile.EntityPotion) EntityPolarBear(net.minecraft.entity.monster.EntityPolarBear) EntityWitherSkeleton(net.minecraft.entity.monster.EntityWitherSkeleton) EntityWolf(net.minecraft.entity.passive.EntityWolf) EntityWitch(net.minecraft.entity.monster.EntityWitch) EntityBat(net.minecraft.entity.passive.EntityBat) EntityMule(net.minecraft.entity.passive.EntityMule) EntityHusk(net.minecraft.entity.monster.EntityHusk) EntityEnderCrystal(net.minecraft.entity.item.EntityEnderCrystal) EntityCow(net.minecraft.entity.passive.EntityCow) EntityEnderEye(net.minecraft.entity.item.EntityEnderEye) EntityMinecartHopper(net.minecraft.entity.item.EntityMinecartHopper) EntityPig(net.minecraft.entity.passive.EntityPig) EntitySilverfish(net.minecraft.entity.monster.EntitySilverfish) EntityFireworkRocket(net.minecraft.entity.item.EntityFireworkRocket) EntityBlaze(net.minecraft.entity.monster.EntityBlaze) EntityWitherSkull(net.minecraft.entity.projectile.EntityWitherSkull) EntityEvokerFangs(net.minecraft.entity.projectile.EntityEvokerFangs) org.bukkit.entity(org.bukkit.entity) EntityWitherSkull(net.minecraft.entity.projectile.EntityWitherSkull) EntityBoat(net.minecraft.entity.item.EntityBoat) StorageMinecart(org.bukkit.entity.minecart.StorageMinecart) ExplosiveMinecart(org.bukkit.entity.minecart.ExplosiveMinecart) PoweredMinecart(org.bukkit.entity.minecart.PoweredMinecart) HopperMinecart(org.bukkit.entity.minecart.HopperMinecart) CommandMinecart(org.bukkit.entity.minecart.CommandMinecart) SpawnerMinecart(org.bukkit.entity.minecart.SpawnerMinecart) EntitySpectralArrow(net.minecraft.entity.projectile.EntitySpectralArrow) EntityItemFrame(net.minecraft.entity.item.EntityItemFrame) EntityMinecartFurnace(net.minecraft.entity.item.EntityMinecartFurnace) EntityFallingBlock(net.minecraft.entity.item.EntityFallingBlock) EntityZombieVillager(net.minecraft.entity.monster.EntityZombieVillager) EntityHanging(net.minecraft.entity.EntityHanging) EntitySmallFireball(net.minecraft.entity.projectile.EntitySmallFireball) BlockPos(net.minecraft.util.math.BlockPos) ArrayList(java.util.ArrayList) List(java.util.List) EntityWolf(net.minecraft.entity.passive.EntityWolf) EntitySpider(net.minecraft.entity.monster.EntitySpider) EntityGiantZombie(net.minecraft.entity.monster.EntityGiantZombie) EntityZombie(net.minecraft.entity.monster.EntityZombie) EntityPigZombie(net.minecraft.entity.monster.EntityPigZombie) EntityParrot(net.minecraft.entity.passive.EntityParrot) EntitySlime(net.minecraft.entity.monster.EntitySlime) EntityArmorStand(net.minecraft.entity.item.EntityArmorStand) EntityEnderCrystal(net.minecraft.entity.item.EntityEnderCrystal) EntityEvoker(net.minecraft.entity.monster.EntityEvoker) EntityDonkey(net.minecraft.entity.passive.EntityDonkey) EntityMule(net.minecraft.entity.passive.EntityMule) EntityHusk(net.minecraft.entity.monster.EntityHusk) EntityChicken(net.minecraft.entity.passive.EntityChicken) EntityCreeper(net.minecraft.entity.monster.EntityCreeper) PoweredMinecart(org.bukkit.entity.minecart.PoweredMinecart) EntityIllusionIllager(net.minecraft.entity.monster.EntityIllusionIllager) EntityFallingBlock(net.minecraft.entity.item.EntityFallingBlock) EntityMinecartCommandBlock(net.minecraft.entity.item.EntityMinecartCommandBlock) Block(org.bukkit.block.Block) CraftBlock(org.bukkit.craftbukkit.v1_12_R1.block.CraftBlock) EntityMinecartEmpty(net.minecraft.entity.item.EntityMinecartEmpty) EntityEnderman(net.minecraft.entity.monster.EntityEnderman) AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) EntityStray(net.minecraft.entity.monster.EntityStray) EntityTippedArrow(net.minecraft.entity.projectile.EntityTippedArrow) EntityStray(net.minecraft.entity.monster.EntityStray) EntityMinecartChest(net.minecraft.entity.item.EntityMinecartChest) EntityLargeFireball(net.minecraft.entity.projectile.EntityLargeFireball) EntityCow(net.minecraft.entity.passive.EntityCow) EntityCreeper(net.minecraft.entity.monster.EntityCreeper) EntityPig(net.minecraft.entity.passive.EntityPig) EntitySkeleton(net.minecraft.entity.monster.EntitySkeleton) EntityAreaEffectCloud(net.minecraft.entity.EntityAreaEffectCloud) EntityGhast(net.minecraft.entity.monster.EntityGhast) EntitySilverfish(net.minecraft.entity.monster.EntitySilverfish) EntitySquid(net.minecraft.entity.passive.EntitySquid) EntityLightningBolt(net.minecraft.entity.effect.EntityLightningBolt) EntityDragonFireball(net.minecraft.entity.projectile.EntityDragonFireball) EntitySpectralArrow(net.minecraft.entity.projectile.EntitySpectralArrow) EntityMinecartMobSpawner(net.minecraft.entity.item.EntityMinecartMobSpawner) EntityPigZombie(net.minecraft.entity.monster.EntityPigZombie) Iterator(java.util.Iterator) EntitySkeleton(net.minecraft.entity.monster.EntitySkeleton) EntityWitherSkeleton(net.minecraft.entity.monster.EntityWitherSkeleton) EntitySkeletonHorse(net.minecraft.entity.passive.EntitySkeletonHorse) EntityWitch(net.minecraft.entity.monster.EntityWitch) EntityPolarBear(net.minecraft.entity.monster.EntityPolarBear) SpawnerMinecart(org.bukkit.entity.minecart.SpawnerMinecart) EntityEgg(net.minecraft.entity.projectile.EntityEgg) EntityGiantZombie(net.minecraft.entity.monster.EntityGiantZombie) EntityEndermite(net.minecraft.entity.monster.EntityEndermite) EntityVex(net.minecraft.entity.monster.EntityVex) EntityZombieHorse(net.minecraft.entity.passive.EntityZombieHorse) EntityPainting(net.minecraft.entity.item.EntityPainting) EntityPainting(net.minecraft.entity.item.EntityPainting) EntitySnowman(net.minecraft.entity.monster.EntitySnowman) EntityIronGolem(net.minecraft.entity.monster.EntityIronGolem) EntityHanging(net.minecraft.entity.EntityHanging) EntityCaveSpider(net.minecraft.entity.monster.EntityCaveSpider) EntitySpider(net.minecraft.entity.monster.EntitySpider) EntitySheep(net.minecraft.entity.passive.EntitySheep) EntityXPOrb(net.minecraft.entity.item.EntityXPOrb)

Example 3 with EntityEvokerFangs

use of net.minecraft.entity.projectile.EntityEvokerFangs in project Minecraft-SlientClient-Hack by YouNeverKnow00.

the class EntityTracker method trackEntity.

public void trackEntity(Entity entityIn) {
    if (entityIn instanceof EntityPlayerMP) {
        this.trackEntity(entityIn, 512, 2);
        EntityPlayerMP entityplayermp = (EntityPlayerMP) entityIn;
        for (EntityTrackerEntry entitytrackerentry : this.trackedEntities) {
            if (entitytrackerentry.getTrackedEntity() != entityplayermp) {
                entitytrackerentry.updatePlayerEntity(entityplayermp);
            }
        }
    } else if (entityIn instanceof EntityFishHook) {
        this.addEntityToTracker(entityIn, 64, 5, true);
    } else if (entityIn instanceof EntityArrow) {
        this.addEntityToTracker(entityIn, 64, 20, false);
    } else if (entityIn instanceof EntitySmallFireball) {
        this.addEntityToTracker(entityIn, 64, 10, false);
    } else if (entityIn instanceof EntityFireball) {
        this.addEntityToTracker(entityIn, 64, 10, true);
    } else if (entityIn instanceof EntitySnowball) {
        this.addEntityToTracker(entityIn, 64, 10, true);
    } else if (entityIn instanceof EntityLlamaSpit) {
        this.addEntityToTracker(entityIn, 64, 10, false);
    } else if (entityIn instanceof EntityEnderPearl) {
        this.addEntityToTracker(entityIn, 64, 10, true);
    } else if (entityIn instanceof EntityEnderEye) {
        this.addEntityToTracker(entityIn, 64, 4, true);
    } else if (entityIn instanceof EntityEgg) {
        this.addEntityToTracker(entityIn, 64, 10, true);
    } else if (entityIn instanceof EntityPotion) {
        this.addEntityToTracker(entityIn, 64, 10, true);
    } else if (entityIn instanceof EntityExpBottle) {
        this.addEntityToTracker(entityIn, 64, 10, true);
    } else if (entityIn instanceof EntityFireworkRocket) {
        this.addEntityToTracker(entityIn, 64, 10, true);
    } else if (entityIn instanceof EntityItem) {
        this.addEntityToTracker(entityIn, 64, 20, true);
    } else if (entityIn instanceof EntityMinecart) {
        this.addEntityToTracker(entityIn, 80, 3, true);
    } else if (entityIn instanceof EntityBoat) {
        this.addEntityToTracker(entityIn, 80, 3, true);
    } else if (entityIn instanceof EntitySquid) {
        this.addEntityToTracker(entityIn, 64, 3, true);
    } else if (entityIn instanceof EntityWither) {
        this.addEntityToTracker(entityIn, 80, 3, false);
    } else if (entityIn instanceof EntityShulkerBullet) {
        this.addEntityToTracker(entityIn, 80, 3, true);
    } else if (entityIn instanceof EntityBat) {
        this.addEntityToTracker(entityIn, 80, 3, false);
    } else if (entityIn instanceof EntityDragon) {
        this.addEntityToTracker(entityIn, 160, 3, true);
    } else if (entityIn instanceof IAnimals) {
        this.addEntityToTracker(entityIn, 80, 3, true);
    } else if (entityIn instanceof EntityTNTPrimed) {
        this.addEntityToTracker(entityIn, 160, 10, true);
    } else if (entityIn instanceof EntityFallingBlock) {
        this.addEntityToTracker(entityIn, 160, 20, true);
    } else if (entityIn instanceof EntityHanging) {
        this.addEntityToTracker(entityIn, 160, Integer.MAX_VALUE, false);
    } else if (entityIn instanceof EntityArmorStand) {
        this.addEntityToTracker(entityIn, 160, 3, true);
    } else if (entityIn instanceof EntityXPOrb) {
        this.addEntityToTracker(entityIn, 160, 20, true);
    } else if (entityIn instanceof EntityAreaEffectCloud) {
        this.addEntityToTracker(entityIn, 160, Integer.MAX_VALUE, true);
    } else if (entityIn instanceof EntityEnderCrystal) {
        this.addEntityToTracker(entityIn, 256, Integer.MAX_VALUE, false);
    } else if (entityIn instanceof EntityEvokerFangs) {
        this.addEntityToTracker(entityIn, 160, 2, false);
    }
}
Also used : EntityShulkerBullet(net.minecraft.entity.projectile.EntityShulkerBullet) EntityTNTPrimed(net.minecraft.entity.item.EntityTNTPrimed) EntityBoat(net.minecraft.entity.item.EntityBoat) EntityEnderPearl(net.minecraft.entity.item.EntityEnderPearl) EntitySquid(net.minecraft.entity.passive.EntitySquid) EntityMinecart(net.minecraft.entity.item.EntityMinecart) EntityEgg(net.minecraft.entity.projectile.EntityEgg) EntityLlamaSpit(net.minecraft.entity.projectile.EntityLlamaSpit) EntitySmallFireball(net.minecraft.entity.projectile.EntitySmallFireball) EntityPotion(net.minecraft.entity.projectile.EntityPotion) EntityWither(net.minecraft.entity.boss.EntityWither) EntityFireball(net.minecraft.entity.projectile.EntityFireball) EntityItem(net.minecraft.entity.item.EntityItem) EntityBat(net.minecraft.entity.passive.EntityBat) EntityArrow(net.minecraft.entity.projectile.EntityArrow) EntityDragon(net.minecraft.entity.boss.EntityDragon) EntityFallingBlock(net.minecraft.entity.item.EntityFallingBlock) EntityFishHook(net.minecraft.entity.projectile.EntityFishHook) EntityEnderCrystal(net.minecraft.entity.item.EntityEnderCrystal) EntityArmorStand(net.minecraft.entity.item.EntityArmorStand) EntityEnderEye(net.minecraft.entity.item.EntityEnderEye) EntityExpBottle(net.minecraft.entity.item.EntityExpBottle) EntityFireworkRocket(net.minecraft.entity.item.EntityFireworkRocket) IAnimals(net.minecraft.entity.passive.IAnimals) EntitySnowball(net.minecraft.entity.projectile.EntitySnowball) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) EntityEvokerFangs(net.minecraft.entity.projectile.EntityEvokerFangs) EntityXPOrb(net.minecraft.entity.item.EntityXPOrb)

Example 4 with EntityEvokerFangs

use of net.minecraft.entity.projectile.EntityEvokerFangs in project Minecraft-SlientClient-Hack by YouNeverKnow00.

the class EntityTrackerEntry method createSpawnPacket.

private Packet<?> createSpawnPacket() {
    if (this.trackedEntity.isDead) {
        LOGGER.warn("Fetching addPacket for removed entity");
    }
    if (this.trackedEntity instanceof EntityPlayerMP) {
        return new SPacketSpawnPlayer((EntityPlayer) this.trackedEntity);
    } else if (this.trackedEntity instanceof IAnimals) {
        this.lastHeadMotion = MathHelper.floor(this.trackedEntity.getRotationYawHead() * 256.0F / 360.0F);
        return new SPacketSpawnMob((EntityLivingBase) this.trackedEntity);
    } else if (this.trackedEntity instanceof EntityPainting) {
        return new SPacketSpawnPainting((EntityPainting) this.trackedEntity);
    } else if (this.trackedEntity instanceof EntityItem) {
        return new SPacketSpawnObject(this.trackedEntity, 2, 1);
    } else if (this.trackedEntity instanceof EntityMinecart) {
        EntityMinecart entityminecart = (EntityMinecart) this.trackedEntity;
        return new SPacketSpawnObject(this.trackedEntity, 10, entityminecart.getType().getId());
    } else if (this.trackedEntity instanceof EntityBoat) {
        return new SPacketSpawnObject(this.trackedEntity, 1);
    } else if (this.trackedEntity instanceof EntityXPOrb) {
        return new SPacketSpawnExperienceOrb((EntityXPOrb) this.trackedEntity);
    } else if (this.trackedEntity instanceof EntityFishHook) {
        Entity entity2 = ((EntityFishHook) this.trackedEntity).func_190619_l();
        return new SPacketSpawnObject(this.trackedEntity, 90, entity2 == null ? this.trackedEntity.getEntityId() : entity2.getEntityId());
    } else if (this.trackedEntity instanceof EntitySpectralArrow) {
        Entity entity1 = ((EntitySpectralArrow) this.trackedEntity).shootingEntity;
        return new SPacketSpawnObject(this.trackedEntity, 91, 1 + (entity1 == null ? this.trackedEntity.getEntityId() : entity1.getEntityId()));
    } else if (this.trackedEntity instanceof EntityTippedArrow) {
        Entity entity = ((EntityArrow) this.trackedEntity).shootingEntity;
        return new SPacketSpawnObject(this.trackedEntity, 60, 1 + (entity == null ? this.trackedEntity.getEntityId() : entity.getEntityId()));
    } else if (this.trackedEntity instanceof EntitySnowball) {
        return new SPacketSpawnObject(this.trackedEntity, 61);
    } else if (this.trackedEntity instanceof EntityLlamaSpit) {
        return new SPacketSpawnObject(this.trackedEntity, 68);
    } else if (this.trackedEntity instanceof EntityPotion) {
        return new SPacketSpawnObject(this.trackedEntity, 73);
    } else if (this.trackedEntity instanceof EntityExpBottle) {
        return new SPacketSpawnObject(this.trackedEntity, 75);
    } else if (this.trackedEntity instanceof EntityEnderPearl) {
        return new SPacketSpawnObject(this.trackedEntity, 65);
    } else if (this.trackedEntity instanceof EntityEnderEye) {
        return new SPacketSpawnObject(this.trackedEntity, 72);
    } else if (this.trackedEntity instanceof EntityFireworkRocket) {
        return new SPacketSpawnObject(this.trackedEntity, 76);
    } else if (this.trackedEntity instanceof EntityFireball) {
        EntityFireball entityfireball = (EntityFireball) this.trackedEntity;
        SPacketSpawnObject spacketspawnobject = null;
        int i = 63;
        if (this.trackedEntity instanceof EntitySmallFireball) {
            i = 64;
        } else if (this.trackedEntity instanceof EntityDragonFireball) {
            i = 93;
        } else if (this.trackedEntity instanceof EntityWitherSkull) {
            i = 66;
        }
        if (entityfireball.shootingEntity != null) {
            spacketspawnobject = new SPacketSpawnObject(this.trackedEntity, i, ((EntityFireball) this.trackedEntity).shootingEntity.getEntityId());
        } else {
            spacketspawnobject = new SPacketSpawnObject(this.trackedEntity, i, 0);
        }
        spacketspawnobject.setSpeedX((int) (entityfireball.accelerationX * 8000.0D));
        spacketspawnobject.setSpeedY((int) (entityfireball.accelerationY * 8000.0D));
        spacketspawnobject.setSpeedZ((int) (entityfireball.accelerationZ * 8000.0D));
        return spacketspawnobject;
    } else if (this.trackedEntity instanceof EntityShulkerBullet) {
        SPacketSpawnObject spacketspawnobject1 = new SPacketSpawnObject(this.trackedEntity, 67, 0);
        spacketspawnobject1.setSpeedX((int) (this.trackedEntity.motionX * 8000.0D));
        spacketspawnobject1.setSpeedY((int) (this.trackedEntity.motionY * 8000.0D));
        spacketspawnobject1.setSpeedZ((int) (this.trackedEntity.motionZ * 8000.0D));
        return spacketspawnobject1;
    } else if (this.trackedEntity instanceof EntityEgg) {
        return new SPacketSpawnObject(this.trackedEntity, 62);
    } else if (this.trackedEntity instanceof EntityEvokerFangs) {
        return new SPacketSpawnObject(this.trackedEntity, 79);
    } else if (this.trackedEntity instanceof EntityTNTPrimed) {
        return new SPacketSpawnObject(this.trackedEntity, 50);
    } else if (this.trackedEntity instanceof EntityEnderCrystal) {
        return new SPacketSpawnObject(this.trackedEntity, 51);
    } else if (this.trackedEntity instanceof EntityFallingBlock) {
        EntityFallingBlock entityfallingblock = (EntityFallingBlock) this.trackedEntity;
        return new SPacketSpawnObject(this.trackedEntity, 70, Block.getStateId(entityfallingblock.getBlock()));
    } else if (this.trackedEntity instanceof EntityArmorStand) {
        return new SPacketSpawnObject(this.trackedEntity, 78);
    } else if (this.trackedEntity instanceof EntityItemFrame) {
        EntityItemFrame entityitemframe = (EntityItemFrame) this.trackedEntity;
        return new SPacketSpawnObject(this.trackedEntity, 71, entityitemframe.facingDirection.getHorizontalIndex(), entityitemframe.getHangingPosition());
    } else if (this.trackedEntity instanceof EntityLeashKnot) {
        EntityLeashKnot entityleashknot = (EntityLeashKnot) this.trackedEntity;
        return new SPacketSpawnObject(this.trackedEntity, 77, 0, entityleashknot.getHangingPosition());
    } else if (this.trackedEntity instanceof EntityAreaEffectCloud) {
        return new SPacketSpawnObject(this.trackedEntity, 3);
    } else {
        throw new IllegalArgumentException("Don't know how to add " + this.trackedEntity.getClass() + "!");
    }
}
Also used : EntityShulkerBullet(net.minecraft.entity.projectile.EntityShulkerBullet) SPacketEntity(net.minecraft.network.play.server.SPacketEntity) EntityWitherSkull(net.minecraft.entity.projectile.EntityWitherSkull) EntityTippedArrow(net.minecraft.entity.projectile.EntityTippedArrow) SPacketSpawnExperienceOrb(net.minecraft.network.play.server.SPacketSpawnExperienceOrb) SPacketSpawnObject(net.minecraft.network.play.server.SPacketSpawnObject) EntityTNTPrimed(net.minecraft.entity.item.EntityTNTPrimed) EntityBoat(net.minecraft.entity.item.EntityBoat) EntityEnderPearl(net.minecraft.entity.item.EntityEnderPearl) SPacketSpawnPainting(net.minecraft.network.play.server.SPacketSpawnPainting) EntityMinecart(net.minecraft.entity.item.EntityMinecart) EntityDragonFireball(net.minecraft.entity.projectile.EntityDragonFireball) EntityEgg(net.minecraft.entity.projectile.EntityEgg) EntitySpectralArrow(net.minecraft.entity.projectile.EntitySpectralArrow) EntityLlamaSpit(net.minecraft.entity.projectile.EntityLlamaSpit) EntitySmallFireball(net.minecraft.entity.projectile.EntitySmallFireball) SPacketSpawnPlayer(net.minecraft.network.play.server.SPacketSpawnPlayer) EntityPotion(net.minecraft.entity.projectile.EntityPotion) EntityItem(net.minecraft.entity.item.EntityItem) EntityFireball(net.minecraft.entity.projectile.EntityFireball) EntityFallingBlock(net.minecraft.entity.item.EntityFallingBlock) EntityItemFrame(net.minecraft.entity.item.EntityItemFrame) EntityFishHook(net.minecraft.entity.projectile.EntityFishHook) EntityEnderCrystal(net.minecraft.entity.item.EntityEnderCrystal) EntityArmorStand(net.minecraft.entity.item.EntityArmorStand) EntityEnderEye(net.minecraft.entity.item.EntityEnderEye) EntityPainting(net.minecraft.entity.item.EntityPainting) EntityExpBottle(net.minecraft.entity.item.EntityExpBottle) IAnimals(net.minecraft.entity.passive.IAnimals) EntityFireworkRocket(net.minecraft.entity.item.EntityFireworkRocket) EntitySnowball(net.minecraft.entity.projectile.EntitySnowball) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) EntityEvokerFangs(net.minecraft.entity.projectile.EntityEvokerFangs) SPacketSpawnMob(net.minecraft.network.play.server.SPacketSpawnMob) EntityXPOrb(net.minecraft.entity.item.EntityXPOrb)

Example 5 with EntityEvokerFangs

use of net.minecraft.entity.projectile.EntityEvokerFangs in project Minecraft-SlientClient-Hack by YouNeverKnow00.

the class NetHandlerPlayClient method handleSpawnObject.

/**
 * Spawns an instance of the objecttype indicated by the packet and sets its position and momentum
 */
public void handleSpawnObject(SPacketSpawnObject packetIn) {
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    double d0 = packetIn.getX();
    double d1 = packetIn.getY();
    double d2 = packetIn.getZ();
    Entity entity = null;
    if (packetIn.getType() == 10) {
        entity = EntityMinecart.create(this.clientWorldController, d0, d1, d2, EntityMinecart.Type.getById(packetIn.getData()));
    } else if (packetIn.getType() == 90) {
        Entity entity1 = this.clientWorldController.getEntityByID(packetIn.getData());
        if (entity1 instanceof EntityPlayer) {
            entity = new EntityFishHook(this.clientWorldController, (EntityPlayer) entity1, d0, d1, d2);
        }
        packetIn.setData(0);
    } else if (packetIn.getType() == 60) {
        entity = new EntityTippedArrow(this.clientWorldController, d0, d1, d2);
    } else if (packetIn.getType() == 91) {
        entity = new EntitySpectralArrow(this.clientWorldController, d0, d1, d2);
    } else if (packetIn.getType() == 61) {
        entity = new EntitySnowball(this.clientWorldController, d0, d1, d2);
    } else if (packetIn.getType() == 68) {
        entity = new EntityLlamaSpit(this.clientWorldController, d0, d1, d2, (double) packetIn.getSpeedX() / 8000.0D, (double) packetIn.getSpeedY() / 8000.0D, (double) packetIn.getSpeedZ() / 8000.0D);
    } else if (packetIn.getType() == 71) {
        entity = new EntityItemFrame(this.clientWorldController, new BlockPos(d0, d1, d2), EnumFacing.getHorizontal(packetIn.getData()));
        packetIn.setData(0);
    } else if (packetIn.getType() == 77) {
        entity = new EntityLeashKnot(this.clientWorldController, new BlockPos(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2)));
        packetIn.setData(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.field_190927_a);
    } 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.setData(0);
    } else if (packetIn.getType() == 93) {
        entity = new EntityDragonFireball(this.clientWorldController, d0, d1, d2, (double) packetIn.getSpeedX() / 8000.0D, (double) packetIn.getSpeedY() / 8000.0D, (double) packetIn.getSpeedZ() / 8000.0D);
        packetIn.setData(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.setData(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.setData(0);
    } else if (packetIn.getType() == 67) {
        entity = new EntityShulkerBullet(this.clientWorldController, d0, d1, d2, (double) packetIn.getSpeedX() / 8000.0D, (double) packetIn.getSpeedY() / 8000.0D, (double) packetIn.getSpeedZ() / 8000.0D);
        packetIn.setData(0);
    } else if (packetIn.getType() == 62) {
        entity = new EntityEgg(this.clientWorldController, d0, d1, d2);
    } else if (packetIn.getType() == 79) {
        entity = new EntityEvokerFangs(this.clientWorldController, d0, d1, d2, 0.0F, 0, (EntityLivingBase) null);
    } else if (packetIn.getType() == 73) {
        entity = new EntityPotion(this.clientWorldController, d0, d1, d2, ItemStack.field_190927_a);
        packetIn.setData(0);
    } else if (packetIn.getType() == 75) {
        entity = new EntityExpBottle(this.clientWorldController, d0, d1, d2);
        packetIn.setData(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.getData() & 65535));
        packetIn.setData(0);
    } else if (packetIn.getType() == 3) {
        entity = new EntityAreaEffectCloud(this.clientWorldController, d0, d1, d2);
    }
    if (entity != null) {
        EntityTracker.updateServerPosition(entity, d0, d1, d2);
        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 (Entity entity2 : aentity) {
                entity2.setEntityId(entity2.getEntityId() + i);
            }
        }
        entity.setEntityId(packetIn.getEntityID());
        entity.setUniqueId(packetIn.getUniqueId());
        this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entity);
        if (packetIn.getData() > 0) {
            if (packetIn.getType() == 60 || packetIn.getType() == 91) {
                Entity entity3 = this.clientWorldController.getEntityByID(packetIn.getData() - 1);
                if (entity3 instanceof EntityLivingBase && entity instanceof EntityArrow) {
                    ((EntityArrow) entity).shootingEntity = entity3;
                }
            }
            entity.setVelocity((double) packetIn.getSpeedX() / 8000.0D, (double) packetIn.getSpeedY() / 8000.0D, (double) packetIn.getSpeedZ() / 8000.0D);
        }
    }
}
Also used : EntityLeashKnot(net.minecraft.entity.EntityLeashKnot) EntityShulkerBullet(net.minecraft.entity.projectile.EntityShulkerBullet) SPacketSpawnGlobalEntity(net.minecraft.network.play.server.SPacketSpawnGlobalEntity) SPacketUpdateTileEntity(net.minecraft.network.play.server.SPacketUpdateTileEntity) TileEntity(net.minecraft.tileentity.TileEntity) SPacketEntity(net.minecraft.network.play.server.SPacketEntity) Entity(net.minecraft.entity.Entity) EntityWitherSkull(net.minecraft.entity.projectile.EntityWitherSkull) EntityTippedArrow(net.minecraft.entity.projectile.EntityTippedArrow) EntityLargeFireball(net.minecraft.entity.projectile.EntityLargeFireball) EntityTNTPrimed(net.minecraft.entity.item.EntityTNTPrimed) EntityBoat(net.minecraft.entity.item.EntityBoat) EntityAreaEffectCloud(net.minecraft.entity.EntityAreaEffectCloud) EntityEnderPearl(net.minecraft.entity.item.EntityEnderPearl) EntityDragonFireball(net.minecraft.entity.projectile.EntityDragonFireball) EntityEgg(net.minecraft.entity.projectile.EntityEgg) EntitySpectralArrow(net.minecraft.entity.projectile.EntitySpectralArrow) EntityLlamaSpit(net.minecraft.entity.projectile.EntityLlamaSpit) EntitySmallFireball(net.minecraft.entity.projectile.EntitySmallFireball) EntityPotion(net.minecraft.entity.projectile.EntityPotion) BlockPos(net.minecraft.util.math.BlockPos) EntityItem(net.minecraft.entity.item.EntityItem) EntityArrow(net.minecraft.entity.projectile.EntityArrow) EntityItemFrame(net.minecraft.entity.item.EntityItemFrame) EntityFallingBlock(net.minecraft.entity.item.EntityFallingBlock) EntityFishHook(net.minecraft.entity.projectile.EntityFishHook) EntityEnderCrystal(net.minecraft.entity.item.EntityEnderCrystal) EntityArmorStand(net.minecraft.entity.item.EntityArmorStand) EntityEnderEye(net.minecraft.entity.item.EntityEnderEye) EntityExpBottle(net.minecraft.entity.item.EntityExpBottle) EntityFireworkRocket(net.minecraft.entity.item.EntityFireworkRocket) EntitySnowball(net.minecraft.entity.projectile.EntitySnowball) EntityLivingBase(net.minecraft.entity.EntityLivingBase) EntityPlayer(net.minecraft.entity.player.EntityPlayer) EntityEvokerFangs(net.minecraft.entity.projectile.EntityEvokerFangs)

Aggregations

EntityArmorStand (net.minecraft.entity.item.EntityArmorStand)8 EntityBoat (net.minecraft.entity.item.EntityBoat)8 EntityEnderCrystal (net.minecraft.entity.item.EntityEnderCrystal)8 EntityEnderEye (net.minecraft.entity.item.EntityEnderEye)8 EntityEnderPearl (net.minecraft.entity.item.EntityEnderPearl)8 EntityExpBottle (net.minecraft.entity.item.EntityExpBottle)8 EntityFallingBlock (net.minecraft.entity.item.EntityFallingBlock)8 EntityFireworkRocket (net.minecraft.entity.item.EntityFireworkRocket)8 EntityTNTPrimed (net.minecraft.entity.item.EntityTNTPrimed)8 EntityEgg (net.minecraft.entity.projectile.EntityEgg)7 EntityEvokerFangs (net.minecraft.entity.projectile.EntityEvokerFangs)7 EntityLlamaSpit (net.minecraft.entity.projectile.EntityLlamaSpit)7 EntityPotion (net.minecraft.entity.projectile.EntityPotion)7 EntityShulkerBullet (net.minecraft.entity.projectile.EntityShulkerBullet)7 EntitySmallFireball (net.minecraft.entity.projectile.EntitySmallFireball)7 EntitySnowball (net.minecraft.entity.projectile.EntitySnowball)7 EntityItem (net.minecraft.entity.item.EntityItem)6 EntityItemFrame (net.minecraft.entity.item.EntityItemFrame)6 EntityXPOrb (net.minecraft.entity.item.EntityXPOrb)6 EntityFishHook (net.minecraft.entity.projectile.EntityFishHook)6