Replace hasKey with hasUniqueId where appropriate, should fix some weirdness with a few spells

This commit is contained in:
Electroblob
2018-02-22 13:32:09 +00:00
parent a567281183
commit f54b92be16
4 changed files with 5 additions and 5 deletions
@@ -121,12 +121,12 @@ public class Intimidate extends Spell {
NBTTagCompound entityNBT = event.getEntityLiving().getEntityData(); NBTTagCompound entityNBT = event.getEntityLiving().getEntityData();
EntityCreature creature = (EntityCreature)event.getEntityLiving(); EntityCreature creature = (EntityCreature)event.getEntityLiving();
if(entityNBT != null && entityNBT.hasKey(NBT_KEY)){ if(entityNBT != null && entityNBT.hasUniqueId(NBT_KEY)){
Entity caster = WizardryUtilities.getEntityByUUID(creature.world, entityNBT.getUniqueId(NBT_KEY)); Entity caster = WizardryUtilities.getEntityByUUID(creature.world, entityNBT.getUniqueId(NBT_KEY));
if(caster instanceof EntityLivingBase){ if(caster instanceof EntityLivingBase){
Intimidate.runAway(creature, (EntityLivingBase)caster); runAway(creature, (EntityLivingBase)caster);
} }
} }
} }
@@ -103,7 +103,7 @@ public class LightningBolt extends Spell {
@SubscribeEvent @SubscribeEvent
public static void onEntityStruckByLightningEvent(EntityStruckByLightningEvent event){ public static void onEntityStruckByLightningEvent(EntityStruckByLightningEvent event){
if(event.getLightning().getEntityData() != null && event.getLightning().getEntityData().hasKey(NBT_KEY)){ if(event.getLightning().getEntityData() != null && event.getLightning().getEntityData().hasUniqueId(NBT_KEY)){
EntityPlayer player = (EntityPlayer)WizardryUtilities.getEntityByUUID(event.getLightning().world, EntityPlayer player = (EntityPlayer)WizardryUtilities.getEntityByUUID(event.getLightning().world,
event.getLightning().getEntityData().getUniqueId("summoningPlayer")); event.getLightning().getEntityData().getUniqueId("summoningPlayer"));
@@ -206,7 +206,7 @@ public class MindControl extends Spell {
NBTTagCompound entityNBT = event.getEntityLiving().getEntityData(); NBTTagCompound entityNBT = event.getEntityLiving().getEntityData();
if(entityNBT != null && entityNBT.hasKey(MindControl.NBT_KEY + "Most")){ if(entityNBT != null && entityNBT.hasUniqueId(MindControl.NBT_KEY)){
Entity caster = WizardryUtilities.getEntityByUUID(event.getEntity().world, Entity caster = WizardryUtilities.getEntityByUUID(event.getEntity().world,
entityNBT.getUniqueId(MindControl.NBT_KEY)); entityNBT.getUniqueId(MindControl.NBT_KEY));
@@ -948,7 +948,7 @@ public final class WizardryUtilities {
NBTTagCompound entityNBT = target.getEntityData(); NBTTagCompound entityNBT = target.getEntityData();
if(entityNBT != null && entityNBT.hasKey(MindControl.NBT_KEY)){ if(entityNBT != null && entityNBT.hasUniqueId(MindControl.NBT_KEY)){
if(attacker == WizardryUtilities.getEntityByUUID(target.world, if(attacker == WizardryUtilities.getEntityByUUID(target.world,
entityNBT.getUniqueId(MindControl.NBT_KEY))){ entityNBT.getUniqueId(MindControl.NBT_KEY))){
return false; return false;