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;
}
}
}
}
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;
}
}
}
Aggregations