Search in sources :

Example 1 with Arm

use of net.minecraft.util.Arm in project Illager-Expansion by OhDricky.

the class ArmoredIllagerEntityModel method setAngles.

public void setAngles(final T illagerEntity, final float f, final float g, final float h, final float i, final float j) {
    this.head.yaw = i * 0.017453292f;
    this.head.pitch = j * 0.017453292f;
    if (this.riding) {
        this.rightArm.pitch = -0.62831855f;
        this.rightArm.yaw = 0.0f;
        this.rightArm.roll = 0.0f;
        this.leftArm.pitch = -0.62831855f;
        this.leftArm.yaw = 0.0f;
        this.leftArm.roll = 0.0f;
        this.rightLeg.pitch = -1.4137167f;
        this.rightLeg.yaw = 0.31415927f;
        this.rightLeg.roll = 0.07853982f;
        this.leftLeg.pitch = -1.4137167f;
        this.leftLeg.yaw = -0.31415927f;
        this.leftLeg.roll = -0.07853982f;
        this.rightShoulderpad.pitch = -0.62831855f;
        this.leftShoulderpad.pitch = -0.62831855f;
    } else {
        this.rightArm.pitch = MathHelper.cos(f * 0.6662f + 3.1415927f) * 2.0f * g * 0.5f;
        this.rightShoulderpad.pitch = MathHelper.cos(f * 0.6662f + 3.1415927f) * 2.0f * g * 0.5f;
        this.rightShoulderpad.yaw = 0.0f;
        this.rightArm.yaw = 0.0f;
        this.rightArm.roll = 0.0f;
        this.leftArm.pitch = MathHelper.cos(f * 0.6662f) * 2.0f * g * 0.5f;
        this.leftShoulderpad.pitch = MathHelper.cos(f * 0.6662f) * 2.0f * g * 0.5f;
        this.leftShoulderpad.yaw = 0.0f;
        this.leftArm.yaw = 0.0f;
        this.leftArm.roll = 0.0f;
        this.rightLeg.pitch = MathHelper.cos(f * 0.6662f) * 1.4f * g * 0.5f;
        this.rightLeg.yaw = 0.0f;
        this.rightLeg.roll = 0.0f;
        this.leftLeg.pitch = MathHelper.cos(f * 0.6662f + 3.1415927f) * 1.4f * g * 0.5f;
        this.leftLeg.yaw = 0.0f;
        this.leftLeg.roll = 0.0f;
    }
    final IllagerEntity.State state = illagerEntity.getState();
    final Arm mainArm = illagerEntity.getMainArm();
    final boolean hasShield = illagerEntity.getOffHandStack().isOf(Items.SHIELD);
    if (state == IllagerEntity.State.ATTACKING) {
        if (((LivingEntity) illagerEntity).getMainHandStack().isEmpty()) {
            CrossbowPosing.meleeAttack(this.leftArm, this.rightArm, true, this.handSwingProgress, h);
            CrossbowPosing.meleeAttack(this.leftShoulderpad, this.rightShoulderpad, true, this.handSwingProgress, h);
        } else {
            CrossbowPosing.meleeAttack(this.rightArm, this.leftArm, (MobEntity) illagerEntity, this.handSwingProgress, h);
            CrossbowPosing.meleeAttack(this.rightShoulderpad, this.leftShoulderpad, (MobEntity) illagerEntity, this.handSwingProgress, h);
        }
        if (hasShield && mainArm == Arm.RIGHT) {
            this.leftArm.pitch = -1.05f;
            this.leftArm.yaw = 0.5235988f;
            this.leftShoulderpad.pitch = -1.05f;
            this.leftShoulderpad.yaw = 0.5235988f;
        }
        if (hasShield && mainArm == Arm.LEFT) {
            this.rightArm.pitch = 200.0f;
            this.rightArm.yaw = -0.5235988f;
            this.rightShoulderpad.pitch = 200.0f;
            this.rightShoulderpad.yaw = -0.5235988f;
        }
        if (((InquisitorEntity) illagerEntity).getStunnedState()) {
            this.head.pitch = 18.5f;
            this.head.yaw = MathHelper.cos(h * 0.8f) * 0.3f;
            this.rightArm.pitch = 200.0f;
            this.rightArm.yaw = 0.5235988f;
            this.rightShoulderpad.pitch = 200.0f;
            this.rightShoulderpad.yaw = 0.5235988f;
            this.leftArm.pitch = 200.0f;
            this.leftArm.yaw = -0.5235988f;
            this.leftShoulderpad.pitch = 200.0f;
            this.leftShoulderpad.yaw = -0.5235988f;
        }
    } else if (state == IllagerEntity.State.SPELLCASTING) {
        this.rightArm.pivotZ = 0.0f;
        this.rightArm.pivotX = -5.0f;
        this.leftArm.pivotZ = 0.0f;
        this.leftArm.pivotX = 5.0f;
        this.rightArm.pitch = MathHelper.cos(h * 0.6662f) * 0.25f;
        this.leftArm.pitch = MathHelper.cos(h * 0.6662f) * 0.25f;
        this.rightArm.roll = 2.3561945f;
        this.leftArm.roll = -2.3561945f;
        this.rightArm.yaw = 0.0f;
        this.leftArm.yaw = 0.0f;
    } else if (state == IllagerEntity.State.BOW_AND_ARROW) {
        this.rightArm.yaw = -0.1f + this.head.yaw;
        this.rightArm.pitch = -1.5707964f + this.head.pitch;
        this.leftArm.pitch = -0.9424779f + this.head.pitch;
        this.leftArm.yaw = this.head.yaw - 0.4f;
        this.leftArm.roll = 1.5707964f;
    } else if (state == IllagerEntity.State.CROSSBOW_HOLD) {
        CrossbowPosing.hold(this.rightArm, this.leftArm, this.head, true);
    } else if (state == IllagerEntity.State.CROSSBOW_CHARGE) {
        CrossbowPosing.charge(this.rightArm, this.leftArm, (LivingEntity) illagerEntity, true);
    } else if (state == IllagerEntity.State.CELEBRATING) {
        this.rightArm.pivotZ = 0.0f;
        this.rightArm.pivotX = -5.0f;
        this.rightArm.pitch = MathHelper.cos(h * 0.6662f) * 0.05f;
        this.rightArm.roll = 2.670354f;
        this.rightArm.yaw = 0.0f;
        this.rightShoulderpad.pivotZ = 0.0f;
        this.rightShoulderpad.pivotX = -5.0f;
        this.rightShoulderpad.pitch = MathHelper.cos(h * 0.6662f) * 0.05f;
        this.rightShoulderpad.roll = 2.670354f;
        this.rightShoulderpad.yaw = 0.0f;
        this.leftArm.pivotZ = 0.0f;
        this.leftArm.pivotX = 5.0f;
        this.leftArm.pitch = MathHelper.cos(h * 0.6662f) * 0.05f;
        this.leftArm.roll = -2.3561945f;
        this.leftArm.yaw = 0.0f;
        this.leftShoulderpad.pivotZ = 0.0f;
        this.leftShoulderpad.pivotX = 5.0f;
        this.leftShoulderpad.pitch = MathHelper.cos(h * 0.6662f) * 0.05f;
        this.leftShoulderpad.roll = -2.3561945f;
        this.leftShoulderpad.yaw = 0.0f;
    }
    final boolean bl = this.arms.visible = (state == IllagerEntity.State.CROSSED);
    this.leftArm.visible = !bl;
    this.rightArm.visible = !bl;
}
Also used : IllagerEntity(net.minecraft.entity.mob.IllagerEntity) InquisitorEntity(me.sandbox.entity.InquisitorEntity) Arm(net.minecraft.util.Arm)

