Added goal selector clear for entities in UtilEntity
This commit is contained in:
parent
0b7bf00ca7
commit
9c9e5f1ae0
Binary file not shown.
|
@ -111,6 +111,43 @@ public class UtilEnt
|
|||
}
|
||||
}
|
||||
|
||||
public static void removeGoalSelectors(Entity entity)
|
||||
{
|
||||
try
|
||||
{
|
||||
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)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (IllegalAccessException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (NoSuchFieldException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (SecurityException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void populate()
|
||||
{
|
||||
if (creatureMap.isEmpty())
|
||||
|
|
Loading…
Reference in New Issue