Search in sources :

Example 56 with AxisAlignedBB

use of net.minecraft.server.v1_14_R1.AxisAlignedBB in project Citizens2 by CitizensDev.

the class PlayerNavigation method k.

@Override
public void k() {
    this.f += 1;
    if (m()) {
        return;
    }
    if (b()) {
        l();
    } else if ((this.d != null) && (this.d.e() < this.d.d())) {
        Vec3D localVec3D = c();
        Vec3D localObject = this.d.a(this.b, this.d.e());
        if ((localVec3D.b > localObject.b) && (!this.b.onGround) && (MathHelper.floor(localVec3D.a) == MathHelper.floor(localObject.a)) && (MathHelper.floor(localVec3D.c) == MathHelper.floor(localObject.c))) {
            this.d.c(this.d.e() + 1);
        }
    }
    if (m()) {
        return;
    }
    Vec3D localVec3D = this.d.a(this.b);
    if (localVec3D == null) {
        return;
    }
    Object localObject = new AxisAlignedBB(localVec3D.a, localVec3D.b, localVec3D.c, localVec3D.a, localVec3D.b, localVec3D.c).grow(0.5D, 0.5D, 0.5D);
    List<AxisAlignedBB> localList = this.c.getCubes(this.b, ((AxisAlignedBB) localObject).a(0.0D, -1.0D, 0.0D));
    double d1 = -1.0D;
    localObject = ((AxisAlignedBB) localObject).c(0.0D, 1.0D, 0.0D);
    for (AxisAlignedBB localAxisAlignedBB : localList) {
        d1 = localAxisAlignedBB.b((AxisAlignedBB) localObject, d1);
    }
    this.b.getControllerMove().a(localVec3D.a, localVec3D.b + d1, localVec3D.c, this.e);
}
Also used : AxisAlignedBB(net.minecraft.server.v1_8_R3.AxisAlignedBB) Vec3D(net.minecraft.server.v1_8_R3.Vec3D)

Example 57 with AxisAlignedBB

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

Example 58 with AxisAlignedBB

use of net.minecraft.server.v1_14_R1.AxisAlignedBB in project Citizens2 by CitizensDev.

the class PlayerNavigation method l.

@Override
public void l() {
    this.g += 1;
    if (this.o) {
        j();
    }
    if (n()) {
        return;
    }
    if (b()) {
        m();
    } else if ((this.c != null) && (this.c.e() < this.c.d())) {
        Vec3D localVec3D = c();
        Vec3D localObject = this.c.a(this.a, this.c.e());
        if ((localVec3D.y > localObject.y) && (!this.a.onGround) && (MathHelper.floor(localVec3D.x) == MathHelper.floor(localObject.x)) && (MathHelper.floor(localVec3D.z) == MathHelper.floor(localObject.z))) {
            this.c.c(this.c.e() + 1);
        }
    }
    if (n()) {
        return;
    }
    Vec3D localVec3D = this.c.a(this.a);
    if (localVec3D == null) {
        return;
    }
    Object localObject = new BlockPosition(localVec3D).down();
    AxisAlignedBB localAxisAlignedBB = this.b.getType((BlockPosition) localObject).d(this.b, (BlockPosition) localObject);
    localVec3D = localVec3D.a(0.0D, 1.0D - localAxisAlignedBB.e, 0.0D);
    this.a.getControllerMove().a(localVec3D.x, localVec3D.y, localVec3D.z, this.d);
}
Also used : AxisAlignedBB(net.minecraft.server.v1_11_R1.AxisAlignedBB) BlockPosition(net.minecraft.server.v1_11_R1.BlockPosition) Vec3D(net.minecraft.server.v1_11_R1.Vec3D)

Example 59 with AxisAlignedBB

use of net.minecraft.server.v1_14_R1.AxisAlignedBB in project Citizens2 by CitizensDev.

the class PlayerNavigation method l.

@Override
public void l() {
    this.h += 1;
    if (this.p) {
        j();
    }
    if (n()) {
        return;
    }
    if (b()) {
        m();
    } else if ((this.c != null) && (this.c.e() < this.c.d())) {
        Vec3D localVec3D = c();
        Vec3D localObject = this.c.a(this.a, this.c.e());
        if ((localVec3D.y > localObject.y) && (!this.a.onGround) && (MathHelper.floor(localVec3D.x) == MathHelper.floor(localObject.x)) && (MathHelper.floor(localVec3D.z) == MathHelper.floor(localObject.z))) {
            this.c.c(this.c.e() + 1);
        }
    }
    if (n()) {
        return;
    }
    Vec3D localVec3D = this.c.a(this.a);
    if (localVec3D == null) {
        return;
    }
    Object localObject = new BlockPosition(localVec3D).down();
    AxisAlignedBB localAxisAlignedBB = this.b.getType((BlockPosition) localObject).c(this.b, (BlockPosition) localObject);
    localVec3D = localVec3D.a(0.0D, 1.0D - localAxisAlignedBB.e, 0.0D);
    this.a.getControllerMove().a(localVec3D.x, localVec3D.y, localVec3D.z, this.d);
}
Also used : AxisAlignedBB(net.minecraft.server.v1_10_R1.AxisAlignedBB) BlockPosition(net.minecraft.server.v1_10_R1.BlockPosition) Vec3D(net.minecraft.server.v1_10_R1.Vec3D)

Example 60 with AxisAlignedBB

use of net.minecraft.server.v1_14_R1.AxisAlignedBB 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)

Aggregations

List (java.util.List)25 Entity (org.bukkit.entity.Entity)23 Iterator (java.util.Iterator)21 AxisAlignedBB (net.minecraft.server.v1_12_R1.AxisAlignedBB)15 ArrayList (java.util.ArrayList)14 AxisAlignedBB (net.minecraft.server.v1_10_R1.AxisAlignedBB)13 HitBox (me.deecaad.weaponmechanics.weapon.projectile.HitBox)12 AxisAlignedBB (net.minecraft.server.v1_11_R1.AxisAlignedBB)12 ComplexCollisionBox (cc.funkemunky.api.utils.world.types.ComplexCollisionBox)11 SimpleCollisionBox (cc.funkemunky.api.utils.world.types.SimpleCollisionBox)11 AxisAlignedBB (net.minecraft.server.v1_8_R3.AxisAlignedBB)9 BlockPosition (net.minecraft.server.v1_10_R1.BlockPosition)8 BlockPosition (net.minecraft.server.v1_12_R1.BlockPosition)8 LivingEntity (org.bukkit.entity.LivingEntity)8 AxisAlignedBB (net.minecraft.server.v1_16_R3.AxisAlignedBB)7 AxisAlignedBB (net.minecraft.server.v1_9_R2.AxisAlignedBB)7 BlockPosition (net.minecraft.server.v1_11_R1.BlockPosition)6 BoundingBox (net.citizensnpcs.api.util.BoundingBox)5 Location (org.bukkit.Location)5 AxisAlignedBB (net.minecraft.server.v1_13_R2.AxisAlignedBB)4