use of net.minecraft.server.v1_11_R1.Entity in project Citizens2 by CitizensDev.
the class NMSImpl method tick.
@Override
public boolean tick(org.bukkit.entity.Entity next) {
Entity entity = NMSImpl.getHandle(next);
if (!entity.dead) {
try {
entity.world.g(entity);
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Ticking player");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Player being ticked");
entity.appendEntityCrashDetails(crashreportsystemdetails);
throw new ReportedException(crashreport);
}
}
boolean removeFromPlayerList = ((NPCHolder) entity).getNPC().data().get("removefromplayerlist", Setting.REMOVE_PLAYERS_FROM_PLAYER_LIST.asBoolean());
if (entity.dead) {
entity.world.removeEntity(entity);
return true;
} else if (!removeFromPlayerList) {
if (!entity.world.players.contains(entity)) {
entity.world.players.add((EntityHuman) entity);
}
return true;
} else {
entity.world.players.remove(entity);
}
return false;
}
use of net.minecraft.server.v1_11_R1.Entity 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_11_R1.Entity in project Citizens2 by CitizensDev.
the class NMSImpl method setHeadYaw.
@Override
public void setHeadYaw(org.bukkit.entity.Entity entity, float yaw) {
if (!(entity instanceof LivingEntity))
return;
EntityLiving handle = (EntityLiving) getHandle(entity);
yaw = Util.clampYaw(yaw);
handle.aO = yaw;
if (!(handle instanceof EntityHuman)) {
handle.aN = yaw;
}
handle.aP = yaw;
}
use of net.minecraft.server.v1_11_R1.Entity in project Citizens2 by CitizensDev.
the class NMSImpl method removeFromWorld.
@Override
public void removeFromWorld(org.bukkit.entity.Entity entity) {
Preconditions.checkNotNull(entity);
Entity nmsEntity = ((CraftEntity) entity).getHandle();
nmsEntity.world.removeEntity(nmsEntity);
}
use of net.minecraft.server.v1_11_R1.Entity in project Citizens2 by CitizensDev.
the class NMSImpl method setSize.
public static void setSize(Entity entity, float f, float f1, boolean justCreated) {
if ((f != entity.width) || (f1 != entity.length)) {
float f2 = entity.width;
entity.width = f;
entity.length = f1;
entity.a(new AxisAlignedBB(entity.getBoundingBox().a, entity.getBoundingBox().b, entity.getBoundingBox().c, entity.getBoundingBox().a + entity.width, entity.getBoundingBox().b + entity.length, entity.getBoundingBox().c + entity.width));
if ((entity.width > f2) && (!justCreated) && (!entity.world.isClientSide))
entity.move(EnumMoveType.SELF, (f2 - entity.width) / 2, 0.0D, (f2 - entity.width) / 2);
}
}
Aggregations