use of net.minecraft.entity.passive.EntityPig 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.passive.EntityPig in project ArsMagica2 by Mithion.
the class AMEventHandler method onLivingDrops.
@SubscribeEvent
public void onLivingDrops(LivingDropsEvent event) {
if (EntityUtilities.isSummon(event.entityLiving) && !(event.entityLiving instanceof EntityHorse)) {
event.setCanceled(true);
}
if (event.source == DamageSources.darkNexus) {
event.setCanceled(true);
}
if (!event.entityLiving.worldObj.isRemote && event.entityLiving instanceof EntityPig && event.entityLiving.getRNG().nextDouble() < 0.3f) {
EntityItem animalFat = new EntityItem(event.entityLiving.worldObj);
ItemStack stack = new ItemStack(ItemsCommonProxy.itemOre, 1, ItemsCommonProxy.itemOre.META_ANIMALFAT);
animalFat.setPosition(event.entity.posX, event.entity.posY, event.entity.posZ);
animalFat.setEntityItemStack(stack);
event.drops.add(animalFat);
}
}
use of net.minecraft.entity.passive.EntityPig in project ICBM-Classic by BuiltBrokenModding.
the class BlastMutation method doExplode.
@Override
public void doExplode() {
if (!this.world().isRemote) {
AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox(position.x() - this.getRadius(), position.y() - this.getRadius(), position.z() - this.getRadius(), position.x() + this.getRadius(), position.y() + this.getRadius(), position.z() + this.getRadius());
List<EntityLiving> entitiesNearby = world().getEntitiesWithinAABB(EntityLiving.class, bounds);
for (EntityLiving entity : entitiesNearby) {
if (entity instanceof EntityPig) {
EntityPigZombie newEntity = new EntityPigZombie(world());
newEntity.preventEntitySpawning = true;
newEntity.setPosition(entity.posX, entity.posY, entity.posZ);
entity.setDead();
} else if (entity instanceof EntityVillager) {
EntityZombie newEntity = new EntityZombie(world());
newEntity.preventEntitySpawning = true;
newEntity.setPosition(entity.posX, entity.posY, entity.posZ);
entity.setDead();
}
}
}
}
use of net.minecraft.entity.passive.EntityPig in project ICBM-Classic by BuiltBrokenModding.
the class PoisonContagion method performEffect.
@Override
public void performEffect(EntityLivingBase entityLiving, int amplifier) {
if (!(entityLiving instanceof EntityZombie) && !(entityLiving instanceof EntityPigZombie)) {
entityLiving.attackEntityFrom(DamageSource.magic, 1);
}
if (entityLiving.worldObj.rand.nextFloat() > 0.8) {
ExplosivePreDetonationEvent evt = new ExplosivePreDetonationEvent(entityLiving.worldObj, entityLiving.posX, entityLiving.posY, entityLiving.posZ, ExplosiveType.ALL, Explosives.CHEMICAL.handler);
MinecraftForge.EVENT_BUS.post(evt);
// Poison things around it
if (!evt.isCanceled()) {
int r = 13;
AxisAlignedBB entitySurroundings = AxisAlignedBB.getBoundingBox(entityLiving.posX - r, entityLiving.posY - r, entityLiving.posZ - r, entityLiving.posX + r, entityLiving.posY + r, entityLiving.posZ + r);
List<EntityLivingBase> entities = entityLiving.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, entitySurroundings);
for (EntityLivingBase entity : entities) {
if (entity != null && entity != entityLiving) {
if (entity instanceof EntityPig) {
EntityPigZombie newEntity = new EntityPigZombie(entity.worldObj);
newEntity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch);
if (!entity.worldObj.isRemote) {
entity.worldObj.spawnEntityInWorld(newEntity);
}
entity.setDead();
} else if (entity instanceof EntityVillager) {
EntityZombie newEntity = new EntityZombie(entity.worldObj);
newEntity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch);
newEntity.setVillager(true);
if (!entity.worldObj.isRemote) {
entity.worldObj.spawnEntityInWorld(newEntity);
}
entity.setDead();
}
ICBMClassic.contagios_potion.poisonEntity(new Pos(entity), entity);
}
}
}
}
}
use of net.minecraft.entity.passive.EntityPig in project Traverse by ProfessorProspector.
the class BiomeMiniJungle method decorate.
public void decorate(World worldIn, Random rand, BlockPos pos) {
super.decorate(worldIn, rand, pos);
int i = rand.nextInt(16) + 8;
int j = rand.nextInt(16) + 8;
// could == 0, which crashes nextInt
int height = worldIn.getHeight(pos.add(i, 0, j)).getY() * 2;
if (height < 1)
height = 1;
int k = rand.nextInt(height);
if (net.minecraftforge.event.terraingen.TerrainGen.decorate(worldIn, rand, pos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.PUMPKIN))
(new WorldGenMelon()).generate(worldIn, rand, pos.add(i, k, j));
WorldGenVines worldgenvines = new WorldGenVines();
if (net.minecraftforge.event.terraingen.TerrainGen.decorate(worldIn, rand, pos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.GRASS))
for (j = 0; j < 50; ++j) {
k = rand.nextInt(16) + 8;
int l = 128;
int i1 = rand.nextInt(16) + 8;
worldgenvines.generate(worldIn, rand, pos.add(k, 128, i1));
EntityPig pig = new EntityPig(worldIn);
}
}
Aggregations