Search in sources :

Example 1 with EntityMagmaCube

use of net.minecraft.entity.monster.EntityMagmaCube 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 EntityMagmaCube

use of net.minecraft.entity.monster.EntityMagmaCube in project Minecraft-SlientClient-Hack by YouNeverKnow00.

the class ModelMagmaCube method setLivingAnimations.

/**
 * Used for easily adding entity-dependent animations. The second and third float params here are the same second
 * and third as in the setRotationAngles method.
 */
public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime) {
    EntityMagmaCube entitymagmacube = (EntityMagmaCube) entitylivingbaseIn;
    float f = entitymagmacube.prevSquishFactor + (entitymagmacube.squishFactor - entitymagmacube.prevSquishFactor) * partialTickTime;
    if (f < 0.0F) {
        f = 0.0F;
    }
    for (int i = 0; i < this.segments.length; ++i) {
        this.segments[i].rotationPointY = (float) (-(4 - i)) * f * 1.7F;
    }
}
Also used : EntityMagmaCube(net.minecraft.entity.monster.EntityMagmaCube)

Example 3 with EntityMagmaCube

use of net.minecraft.entity.monster.EntityMagmaCube in project WizClient-1.8.9-Version by WizClient.

the class ModelMagmaCube method setLivingAnimations.

/**
 * Used for easily adding entity-dependent animations. The second and third float params here are the same second
 * and third as in the setRotationAngles method.
 */
public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime) {
    EntityMagmaCube entitymagmacube = (EntityMagmaCube) entitylivingbaseIn;
    float f = entitymagmacube.prevSquishFactor + (entitymagmacube.squishFactor - entitymagmacube.prevSquishFactor) * partialTickTime;
    if (f < 0.0F) {
        f = 0.0F;
    }
    for (int i = 0; i < this.segments.length; ++i) {
        this.segments[i].rotationPointY = (float) (-(4 - i)) * f * 1.7F;
    }
}
Also used : EntityMagmaCube(net.minecraft.entity.monster.EntityMagmaCube)

Example 4 with EntityMagmaCube

use of net.minecraft.entity.monster.EntityMagmaCube in project WizClient-1.8.9-Version by WizClient.

the class DynamicLights method getLightLevel.

public static int getLightLevel(Entity entity) {
    if (entity == Config.getMinecraft().getRenderViewEntity() && !Config.isDynamicHandLight()) {
        return 0;
    } else {
        if (entity instanceof EntityPlayer) {
            EntityPlayer entityplayer = (EntityPlayer) entity;
            if (entityplayer.isSpectator()) {
                return 0;
            }
        }
        if (entity.isBurning()) {
            return 15;
        } else {
            if (!mapEntityLightLevels.isEmpty()) {
                Integer integer = (Integer) mapEntityLightLevels.get(entity.getClass());
                if (integer != null) {
                    return integer.intValue();
                }
            }
            if (entity instanceof EntityFireball) {
                return 15;
            } else if (entity instanceof EntityTNTPrimed) {
                return 15;
            } else if (entity instanceof EntityBlaze) {
                EntityBlaze entityblaze = (EntityBlaze) entity;
                return entityblaze.func_70845_n() ? 15 : 10;
            } else if (entity instanceof EntityMagmaCube) {
                EntityMagmaCube entitymagmacube = (EntityMagmaCube) entity;
                return (double) entitymagmacube.squishFactor > 0.6D ? 13 : 8;
            } else {
                if (entity instanceof EntityCreeper) {
                    EntityCreeper entitycreeper = (EntityCreeper) entity;
                    if ((double) entitycreeper.getCreeperFlashIntensity(0.0F) > 0.001D) {
                        return 15;
                    }
                }
                if (entity instanceof EntityLivingBase) {
                    EntityLivingBase entitylivingbase = (EntityLivingBase) entity;
                    ItemStack itemstack2 = entitylivingbase.getHeldItem();
                    int i = getLightLevel(itemstack2);
                    ItemStack itemstack1 = entitylivingbase.getEquipmentInSlot(4);
                    int j = getLightLevel(itemstack1);
                    return Math.max(i, j);
                } else if (entity instanceof EntityItem) {
                    EntityItem entityitem = (EntityItem) entity;
                    ItemStack itemstack = getItemStack(entityitem);
                    return getLightLevel(itemstack);
                } else {
                    return 0;
                }
            }
        }
    }
}
Also used : EntityCreeper(net.minecraft.entity.monster.EntityCreeper) EntityTNTPrimed(net.minecraft.entity.item.EntityTNTPrimed) EntityLivingBase(net.minecraft.entity.EntityLivingBase) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ItemStack(net.minecraft.item.ItemStack) EntityBlaze(net.minecraft.entity.monster.EntityBlaze) EntityMagmaCube(net.minecraft.entity.monster.EntityMagmaCube) EntityFireball(net.minecraft.entity.projectile.EntityFireball) EntityItem(net.minecraft.entity.item.EntityItem)

