Search in sources :

Example 1 with BabyEntitySpawnEvent

use of net.minecraftforge.event.entity.living.BabyEntitySpawnEvent in project NetherEx by LogicTechCorp.

the class EntityAIPigtificateMate method giveBirth.

private void giveBirth() {
    EntityAgeable baby = pigtificate.createChild(mate);
    mate.setGrowingAge(6000);
    pigtificate.setGrowingAge(6000);
    mate.setWillingToMate(false);
    pigtificate.setWillingToMate(false);
    final BabyEntitySpawnEvent event = new BabyEntitySpawnEvent(pigtificate, mate, baby);
    if (MinecraftForge.EVENT_BUS.post(event) || event.getChild() == null) {
        return;
    }
    baby = event.getChild();
    baby.setGrowingAge(-24000);
    baby.setLocationAndAngles(pigtificate.posX, pigtificate.posY, pigtificate.posZ, 0.0F, 0.0F);
    world.spawnEntity(baby);
    world.setEntityState(baby, (byte) 12);
}
Also used : BabyEntitySpawnEvent(net.minecraftforge.event.entity.living.BabyEntitySpawnEvent) EntityAgeable(net.minecraft.entity.EntityAgeable)

Aggregations

EntityAgeable (net.minecraft.entity.EntityAgeable)1 BabyEntitySpawnEvent (net.minecraftforge.event.entity.living.BabyEntitySpawnEvent)1