Search in sources :

Example 1 with MarauderEntity

use of me.sandbox.entity.MarauderEntity 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)

Example 2 with MarauderEntity

use of me.sandbox.entity.MarauderEntity in project Illager-Expansion by OhDricky.

the class HatchetAttackGoal method tick.

@Override
public void tick() {
    boolean bl3;
    boolean bl2;
    LivingEntity target = hostile.getTarget();
    if (target == null) {
        chargeTime = 0;
        if (hostile instanceof MarauderEntity) {
            ((MarauderEntity) hostile).setCharging(false);
        }
        return;
    }
    boolean canSeeTarget = hostile.getVisibilityCache().canSee(target);
    boolean bl = ((MobEntity) this.hostile).getVisibilityCache().canSee(target);
    this.hostile.getLookControl().lookAt(target, 30.0f, 30.0f);
    boolean bl4 = bl2 = this.seeingTargetTicker > 0;
    if (bl != bl2) {
        this.seeingTargetTicker = 0;
    }
    this.seeingTargetTicker = bl ? ++this.seeingTargetTicker : --this.seeingTargetTicker;
    double d = ((Entity) this.hostile).squaredDistanceTo(target);
    boolean bl5 = bl3 = (d > (double) this.squaredRange || this.seeingTargetTicker < 5);
    if (bl3) {
        --this.cooldown;
        if (this.cooldown <= 0) {
            this.hostile.getNavigation().startMovingTo(target, speed);
            this.cooldown = COOLDOWN_RANGE.get(this.hostile.getRandom());
        }
    } else {
        this.cooldown = 0;
        ((MobEntity) this.hostile).getNavigation().stop();
    }
    --chargeTime;
    if (hostile instanceof MarauderEntity) {
        if (chargeTime == -40) {
            ((MarauderEntity) hostile).setCharging(true);
        }
        if (chargeTime == -80) {
            ((MarauderEntity) hostile).attack(target, 1.0f);
            ((MarauderEntity) hostile).setCharging(false);
            chargeTime = 0;
        }
    }
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) Entity(net.minecraft.entity.Entity) HostileEntity(net.minecraft.entity.mob.HostileEntity) LivingEntity(net.minecraft.entity.LivingEntity) MarauderEntity(me.sandbox.entity.MarauderEntity) MobEntity(net.minecraft.entity.mob.MobEntity) MarauderEntity(me.sandbox.entity.MarauderEntity)

Aggregations

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