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