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);
}
}
}
}
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;
}
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;
}
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--;
}
}
}
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);
}
Aggregations