use of net.minecraft.server.v1_15_R1.EntityPose in project Citizens2 by CitizensDev.
the class NMSImpl method setSneaking.
@Override
public void setSneaking(org.bukkit.entity.Entity entity, boolean sneaking) {
if (entity instanceof Player) {
((Player) entity).setSneaking(sneaking);
}
EntityPose pose = sneaking ? EntityPose.CROUCHING : EntityPose.STANDING;
getHandle(entity).setPose(pose);
}
use of net.minecraft.server.v1_15_R1.EntityPose in project Citizens2 by CitizensDev.
the class NMSImpl method setSize.
public static void setSize(Entity entity, boolean justCreated) {
try {
EntitySize entitysize = (EntitySize) SIZE_FIELD_GETTER.invoke(entity);
EntityPose entitypose = entity.getPose();
EntitySize entitysize1 = entity.a(entitypose);
SIZE_FIELD_SETTER.invoke(entity, entitysize1);
HEAD_HEIGHT.invoke(entity, HEAD_HEIGHT_METHOD.invoke(entity, entitypose, entitysize1));
if (entitysize1.width < entitysize.width && false) /* TODO: PREVIOUS CITIZENS ADDITION ?reason */
{
double d0 = entitysize1.width / 2.0D;
entity.a(new AxisAlignedBB(entity.locX() - d0, entity.locY(), entity.locZ() - d0, entity.locX() + d0, entity.locY() + entitysize1.height, entity.locZ() + d0));
} else {
AxisAlignedBB axisalignedbb = entity.getBoundingBox();
entity.a(new AxisAlignedBB(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ, axisalignedbb.minX + entitysize1.width, axisalignedbb.minY + entitysize1.height, axisalignedbb.minZ + entitysize1.width));
if (entitysize1.width > entitysize.width && !justCreated && !entity.world.isClientSide) {
float f = entitysize.width - entitysize1.width;
entity.move(EnumMoveType.SELF, new Vec3D(f, 0.0D, f));
}
}
} catch (Throwable e) {
e.printStackTrace();
}
}
use of net.minecraft.server.v1_15_R1.EntityPose in project Citizens2 by CitizensDev.
the class NMSImpl method setSitting.
@Override
public void setSitting(Ocelot ocelot, boolean sitting) {
if (SET_POSE == null)
return;
try {
EntityPose pose = sitting ? EntityPose.CROUCHING : EntityPose.STANDING;
SET_POSE.invoke(getHandle(ocelot), pose);
} catch (Throwable e) {
}
}
use of net.minecraft.server.v1_15_R1.EntityPose in project Citizens2 by CitizensDev.
the class NMSImpl method setSize.
public static void setSize(Entity entity, boolean justCreated) {
try {
EntitySize entitysize = (EntitySize) SIZE_FIELD_GETTER.invoke(entity);
EntityPose entitypose = entity.getPose();
EntitySize entitysize1 = entity.a(entitypose);
SIZE_FIELD_SETTER.invoke(entity, entitysize1);
HEAD_HEIGHT.invoke(entity, HEAD_HEIGHT_METHOD.invoke(entity, entitypose, entitysize1));
if (entitysize1.width < entitysize.width && false) /* TODO: PREVIOUS CITIZENS ADDITION ?reason */
{
double d0 = entitysize1.width / 2.0D;
entity.a(new AxisAlignedBB(entity.locX() - d0, entity.locY(), entity.locZ() - d0, entity.locX() + d0, entity.locY() + entitysize1.height, entity.locZ() + d0));
} else {
AxisAlignedBB axisalignedbb = entity.getBoundingBox();
entity.a(new AxisAlignedBB(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ, axisalignedbb.minX + entitysize1.width, axisalignedbb.minY + entitysize1.height, axisalignedbb.minZ + entitysize1.width));
if (entitysize1.width > entitysize.width && !justCreated && !entity.world.isClientSide) {
float f = entitysize.width - entitysize1.width;
entity.move(EnumMoveType.SELF, new Vec3D(f, 0.0D, f));
}
}
} catch (Throwable e) {
e.printStackTrace();
}
}
use of net.minecraft.server.v1_15_R1.EntityPose in project Citizens2 by CitizensDev.
the class NMSImpl method setSize.
public static void setSize(Entity entity, boolean justCreated) {
try {
EntitySize entitysize = (EntitySize) SIZE_FIELD_GETTER.invoke(entity);
EntityPose entitypose = entity.getPose();
EntitySize entitysize1 = entity.a(entitypose);
SIZE_FIELD_SETTER.invoke(entity, entitysize1);
HEAD_HEIGHT.invoke(entity, HEAD_HEIGHT_METHOD.invoke(entity, entitypose, entitysize1));
if (entitysize1.width < entitysize.width && false) /* TODO: PREVIOUS CITIZENS ADDITION ?reason */
{
double d0 = entitysize1.width / 2.0D;
entity.a(new AxisAlignedBB(entity.locX - d0, entity.locY, entity.locZ - d0, entity.locX + d0, entity.locY + entitysize1.height, entity.locZ + d0));
} else {
AxisAlignedBB axisalignedbb = entity.getBoundingBox();
entity.a(new AxisAlignedBB(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ, axisalignedbb.minX + entitysize1.width, axisalignedbb.minY + entitysize1.height, axisalignedbb.minZ + entitysize1.width));
if (entitysize1.width > entitysize.width && !justCreated && !entity.world.isClientSide) {
float f = entitysize.width - entitysize1.width;
entity.move(EnumMoveType.SELF, new Vec3D(f, 0.0D, f));
}
}
} catch (Throwable e) {
e.printStackTrace();
}
}
Aggregations