Only update entity age every 2 seconds

Closes #135
This commit is contained in:
Ellpeck 2020-08-13 14:14:45 +02:00
parent 3ca3de90b2
commit 418920ffdf

View file

@ -38,11 +38,11 @@ public class BlockAnimalGenerator extends BlockContainerImpl implements IVisuali
@SubscribeEvent @SubscribeEvent
public void onLivingUpdate(LivingEvent.LivingUpdateEvent event) { public void onLivingUpdate(LivingEvent.LivingUpdateEvent event) {
LivingEntity entity = event.getEntityLiving(); LivingEntity entity = event.getEntityLiving();
if (entity.world.isRemote || !(entity instanceof AnimalEntity) || entity instanceof IMob || entity instanceof INPC) if (entity.world.isRemote || entity.world.getGameTime() % 40 != 0 || !(entity instanceof AnimalEntity) || entity instanceof IMob || entity instanceof INPC)
return; return;
CompoundNBT data = entity.getPersistentData(); CompoundNBT data = entity.getPersistentData();
int timeAlive = data.getInt(NaturesAura.MOD_ID + ":time_alive"); int timeAlive = data.getInt(NaturesAura.MOD_ID + ":time_alive");
data.putInt(NaturesAura.MOD_ID + ":time_alive", timeAlive + 1); data.putInt(NaturesAura.MOD_ID + ":time_alive", timeAlive + 40);
} }
@SubscribeEvent @SubscribeEvent