Example 2 with Arm

use of net.minecraft.util.Arm in project Illager-Expansion by OhDricky.

the class IllagerWithStaffEntityModel method setAngles.

public void setAngles(final T illagerEntity, final float f, final float g, final float h, final float i, final float j) {
    this.body.pitch = 0.2f;
    this.head.yaw = i * 0.017453292f;
    this.head.pitch = j * 0.017453292f;
    if (this.riding) {
        this.rightArm.pitch = -0.62831855f;
        this.rightArm.yaw = 0.0f;
        this.rightArm.roll = 0.0f;
        this.leftArm.pitch = -0.62831855f;
        this.leftArm.yaw = 0.0f;
        this.leftArm.roll = 0.0f;
        this.rightLeg.pitch = -1.4137167f;
        this.rightLeg.yaw = 0.31415927f;
        this.rightLeg.roll = 0.07853982f;
        this.leftLeg.pitch = -1.4137167f;
        this.leftLeg.yaw = -0.31415927f;
        this.leftLeg.roll = -0.07853982f;
    } else {
        this.rightArm.pitch = MathHelper.cos(f * 0.6662f + 3.1415927f) * 2.0f * g * 0.5f;
        this.rightArm.yaw = 0.0f;
        this.rightArm.roll = 0.0f;
        this.leftArm.pitch = MathHelper.cos(f * 0.6662f) * 0.5f * g * 0.5f - 1.2f;
        this.leftArm.yaw = 0.0f;
        this.leftArm.roll = 0.0f;
        this.rightLeg.pitch = MathHelper.cos(f * 0.6662f) * 1.4f * g * 0.5f;
        this.rightLeg.yaw = 0.0f;
        this.rightLeg.roll = 0.0f;
        this.leftLeg.pitch = MathHelper.cos(f * 0.6662f + 3.1415927f) * 1.4f * g * 0.5f;
        this.leftLeg.yaw = 0.0f;
        this.leftLeg.roll = 0.0f;
    }
    final IllagerEntity.State state = illagerEntity.getState();
    final Arm mainArm = illagerEntity.getMainArm();
    final boolean hasShield = illagerEntity.getOffHandStack().isOf(Items.SHIELD);
    if (state == IllagerEntity.State.ATTACKING) {
        if (((LivingEntity) illagerEntity).getMainHandStack().isEmpty()) {
            CrossbowPosing.meleeAttack(this.leftArm, this.rightArm, true, this.handSwingProgress, h);
        } else {
            CrossbowPosing.meleeAttack(this.rightArm, this.leftArm, (MobEntity) illagerEntity, this.handSwingProgress, h);
        }
        if (hasShield && mainArm == Arm.RIGHT) {
            this.leftArm.pitch = -1.05f;
            this.leftArm.yaw = 0.5235988f;
        }
        if (hasShield && mainArm == Arm.LEFT) {
            this.rightArm.pitch = 200.0f;
            this.rightArm.yaw = -0.5235988f;
        }
        if (((InquisitorEntity) illagerEntity).getStunnedState()) {
            this.head.pitch = 18.5f;
            this.head.yaw = MathHelper.cos(h * 0.8f) * 0.3f;
            this.rightArm.pitch = 200.0f;
            this.rightArm.yaw = 0.5235988f;
            this.leftArm.pitch = 200.0f;
            this.leftArm.yaw = -0.5235988f;
        }
    } else if (state == IllagerEntity.State.SPELLCASTING) {
        this.rightArm.pivotZ = 0.0f;
        this.rightArm.pivotX = -5.0f;
        this.leftArm.pivotZ = 0.0f;
        this.leftArm.pivotX = 5.0f;
        this.rightArm.pitch = MathHelper.cos(h * 0.6662f) * 0.25f;
        this.leftArm.pitch = MathHelper.cos(h * 0.6662f) * 0.25f;
        this.rightArm.roll = 2.3561945f;
        this.leftArm.roll = -2.3561945f;
        this.rightArm.yaw = 0.0f;
        this.leftArm.yaw = 0.0f;
    } else if (state == IllagerEntity.State.BOW_AND_ARROW) {
        this.rightArm.yaw = -0.1f + this.head.yaw;
        this.rightArm.pitch = -1.5707964f + this.head.pitch;
        this.leftArm.pitch = -0.9424779f + this.head.pitch;
        this.leftArm.yaw = this.head.yaw - 0.4f;
        this.leftArm.roll = 1.5707964f;
    } else if (state == IllagerEntity.State.CROSSBOW_HOLD) {
        CrossbowPosing.hold(this.rightArm, this.leftArm, this.head, true);
    } else if (state == IllagerEntity.State.CROSSBOW_CHARGE) {
        CrossbowPosing.charge(this.rightArm, this.leftArm, (LivingEntity) illagerEntity, true);
    } else if (state == IllagerEntity.State.CELEBRATING) {
        this.rightArm.pivotZ = 0.0f;
        this.rightArm.pivotX = -5.0f;
        this.rightArm.pitch = MathHelper.cos(h * 0.6662f) * 0.05f;
        this.rightArm.roll = 2.670354f;
        this.rightArm.yaw = 0.0f;
        this.leftArm.pivotZ = 0.0f;
        this.leftArm.pivotX = 5.0f;
        this.leftArm.pitch = MathHelper.cos(h * 0.6662f) * 0.05f;
        this.leftArm.roll = -2.3561945f;
        this.leftArm.yaw = 0.0f;
    }
}
Also used : IllagerEntity(net.minecraft.entity.mob.IllagerEntity) InquisitorEntity(me.sandbox.entity.InquisitorEntity) Arm(net.minecraft.util.Arm)

