Search in sources :

Example 11 with EntityZombie

use of net.minecraft.entity.monster.EntityZombie in project ICBM-Classic by BuiltBrokenModding.

the class PoisonContagion method performEffect.

@Override
public void performEffect(EntityLivingBase entityLiving, int amplifier) {
    World world = entityLiving.world;
    if (!(entityLiving instanceof EntityZombie) && !(entityLiving instanceof EntityPigZombie)) {
        entityLiving.attackEntityFrom(DamageSource.MAGIC, 1);
    }
    if (entityLiving.world.rand.nextFloat() > 0.8) {
        int r = 13;
        AxisAlignedBB entitySurroundings = new AxisAlignedBB(entityLiving.posX - r, entityLiving.posY - r, entityLiving.posZ - r, entityLiving.posX + r, entityLiving.posY + r, entityLiving.posZ + r);
        List<EntityLivingBase> entities = entityLiving.world.getEntitiesWithinAABB(EntityLivingBase.class, entitySurroundings);
        for (EntityLivingBase entity : entities) {
            if (entity != null && entity != entityLiving) {
                if (entity instanceof EntityPig) {
                    EntityPigZombie newEntity = new EntityPigZombie(entity.world);
                    newEntity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch);
                    if (!entity.world.isRemote) {
                        entity.world.spawnEntity(newEntity);
                    }
                    entity.setDead();
                } else if (entity instanceof EntityVillager) {
                    if ((world.getDifficulty() == EnumDifficulty.NORMAL || world.getDifficulty() == EnumDifficulty.HARD)) {
                        EntityVillager entityvillager = (EntityVillager) entity;
                        EntityZombieVillager entityzombievillager = new EntityZombieVillager(world);
                        entityzombievillager.copyLocationAndAnglesFrom(entityvillager);
                        world.removeEntity(entityvillager);
                        entityzombievillager.onInitialSpawn(world.getDifficultyForLocation(new BlockPos(entityzombievillager)), null);
                        entityzombievillager.setProfession(entityvillager.getProfession());
                        entityzombievillager.setChild(entityvillager.isChild());
                        entityzombievillager.setNoAI(entityvillager.isAIDisabled());
                        if (entityvillager.hasCustomName()) {
                            entityzombievillager.setCustomNameTag(entityvillager.getCustomNameTag());
                            entityzombievillager.setAlwaysRenderNameTag(entityvillager.getAlwaysRenderNameTag());
                        }
                        world.spawnEntity(entityzombievillager);
                        world.playEvent((EntityPlayer) null, 1026, new BlockPos(entity), 0);
                    }
                    entity.setDead();
                }
                ICBMClassic.contagios_potion.poisonEntity(new Pos(entity), entity);
            }
        }
    }
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) EntityPig(net.minecraft.entity.passive.EntityPig) World(net.minecraft.world.World) EntityZombieVillager(net.minecraft.entity.monster.EntityZombieVillager) EntityZombie(net.minecraft.entity.monster.EntityZombie) Pos(icbm.classic.lib.transform.vector.Pos) BlockPos(net.minecraft.util.math.BlockPos) EntityPigZombie(net.minecraft.entity.monster.EntityPigZombie) EntityVillager(net.minecraft.entity.passive.EntityVillager) EntityLivingBase(net.minecraft.entity.EntityLivingBase) EntityPlayer(net.minecraft.entity.player.EntityPlayer) BlockPos(net.minecraft.util.math.BlockPos)

Example 12 with EntityZombie

use of net.minecraft.entity.monster.EntityZombie in project MineFactoryReloaded by powercrystals.

the class ItemSyringeZombie method inject.

@Override
public boolean inject(World world, EntityLiving entity, ItemStack syringe) {
    if (world.rand.nextInt(100) < 5) {
        Entity e;
        if (entity instanceof EntityPig) {
            e = new EntityPigZombie(world);
        } else {
            e = new EntityZombie(world);
        }
        e.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch);
        world.spawnEntityInWorld(e);
        entity.setDead();
    } else {
        ((EntityAgeable) entity).setGrowingAge(0);
    }
    return true;
}
Also used : Entity(net.minecraft.entity.Entity) EntityZombie(net.minecraft.entity.monster.EntityZombie) EntityPig(net.minecraft.entity.passive.EntityPig) EntityPigZombie(net.minecraft.entity.monster.EntityPigZombie) EntityAgeable(net.minecraft.entity.EntityAgeable)

Example 13 with EntityZombie

use of net.minecraft.entity.monster.EntityZombie in project pnc-repressurized by TeamPneumatic.

the class PneumaticCraftUtils method createDummyEntity.

