Expected behavior
The applyMending method should not throw any exceptions when passing 0 as a value. At least that how it was in 1.20.4, since I just started running into that issue since updating to 1.21.4, and haven't changed anything to the plugin code.
I mean it would be a simple fix to not call the method when the value is 0, and I should implement that nonetheless, but throwing that exception seems wrong.
Observed/Actual behavior
Caused by: java.lang.ArithmeticException: / by zero
at org.bukkit.craftbukkit.entity.CraftPlayer.applyMending(CraftPlayer.java:1899) ~[paper-1.21.4.jar:1.21.4-31-d0d0efe]
at erenos-3.6.0-SNAPSHOT.jar/net.aerulion.erenos.command.commands.DebugSubCommand.execute(DebugSubCommand.java:37) ~[erenos-3.6.0-SNAPSHOT.jar:?]
at erenos-3.6.0-SNAPSHOT.jar/net.aerulion.erenos.command.ErenosSubCommand.validateAndExecute(ErenosSubCommand.java:63) ~[erenos-3.6.0-SNAPSHOT.jar:?]
at erenos-3.6.0-SNAPSHOT.jar/net.aerulion.erenos.command.CommandService.onCommand(CommandService.java:249) ~[erenos-3.6.0-SNAPSHOT.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.21.4-R0.1-SNAPSHOT.jar:?]
... 27 more
Steps/models to reproduce
- Get and hold a damaged pickaxe with mending:
/give @s minecraft:netherite_pickaxe[enchantments={levels: {"minecraft:mending": 1}},minecraft:damage=1]
- Call
Player#applyMending(int) with 0 xp
Plugin and Datapack List
Just a test plugin
Paper version
[02:08:47 INFO]: This server is running Paper version 1.21.4-31-main@d0d0efe (2024-12-23T23:53:38Z) (Implementing API version 1.21.4-R0.1-SNAPSHOT)
You are running the latest version
Previous version: 1.21.4-30-aa2c52b (MC: 1.21.4)
Other
No response
Expected behavior
The applyMending method should not throw any exceptions when passing 0 as a value. At least that how it was in 1.20.4, since I just started running into that issue since updating to 1.21.4, and haven't changed anything to the plugin code.
I mean it would be a simple fix to not call the method when the value is 0, and I should implement that nonetheless, but throwing that exception seems wrong.
Observed/Actual behavior
Steps/models to reproduce
/give @s minecraft:netherite_pickaxe[enchantments={levels: {"minecraft:mending": 1}},minecraft:damage=1]Player#applyMending(int)with 0 xpPlugin and Datapack List
Just a test plugin
Paper version
[02:08:47 INFO]: This server is running Paper version 1.21.4-31-main@d0d0efe (2024-12-23T23:53:38Z) (Implementing API version 1.21.4-R0.1-SNAPSHOT)
You are running the latest version
Previous version: 1.21.4-30-aa2c52b (MC: 1.21.4)
Other
No response