This commit is contained in:
samczsun 2017-03-09 19:31:03 -05:00 committed by cnr
parent 66e3a7ad5c
commit 99534e19c5
2 changed files with 13 additions and 30 deletions

View File

@ -312,38 +312,19 @@ public class UtilEnt
public static void removeGoalSelectors(Entity entity)
{
try
if (((CraftEntity)entity).getHandle() instanceof EntityInsentient)
{
if (_goalSelector == null)
{
_goalSelector = EntityInsentient.class.getDeclaredField("goalSelector");
_goalSelector.setAccessible(true);
}
if (((CraftEntity)entity).getHandle() instanceof EntityInsentient)
{
EntityInsentient creature = (EntityInsentient)((CraftEntity)entity).getHandle();
PathfinderGoalSelector goalSelector = new PathfinderGoalSelector(((CraftWorld)entity.getWorld()).getHandle().methodProfiler);
_goalSelector.set(creature, goalSelector);
}
}
catch (IllegalArgumentException e)
EntityInsentient creature = (EntityInsentient)((CraftEntity)entity).getHandle();
creature.goalSelector = new PathfinderGoalSelector(((CraftWorld)entity.getWorld()).getHandle().methodProfiler);
}
}
public static void removeTargetSelectors(Entity entity)
{
if (((CraftEntity)entity).getHandle() instanceof EntityInsentient)
{
e.printStackTrace();
}
catch (IllegalAccessException e)
{
e.printStackTrace();
}
catch (NoSuchFieldException e)
{
e.printStackTrace();
}
catch (SecurityException e)
{
e.printStackTrace();
EntityInsentient creature = (EntityInsentient)((CraftEntity)entity).getHandle();
creature.targetSelector = new PathfinderGoalSelector(((CraftWorld)entity.getWorld()).getHandle().methodProfiler);
}
}

View File

@ -50,6 +50,8 @@ public class MountSlime extends Mount<SingleEntityMountData<Slime>>
mount.getEntity().setCustomName(player.getName() + "'s " + getName());
UtilEnt.removeTargetSelectors(mount.getEntity());
//Inform
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(getName()) + "."));