/**
 * A little hack needed here; in 1.8 players were a subclass of EntityLiving and could be used as entities for
 * pathfinding purposes.  But now they extend EntityLivingBase, and pathfinder methods only work for subclasses of
 * EntityLiving.  So create a temporary living entity at the player's location and pathfind from that.
 *
 * @param player the player to mimic
 * @return a dummy player-sized living entity
 */
public static EntityLiving createDummyEntity(EntityPlayer player) {
    EntityZombie zombie = new EntityZombie(player.world);
    zombie.setPosition(player.posX, player.posY, player.posZ);
    return zombie;
}
Also used : EntityZombie(net.minecraft.entity.monster.EntityZombie)

Example 14 with EntityZombie

use of net.minecraft.entity.monster.EntityZombie in project SimplyJetpacks by Tonius.

the class EntityInteractHandler method onEntityInteract.

@SubscribeEvent
public void onEntityInteract(EntityInteractEvent evt) {
    if (evt.entityPlayer.isSneaking() && (evt.target instanceof EntityZombie || evt.target instanceof EntitySkeleton)) {
        EntityLiving target = (EntityLiving) evt.target;
        ItemStack heldStack = evt.entityPlayer.getHeldItem();
        if (heldStack != null && heldStack.getItem() instanceof ItemJetpack) {
            if (!target.worldObj.isRemote) {
                target.dropEquipment(true, 3);
            }
            target.setCurrentItemOrArmor(3, heldStack.copy());
            target.equipmentDropChances[3] = 2.0F;
            target.persistenceRequired = true;
            evt.entityPlayer.getHeldItem().stackSize--;
        }
    }
}
Also used : EntityLiving(net.minecraft.entity.EntityLiving) ItemJetpack(tonius.simplyjetpacks.item.ItemPack.ItemJetpack) EntityZombie(net.minecraft.entity.monster.EntityZombie) EntitySkeleton(net.minecraft.entity.monster.EntitySkeleton) ItemStack(net.minecraft.item.ItemStack) SubscribeEvent(cpw.mods.fml.common.eventhandler.SubscribeEvent)

Example 15 with EntityZombie

use of net.minecraft.entity.monster.EntityZombie in project BetterWithAddons by DaedalusGame.

the class TerratorialHandler method spawnLiving.

@SubscribeEvent
public void spawnLiving(LivingSpawnEvent.CheckSpawn spawnEvent) {
    World world = spawnEvent.getWorld();
    EntityLivingBase entity = spawnEvent.getEntityLiving();
    Chunk chunk = world.getChunkFromBlockCoords(new BlockPos(spawnEvent.getX(), spawnEvent.getY(), spawnEvent.getZ()));
    if (!chunk.isLoaded())
        return;
    if (entity instanceof EntityZombie || entity instanceof EntitySkeleton || entity instanceof EntityCreeper)
        spawnEvent.setResult(Event.Result.DENY);
}
Also used : EntityCreeper(net.minecraft.entity.monster.EntityCreeper) EntityZombie(net.minecraft.entity.monster.EntityZombie) EntitySkeleton(net.minecraft.entity.monster.EntitySkeleton) EntityLivingBase(net.minecraft.entity.EntityLivingBase) BlockPos(net.minecraft.util.math.BlockPos) World(net.minecraft.world.World) Chunk(net.minecraft.world.chunk.Chunk) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

EntityZombie (net.minecraft.entity.monster.EntityZombie)22 EntityLivingBase (net.minecraft.entity.EntityLivingBase)7 EntitySkeleton (net.minecraft.entity.monster.EntitySkeleton)7 BlockPos (net.minecraft.util.math.BlockPos)6 EntityVillager (net.minecraft.entity.passive.EntityVillager)4 EntityPlayer (net.minecraft.entity.player.EntityPlayer)4 ItemStack (net.minecraft.item.ItemStack)4 World (net.minecraft.world.World)4 Zombie (org.spongepowered.api.entity.living.monster.Zombie)4 EntityLiving (net.minecraft.entity.EntityLiving)3 EntityPigZombie (net.minecraft.entity.monster.EntityPigZombie)3 EntityPig (net.minecraft.entity.passive.EntityPig)3 Entity (org.spongepowered.api.entity.Entity)3 Player (org.spongepowered.api.entity.living.player.Player)3 Vector3d (com.flowpowered.math.vector.Vector3d)2 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)2 Entity (net.minecraft.entity.Entity)2 PotionEffect (net.minecraft.potion.PotionEffect)2 PotionEffect (org.spongepowered.api.effect.potion.PotionEffect)2 Living (org.spongepowered.api.entity.living.Living)2