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());
}
}
use of net.minecraft.server.v1_13_R2.EntityInsentient in project Citizens2 by CitizensDev.
the class NMSImpl method setShouldJump.
@Override
public void setShouldJump(org.bukkit.entity.Entity entity) {
Entity handle = NMSImpl.getHandle(entity);
if (handle == null)
return;
if (handle instanceof EntityInsentient) {
ControllerJump controller = ((EntityInsentient) handle).getControllerJump();
controller.a();
} else if (handle instanceof EntityHumanNPC) {
((EntityHumanNPC) handle).setShouldJump();
}
}
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 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());
}
Aggregations