First pass trying to optimise LivingUpdateEvent handlers, see issue #484
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -196,7 +196,9 @@ public class MindControl extends SpellRay {
|
||||
// more efficient (because it only fires when the entity tries to set a target)
|
||||
// Of course, in survival this code is unlikely to be used much because the entity will always try to target the
|
||||
// player and hence will rarely have no target.
|
||||
if(event.getEntityLiving().isPotionActive(WizardryPotions.mind_control) && event.getEntityLiving() instanceof EntityLiving){
|
||||
// No need to do it every tick either!
|
||||
if(event.getEntity().ticksExisted % 50 == 0 && event.getEntityLiving().isPotionActive(WizardryPotions.mind_control)
|
||||
&& event.getEntityLiving() instanceof EntityLiving){
|
||||
|
||||
EntityLiving entity = (EntityLiving)event.getEntityLiving();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user