Example 5 with EntityMagmaCube

use of net.minecraft.entity.monster.EntityMagmaCube in project Bewitchment by Um-Mitternacht.

the class RitualLesserHellMouth method onFinished.

@Override
public void onFinished(World world, BlockPos altarPos, BlockPos effectivePos, EntityPlayer caster, ItemStackHandler inventory) {
    super.onFinished(world, altarPos, effectivePos, caster, inventory);
    if (!world.isRemote) {
        for (int i = 0; i < world.rand.nextInt(4) + 2; i++) {
            EntityLiving entity;
            entity = world.rand.nextBoolean() ? new EntityPigZombie(world) : new EntityMagmaCube(world);
            entity.onInitialSpawn(world.getDifficultyForLocation(effectivePos), null);
            boolean valid = false;
            for (int j = 0; j < 16; j++) {
                if (entity.attemptTeleport(effectivePos.getX() + world.rand.nextInt(12) - 6, effectivePos.getY(), effectivePos.getZ() + world.rand.nextInt(12) - 6)) {
                    entity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, world.rand.nextInt(360), 0);
                    valid = true;
                    break;
                }
            }
            if (valid) {
                for (EntityPlayerMP player : world.getEntitiesWithinAABB(EntityPlayerMP.class, entity.getEntityBoundingBox().grow(50))) CriteriaTriggers.SUMMONED_ENTITY.trigger(player, entity);
                world.spawnEntity(entity);
            }
        }
    }
}
Also used : EntityLiving(net.minecraft.entity.EntityLiving) EntityPigZombie(net.minecraft.entity.monster.EntityPigZombie) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) EntityMagmaCube(net.minecraft.entity.monster.EntityMagmaCube)

Aggregations

EntityMagmaCube (net.minecraft.entity.monster.EntityMagmaCube)12 EntityBlaze (net.minecraft.entity.monster.EntityBlaze)4 EntityArmorStand (net.minecraft.entity.item.EntityArmorStand)3 EntityEnderman (net.minecraft.entity.monster.EntityEnderman)3 EntitySlime (net.minecraft.entity.monster.EntitySlime)3 ArrayList (java.util.ArrayList)2 Iterator (java.util.Iterator)2 List (java.util.List)2 Minecraft (net.minecraft.client.Minecraft)2 Entity (net.minecraft.entity.Entity)2 EntityTNTPrimed (net.minecraft.entity.item.EntityTNTPrimed)2 EntityCreeper (net.minecraft.entity.monster.EntityCreeper)2 EntityPigZombie (net.minecraft.entity.monster.EntityPigZombie)2 EntityFireball (net.minecraft.entity.projectile.EntityFireball)2 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)2 SkyblockAddons (codes.biscuit.skyblockaddons.SkyblockAddons)1 GuiChestHook (codes.biscuit.skyblockaddons.asm.hooks.GuiChestHook)1 Attribute (codes.biscuit.skyblockaddons.core.Attribute)1 Feature (codes.biscuit.skyblockaddons.core.Feature)1 Location (codes.biscuit.skyblockaddons.core.Location)1