Search in sources :

Example 1 with EntityPose

use of net.minecraft.server.v1_16_R3.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);
}
Also used : EntityPlayer(net.minecraft.server.v1_16_R3.EntityPlayer) AdvancementDataPlayer(net.minecraft.server.v1_16_R3.AdvancementDataPlayer) Player(org.bukkit.entity.Player) CraftPlayer(org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer) EntityPose(net.minecraft.server.v1_16_R3.EntityPose)

Example 2 with EntityPose

use of net.minecraft.server.v1_16_R3.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();
    }
}
Also used : AxisAlignedBB(net.minecraft.server.v1_16_R3.AxisAlignedBB) EntitySize(net.minecraft.server.v1_16_R3.EntitySize) Vec3D(net.minecraft.server.v1_16_R3.Vec3D) EntityPose(net.minecraft.server.v1_16_R3.EntityPose)

Example 3 with EntityPose

use of net.minecraft.server.v1_16_R3.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) {
    }
}
Also used : EntityPose(net.minecraft.server.v1_15_R1.EntityPose)

Example 4 with EntityPose

use of net.minecraft.server.v1_16_R3.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();
    }
}
Also used : AxisAlignedBB(net.minecraft.server.v1_15_R1.AxisAlignedBB) EntitySize(net.minecraft.server.v1_15_R1.EntitySize) Vec3D(net.minecraft.server.v1_15_R1.Vec3D) EntityPose(net.minecraft.server.v1_15_R1.EntityPose)

Example 5 with EntityPose

use of net.minecraft.server.v1_16_R3.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();
    }
}
Also used : AxisAlignedBB(net.minecraft.server.v1_14_R1.AxisAlignedBB) EntitySize(net.minecraft.server.v1_14_R1.EntitySize) Vec3D(net.minecraft.server.v1_14_R1.Vec3D) EntityPose(net.minecraft.server.v1_14_R1.EntityPose)

Aggregations

EntityPose (net.minecraft.server.v1_15_R1.EntityPose)2 EntityPose (net.minecraft.server.v1_16_R3.EntityPose)2 AxisAlignedBB (net.minecraft.server.v1_14_R1.AxisAlignedBB)1 EntityPose (net.minecraft.server.v1_14_R1.EntityPose)1 EntitySize (net.minecraft.server.v1_14_R1.EntitySize)1 Vec3D (net.minecraft.server.v1_14_R1.Vec3D)1 AxisAlignedBB (net.minecraft.server.v1_15_R1.AxisAlignedBB)1 EntitySize (net.minecraft.server.v1_15_R1.EntitySize)1 Vec3D (net.minecraft.server.v1_15_R1.Vec3D)1 AdvancementDataPlayer (net.minecraft.server.v1_16_R3.AdvancementDataPlayer)1 AxisAlignedBB (net.minecraft.server.v1_16_R3.AxisAlignedBB)1 EntityPlayer (net.minecraft.server.v1_16_R3.EntityPlayer)1 EntitySize (net.minecraft.server.v1_16_R3.EntitySize)1 Vec3D (net.minecraft.server.v1_16_R3.Vec3D)1 CraftPlayer (org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer)1 Player (org.bukkit.entity.Player)1