Search in sources :

Example 1 with EntitySlime

use of net.minecraft.server.v1_11_R1.EntitySlime in project Citizens2 by CitizensDev.

the class PlayerControllerMove method c.

@Override
public void c() {
    this.a.bf = 0F;
    if (this.f) {
        this.f = false;
        int i = MathHelper.floor(this.a.getBoundingBox().b + 0.5D);
        double d0 = this.b - this.a.locX;
        double d1 = this.d - this.a.locZ;
        double d2 = this.c - i;
        double d3 = d0 * d0 + d2 * d2 + d1 * d1;
        if (d3 < 2.500000277905201E-007D) {
            this.a.bf = (0.0F);
            return;
        }
        float f = (float) Math.toDegrees(Math.atan2(d1, d0)) - 90.0F;
        this.a.yaw = a(this.a.yaw, f, 90.0F);
        NMS.setHeadYaw(a.getBukkitEntity(), this.a.yaw);
        AttributeInstance speed = this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
        if (!(this.a instanceof EntitySlime)) {
            speed.setValue(0.1D * this.e);
        }
        float movement = (float) (this.e * speed.getValue()) * 10;
        this.a.l(movement);
        this.a.bf = movement;
        if (shouldSlimeJump() || ((d2 > 0.0D) && (d0 * d0 + d1 * d1 < 1.0D))) {
            this.h = cg();
            this.h /= 3;
            if (this.a instanceof EntityHumanNPC) {
                ((EntityHumanNPC) this.a).getControllerJump().a();
            } else {
                ((EntityInsentient) this.a).getControllerJump().a();
            }
        }
    }
}
Also used : AttributeInstance(net.minecraft.server.v1_11_R1.AttributeInstance) EntitySlime(net.minecraft.server.v1_11_R1.EntitySlime) EntityHumanNPC(net.citizensnpcs.nms.v1_11_R1.entity.EntityHumanNPC)

Example 2 with EntitySlime

use of net.minecraft.server.v1_11_R1.EntitySlime in project Citizens2 by CitizensDev.

the class PlayerControllerMove method a.

@Override
public void a() {
    this.a.bg = 0F;
    if (this.f) {
        this.f = false;
        int i = MathHelper.floor(this.a.getBoundingBox().b + 0.5D);
        double d0 = this.b - this.a.locX;
        double d1 = this.d - this.a.locZ;
        double d2 = this.c - i;
        double d3 = d0 * d0 + d2 * d2 + d1 * d1;
        if (d3 < 2.500000277905201E-007D) {
            this.a.bf = (0.0F);
            return;
        }
        float f = (float) Math.toDegrees(Math.atan2(d1, d0)) - 90.0F;
        this.a.yaw = a(this.a.yaw, f, 90.0F);
        NMS.setHeadYaw(a.getBukkitEntity(), this.a.yaw);
        AttributeInstance speed = this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
        if (!(this.a instanceof EntitySlime)) {
            speed.setValue(0.1D * this.e);
        }
        float movement = (float) (this.e * speed.getValue()) * 10;
        this.a.k(movement);
        this.a.bg = movement;
        if (shouldSlimeJump() || ((d2 > 0.0D) && (d0 * d0 + d1 * d1 < 1.0D))) {
            this.h = cg();
            this.h /= 3;
            if (this.a instanceof EntityHumanNPC) {
                ((EntityHumanNPC) this.a).getControllerJump().a();
            } else {
                ((EntityInsentient) this.a).getControllerJump().a();
            }
        }
    }
}
Also used : AttributeInstance(net.minecraft.server.v1_12_R1.AttributeInstance) EntitySlime(net.minecraft.server.v1_12_R1.EntitySlime) EntityHumanNPC(net.citizensnpcs.nms.v1_12_R1.entity.EntityHumanNPC)

Aggregations

EntityHumanNPC (net.citizensnpcs.nms.v1_11_R1.entity.EntityHumanNPC)1 EntityHumanNPC (net.citizensnpcs.nms.v1_12_R1.entity.EntityHumanNPC)1 AttributeInstance (net.minecraft.server.v1_11_R1.AttributeInstance)1 EntitySlime (net.minecraft.server.v1_11_R1.EntitySlime)1 AttributeInstance (net.minecraft.server.v1_12_R1.AttributeInstance)1 EntitySlime (net.minecraft.server.v1_12_R1.EntitySlime)1