Add fixes from 52d12c0, a4695bc and f4d7ba6 to 1.11.2 branch

This commit is contained in:
Electroblob
2018-02-22 14:50:20 +00:00
parent f54b92be16
commit 3632511983
8 changed files with 17 additions and 15 deletions
@@ -200,6 +200,8 @@ public class MindControl extends Spell {
@SubscribeEvent
public static void onLivingSetAttackTargetEvent(LivingSetAttackTargetEvent event){
if(event.getTarget() == null) return; // Prevents infinite loops with mind trick
if(event.getEntityLiving().isPotionActive(WizardryPotions.mind_control)
&& MindControl.canControl(event.getEntityLiving())){
@@ -212,7 +214,7 @@ public class MindControl extends Spell {
entityNBT.getUniqueId(MindControl.NBT_KEY));
// If the target that the event tried to set is already a valid mind control target, nothing happens.
if(event.getTarget() != null && WizardryUtilities.isValidTarget(caster, event.getTarget())) return;
if(WizardryUtilities.isValidTarget(caster, event.getTarget())) return;
if(caster instanceof EntityLivingBase){
@@ -224,8 +226,7 @@ public class MindControl extends Spell {
}
}
// If the caster couldn't be found or no valid target was found, this just acts like mind trick.
// If the target is null already, no need to set it to null, or infinite loops will occur.
if(event.getTarget() != null) ((EntityLiving)event.getEntityLiving()).setAttackTarget(null);
((EntityLiving)event.getEntityLiving()).setAttackTarget(null);
}
}