Draconic Evolution

Draconic Evolution

79M Downloads

[1.18] Don't bother even subtracting, just set HP ≤ 0 from laser beam

James103 opened this issue · 1 comments

commented

Base information

  • Minecraft version: 1.18.2
  • Mod version: Since a98e40a

Description / steps to reproduce

Players with more than 7 × 1037 HP are still able to survive hits from the full-power Guardian laser beam.
For example, a player with 3 × 1038 HP can survive 4 full-power Guardian laser beam hits before dying. Assuming the player heals to full every tick and immediately after taking damage, this could potentially allow surviving the full duration of a full-power beam without Totems of Undying, which is not intended.
This is caused by Float.MAX_VALUE being 3.4 × 1038, which means Float.MAX_VALUE / 5F is a bit under 7 × 1037.

The relevant line added in the linked commit is line 105, attackTarget.setHealth(prevHealth - beamPower);.
Fixing this is simple: just change it to attackTarget.setHealth(-beamPower);.
Then all players will die from the guardian laser beam on the first full-power hit, even those with NaN HP.

commented

Yea... Look...
If a player has more than 70,000,000,000,000,000,000,000,000,000,000,000,000 health...
That is just so ridiculously far past stupid that I don't even care if it's broken.

When you're so overpowered that you're running into the limitations of floating point arithmetics...
You probably need to just stop what you're doing, and reconsider your life choices xD