Skip to content

Fix drowning effect interval math - #147

Merged
boubou19 merged 2 commits into
GTNewHorizons:masterfrom
Angry3vilbot:drowning-effect-math-fix
Aug 21, 2026
Merged

Fix drowning effect interval math#147
boubou19 merged 2 commits into
GTNewHorizons:masterfrom
Angry3vilbot:drowning-effect-math-fix

Conversation

@Angry3vilbot

@Angry3vilbot Angry3vilbot commented Aug 20, 2026

Copy link
Copy Markdown
Member

Summary

This PR fixes two issues with the damage interval calculation for the Drowning potion effect. First of all, it fixes the issue that happens when the value of amplifier is higher than 20: due to integer division, 20 / amplifier is 0, which causes a divide by zero ArithmeticException during the modulo division. Secondly, it fixes a divide by zero error when the potion amplifier is 255, caused by the byte value being interpreted as a signed byte instead of an unsigned one on half of the ticks, leading to 20 / (-1 + 1) division by zero.

Closes GTNewHorizons/GT-New-Horizons-Modpack#26399

Checklist

  • I have tested this PR in DevEnv
  • I have tested this PR in Fullpack
  • This PR is in compliance with the GTNH AI Policy
  • This PR requires another PR in order to merge

@boubou19
boubou19 merged commit 6776676 into GTNewHorizons:master Aug 21, 2026
1 check passed
@Angry3vilbot
Angry3vilbot deleted the drowning-effect-math-fix branch August 21, 2026 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash java.lang.ArithmeticException: / by zero when an entity given a high level of "Drowning" effect (ID 100) has loaded

2 participants