Search in sources :

Example 1 with EntityPig

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;
}
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 2 with EntityPig

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);
    }
}
Also used : EntityHorse(net.minecraft.entity.passive.EntityHorse) EntityPig(net.minecraft.entity.passive.EntityPig) ItemStack(net.minecraft.item.ItemStack) EntityItem(net.minecraft.entity.item.EntityItem) SubscribeEvent(cpw.mods.fml.common.eventhandler.SubscribeEvent)

Example 3 with EntityPig

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();
            }
        }
    }
}
Also used : AxisAlignedBB(net.minecraft.util.AxisAlignedBB) EntityLiving(net.minecraft.entity.EntityLiving) EntityZombie(net.minecraft.entity.monster.EntityZombie) EntityPig(net.minecraft.entity.passive.EntityPig) EntityPigZombie(net.minecraft.entity.monster.EntityPigZombie) EntityVillager(net.minecraft.entity.passive.EntityVillager)

Example 4 with EntityPig

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);
                }
            }
        }
    }
}
Also used : AxisAlignedBB(net.minecraft.util.AxisAlignedBB) ExplosivePreDetonationEvent(resonant.api.explosion.ExplosionEvent.ExplosivePreDetonationEvent) EntityZombie(net.minecraft.entity.monster.EntityZombie) Pos(com.builtbroken.mc.imp.transform.vector.Pos) EntityPig(net.minecraft.entity.passive.EntityPig) EntityPigZombie(net.minecraft.entity.monster.EntityPigZombie) EntityVillager(net.minecraft.entity.passive.EntityVillager) EntityLivingBase(net.minecraft.entity.EntityLivingBase)

Example 5 with EntityPig

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);
        }
}
Also used : EntityPig(net.minecraft.entity.passive.EntityPig)

Aggregations

EntityPig (net.minecraft.entity.passive.EntityPig)6 EntityPigZombie (net.minecraft.entity.monster.EntityPigZombie)3 EntityZombie (net.minecraft.entity.monster.EntityZombie)3 EntityVillager (net.minecraft.entity.passive.EntityVillager)2 AxisAlignedBB (net.minecraft.util.AxisAlignedBB)2 Vector (ValkyrienWarfareBase.API.Vector)1 PhysicsWrapperEntity (ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity)1 EntityMountingWeaponBase (ValkyrienWarfareCombat.Entity.EntityMountingWeaponBase)1 Pos (com.builtbroken.mc.imp.transform.vector.Pos)1 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)1 Entity (net.minecraft.entity.Entity)1 EntityAgeable (net.minecraft.entity.EntityAgeable)1 EntityLiving (net.minecraft.entity.EntityLiving)1 EntityLivingBase (net.minecraft.entity.EntityLivingBase)1 EntityArmorStand (net.minecraft.entity.item.EntityArmorStand)1 EntityBoat (net.minecraft.entity.item.EntityBoat)1 EntityFallingBlock (net.minecraft.entity.item.EntityFallingBlock)1 EntityItem (net.minecraft.entity.item.EntityItem)1 EntityHorse (net.minecraft.entity.passive.EntityHorse)1 ItemStack (net.minecraft.item.ItemStack)1