First pass trying to optimise LivingUpdateEvent handlers, see issue #484

This commit is contained in:
Electroblob77
2020-08-03 22:47:08 +01:00
parent 9d8b0b3a90
commit 7401a8e3b4
6 changed files with 17 additions and 16 deletions
@@ -119,7 +119,8 @@ public class Intimidate extends SpellAreaEffect {
@SubscribeEvent
public static void onLivingUpdateEvent(LivingUpdateEvent event){
if(event.getEntityLiving().isPotionActive(WizardryPotions.fear)
// No need to do this every tick either
if(event.getEntity().ticksExisted % 50 == 0 && event.getEntityLiving().isPotionActive(WizardryPotions.fear)
&& event.getEntityLiving() instanceof EntityCreature){
NBTTagCompound entityNBT = event.getEntityLiving().getEntityData();