Search in sources :

Example 1 with EntityBuffalo

use of pokefenn.totemic.entity.animal.EntityBuffalo in project Totemic by TeamTotemic.

the class CeremonyBuffaloDance method effect.

@Override
public void effect(World world, BlockPos pos, CeremonyEffectContext context) {
    if (world.isRemote)
        return;
    getCows(world, pos, 8).stream().limit(2).forEach(cow -> {
        EntityBuffalo buffalo = new EntityBuffalo(world);
        float health = cow.getHealth() / cow.getMaxHealth() * buffalo.getMaxHealth();
        buffalo.setHealth(health);
        buffalo.setGrowingAge(-24000);
        EntityUtil.spawnEntity(world, cow.posX, cow.posY, cow.posZ, buffalo);
        if (cow.getLeashed())
            buffalo.setLeashHolder(cow.getLeashHolder(), true);
        cow.setDead();
        ((WorldServer) world).spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, cow.posX, cow.posY + 1.0, cow.posZ, 24, 0.6D, 0.5D, 0.6D, 1.0D);
    });
}
Also used : EntityBuffalo(pokefenn.totemic.entity.animal.EntityBuffalo) WorldServer(net.minecraft.world.WorldServer)

Aggregations

WorldServer (net.minecraft.world.WorldServer)1 EntityBuffalo (pokefenn.totemic.entity.animal.EntityBuffalo)1