use of net.minecraft.server.v1_13_R2.EntityInsentient in project UltraCosmetics by iSach.
the class EntityUtil method clearPathfinders.
@Override
public void clearPathfinders(Entity entity) {
EntityInsentient entitySheep = (EntityInsentient) ((CraftEntity) entity).getHandle();
try {
Field bField = PathfinderGoalSelector.class.getDeclaredField("b");
bField.setAccessible(true);
Field cField = PathfinderGoalSelector.class.getDeclaredField("c");
cField.setAccessible(true);
bField.set(entitySheep.goalSelector, new UnsafeList<PathfinderGoalSelector>());
bField.set(entitySheep.targetSelector, new UnsafeList<PathfinderGoalSelector>());
cField.set(entitySheep.goalSelector, new UnsafeList<PathfinderGoalSelector>());
cField.set(entitySheep.targetSelector, new UnsafeList<PathfinderGoalSelector>());
} catch (Exception exc) {
exc.printStackTrace();
}
}
use of net.minecraft.server.v1_13_R2.EntityInsentient in project UltraCosmetics by iSach.
the class EntityUtil method makePanic.
@Override
public void makePanic(Entity entity) {
EntityInsentient insentient = (EntityInsentient) ((CraftEntity) entity).getHandle();
insentient.goalSelector.a(3, new CustomPathFinderGoalPanic((EntityCreature) insentient, 0.4d));
}
use of net.minecraft.server.v1_13_R2.EntityInsentient in project Citizens2 by CitizensDev.
the class NMSImpl method updateAI.
public static void updateAI(EntityLiving entity) {
if (entity instanceof EntityInsentient) {
EntityInsentient handle = (EntityInsentient) entity;
handle.getEntitySenses().a();
NMSImpl.updateNavigation(handle.getNavigation());
handle.getControllerMove().c();
handle.getControllerLook().a();
handle.getControllerJump().b();
} else if (entity instanceof EntityHumanNPC) {
((EntityHumanNPC) entity).updateAI();
}
}
use of net.minecraft.server.v1_13_R2.EntityInsentient in project Citizens2 by CitizensDev.
the class NMSImpl method getDestination.
@Override
public Location getDestination(org.bukkit.entity.Entity entity) {
Entity handle = getHandle(entity);
ControllerMove controller = handle instanceof EntityInsentient ? ((EntityInsentient) handle).getControllerMove() : handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getControllerMove() : null;
return new Location(entity.getWorld(), controller.d(), controller.e(), controller.f());
}
use of net.minecraft.server.v1_13_R2.EntityInsentient in project Citizens2 by CitizensDev.
the class NMSImpl method updateNavigationWorld.
@Override
public void updateNavigationWorld(org.bukkit.entity.Entity entity, World world) {
if (NAVIGATION_WORLD_FIELD == null)
return;
Entity en = NMSImpl.getHandle(entity);
if (en == null || !(en instanceof EntityInsentient))
return;
EntityInsentient handle = (EntityInsentient) en;
WorldServer worldHandle = ((CraftWorld) world).getHandle();
try {
NAVIGATION_WORLD_FIELD.set(handle.getNavigation(), worldHandle);
} catch (Exception e) {
Messaging.logTr(Messages.ERROR_UPDATING_NAVIGATION_WORLD, e.getMessage());
}
}
Aggregations