From d83015f11a1f2a395be28f23d6826ef5fe675325 Mon Sep 17 00:00:00 2001 From: TheBukor Date: Sun, 13 Mar 2016 04:15:06 -0300 Subject: [PATCH] Why did that happen? --- .../SkStuff/effects/EffSetPathGoal.java | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/me/TheBukor/SkStuff/effects/EffSetPathGoal.java b/src/me/TheBukor/SkStuff/effects/EffSetPathGoal.java index ff1518d..3b3649d 100644 --- a/src/me/TheBukor/SkStuff/effects/EffSetPathGoal.java +++ b/src/me/TheBukor/SkStuff/effects/EffSetPathGoal.java @@ -175,7 +175,7 @@ public class EffSetPathGoal extends Effect { for (EntityData entData : types) { if (!LivingEntity.class.isAssignableFrom(entData.getType())) return; - String className = entData.getType().getSimpleName(); + String className = entData.getType().getClass().getSimpleName(); if (className.equals("HumanEntity")) { className = "Human"; } else if (className.equals("EntityLiving")) { @@ -189,7 +189,7 @@ public class EffSetPathGoal extends Effect { for (EntityData entData : types) { if (!LivingEntity.class.isAssignableFrom(entData.getType())) return; - String className = entData.getType().getSimpleName(); + String className = entData.getType().getClass().getSimpleName(); if (className.equals("HumanEntity")) { className = "Human"; } else if (className.equals("EntityLiving")) { @@ -240,7 +240,7 @@ public class EffSetPathGoal extends Effect { for (EntityData entData : types) { if (!LivingEntity.class.isAssignableFrom(entData.getType())) return; - String className = entData.getType().getSimpleName(); + String className = entData.getType().getClass().getSimpleName(); if (className.equals("HumanEntity")) { className = "Human"; } else if (className.equals("EntityLiving")) { @@ -269,7 +269,7 @@ public class EffSetPathGoal extends Effect { for (EntityData entData : types) { if (!LivingEntity.class.isAssignableFrom(entData.getType())) return; - String className = entData.getType().getSimpleName(); + String className = entData.getType().getClass().getSimpleName(); if (className.equals("HumanEntity")) { className = "Human"; } else if (className.equals("EntityLiving")) { @@ -285,7 +285,7 @@ public class EffSetPathGoal extends Effect { for (EntityData entData : types) { if (!LivingEntity.class.isAssignableFrom(entData.getType())) return; - String className = entData.getType().getSimpleName(); + String className = entData.getType().getClass().getSimpleName(); if (className.equals("HumanEntity")) { className = "Human"; } else if (className.equals("EntityLiving")) { @@ -298,7 +298,18 @@ public class EffSetPathGoal extends Effect { double spd = (meleeSpeed == null ? 1.0D : meleeSpeed.getSingle(e).doubleValue()); boolean memorize = (meleeMemorize == null ? false : meleeMemorize.getSingle(e)); Class goalMeleeAttack = ReflectionUtils.getNMSClass("PathfinderGoalMeleeAttack"); - newGoals.add(goalMeleeAttack.getConstructor(entCreature, double.class, boolean.class).newInstance(nmsEnt, spd, memorize)); + for (EntityData entData : types) { + if (!LivingEntity.class.isAssignableFrom(entData.getType())) + return; + String className = entData.getType().getClass().getSimpleName(); + if (className.equals("HumanEntity")) { + className = "Human"; + } else if (className.equals("EntityLiving")) { + className = "Living"; + } + Class nmsClass = ReflectionUtils.getNMSClass("Entity" + className); + newGoals.add(goalMeleeAttack.getConstructor(entCreature, Class.class, double.class, boolean.class).newInstance(nmsEnt, nmsClass, spd, memorize)); + } } } else if (mark == 13) { double spd = (moveTargetSpeed == null ? 1.0D : moveTargetSpeed.getSingle(e).doubleValue()); @@ -313,7 +324,7 @@ public class EffSetPathGoal extends Effect { for (EntityData entData : types) { if (!LivingEntity.class.isAssignableFrom(entData.getType())) return; - String className = entData.getType().getSimpleName(); + String className = entData.getType().getClass().getSimpleName(); if (className.equals("HumanEntity")) { className = "Human"; } else if (className.equals("EntityLiving")) { @@ -328,7 +339,7 @@ public class EffSetPathGoal extends Effect { for (EntityData entData : types) { if (!LivingEntity.class.isAssignableFrom(entData.getType())) return; - String className = entData.getType().getSimpleName(); + String className = entData.getType().getClass().getSimpleName(); if (className.equals("HumanEntity")) { className = "Human"; } else if (className.equals("EntityLiving")) { @@ -439,7 +450,7 @@ public class EffSetPathGoal extends Effect { for (EntityData entData : types) { if (!LivingEntity.class.isAssignableFrom(entData.getType())) return; - String className = entData.getType().getSimpleName(); + String className = entData.getType().getClass().getSimpleName(); if (className.equals("HumanEntity")) { className = "Human"; } else if (className.equals("EntityLiving")) {