Mystical Agradditions

Mystical Agradditions

86M Downloads

Crash due to negative durability in supremium tools

Closed this issue ยท 0 comments

commented

Describe the bug
Due to the -1 here and here the game will crash with java.lang.IllegalStateException: Value must be non-negative: -1 when it's trying to read the durability.

To Reproduce

  • Try to read the durability in the code and/or reduce it by 1

Expected behavior

  • obviously no crash

Solution

  • use Integer.MAX_VALUE or any other big number instead of -1 Typically this value shouldn't get modified due to the DataComponents.UNBREAKABLE, but having a -1 there can still cause issues as demonstrated

Screenshots / Scripts / Logs
All the Mods 10 - 2.44 crashed. The logs have been uploaded to gnomebot.dev:
latest.log | debug.log head / tail (~14MB & ~100k lines) | crash-2025-04-20_11.40.12-server.txt | PrismLauncher-0.log | KubeJS: client.log / server.log / startup.log | crash_assistant_app.log

Versions (please complete the following information):

  • Minecraft: 1.21.1
  • NeoForge: 21.1.148
  • Cucumber: 1.21.1-8.0.11
  • Mystical Agriculture: 1.21.1-8.0.14
  • Mystical Agradditions: 1.21.1-8.0.5
  • Singleplayer or Multiplayer: Both