Example 3 with Arm

use of net.minecraft.util.Arm in project Illager-Expansion by OhDricky.

the class IllagerModelMixin method chargingAnimation.

@Inject(at = @At("TAIL"), cancellable = true, method = "setAngles(Lnet/minecraft/entity/mob/IllagerEntity;FFFFF)V")
public void chargingAnimation(T illagerEntity, float f, float g, float h, float i, float j, CallbackInfo ci) {
    ItemStack item = illagerEntity.getMainHandStack();
    Arm mainArm = illagerEntity.getMainArm();
    if (illagerEntity instanceof BasherEntity) {
        IllagerEntity.State state = illagerEntity.getState();
        if (state == IllagerEntity.State.ATTACKING && item.isOf(Items.SHIELD) && !(((BasherEntity) illagerEntity).isStunned) && mainArm == Arm.RIGHT) {
            this.rightArm.pitch = 200.0f;
            this.rightArm.yaw = -0.5235988f;
        }
        if (state == IllagerEntity.State.ATTACKING && item.isOf(Items.SHIELD) && !(((BasherEntity) illagerEntity).isStunned) && mainArm == Arm.LEFT) {
            this.leftArm.pitch = -1.05f;
            this.leftArm.yaw = 0.5235988f;
        }
        if (((BasherEntity) illagerEntity).getStunnedState()) {
            this.head.pitch = 20.35f;
            this.head.yaw = MathHelper.cos(h * 0.8f) * 0.3f;
            this.rightArm.pitch = -0.25f;
            this.leftArm.pitch = -0.25f;
        }
    }
    if (illagerEntity instanceof MarauderEntity) {
        if (mainArm == Arm.RIGHT) {
            if (((MarauderEntity) illagerEntity).isCharging()) {
                this.rightArm.pitch = 3.7699115f;
            }
            if (!illagerEntity.isAttacking()) {
                this.rightArm.pitch = MathHelper.cos(f * 0.6662f + (float) Math.PI) * 2.0f * g * 0.5f;
            }
        } else {
            if (((MarauderEntity) illagerEntity).isCharging()) {
                this.leftArm.pitch = 3.7699115f;
            }
            if (!illagerEntity.isAttacking()) {
                this.leftArm.pitch = MathHelper.cos(f * 0.6662f) * 2.0f * g * 0.5f;
            }
        }
    }
}
Also used : MarauderEntity(me.sandbox.entity.MarauderEntity) IllagerEntity(net.minecraft.entity.mob.IllagerEntity) BasherEntity(me.sandbox.entity.BasherEntity) ItemStack(net.minecraft.item.ItemStack) Arm(net.minecraft.util.Arm) Inject(org.spongepowered.asm.mixin.injection.Inject)

Aggregations

IllagerEntity (net.minecraft.entity.mob.IllagerEntity)3 Arm (net.minecraft.util.Arm)3 InquisitorEntity (me.sandbox.entity.InquisitorEntity)2 BasherEntity (me.sandbox.entity.BasherEntity)1 MarauderEntity (me.sandbox.entity.MarauderEntity)1 ItemStack (net.minecraft.item.ItemStack)1 Inject (org.spongepowered.asm.mixin.injection.Inject)1