Progressive Bosses

Progressive Bosses

34M Downloads

[1.20.1 Forge] Enable Attack feature for Elder Guardians can freeze the game permanently

TelepathicGrunt opened this issue ยท 1 comments

commented

The issue is most noticeable with Bumblezone on as my Blue Sempiternal Sanctum's Calming Essence event spawns several Guardians and Elder Guardians for players to fight. As player kills the guardians, Progressive Bosses eventually will set getAttackDuration so low that getAttackAnimationScale will be too large and cause an infinite loop in vanilla code
TelepathicGrunt/Bumblezone#303

This is the vanilla code in question. Guardian class. aiStep method.
image
image

This is the mixin at fault (Also fyi, an inject that always cancels is just a silent overwrite that doesn't report conflicts. This is worse than just using an overwrite directly)

callback.setReturnValue(AttackFeature.getAttackDuration((ElderGuardian) (Object) this));

public static int getAttackDuration(ElderGuardian elderGuardian) {
if (!isEnabled(AttackFeature.class) || attackDurationReduction == 0)
return BASE_ATTACK_DURATION;
int elderGuardiansNearby = elderGuardian.level().getEntities(elderGuardian, elderGuardian.getBoundingBox().inflate(48d), entity -> entity instanceof ElderGuardian).size();
if (elderGuardiansNearby == 2)
return BASE_ATTACK_DURATION;
return BASE_ATTACK_DURATION - ((2 - elderGuardiansNearby) * attackDurationReduction);
}

I threw in an inject to see what values was coming out of Progressive Bosses. getAttackDuration was being set to 35. Which caused getAttackAnimationScale to be 2.4. And because 2.4 is greater than 1.8, this means j is actually decreasing in value which means j can never be greater than h anymore. Thus the infinite loop that freezes the game permanently until restart.
image

In vanilla, getAttackAnimationScale is never greater than 1. This will need to be respected by Progressive Bosses to stop the infinite loop from happening again in the future.

commented

Just tested ProgressiveBosses-3.9.5-mc1.20.1.jar with Bumblezone's event and no freeze. Thank you!