If the amount of ammo item in inventory is less than ammo count of the enchantment, the game crashes.
Steps to reproduce:
1) Download
[media]example data pack and put it on your world.
2) Get a crossbow and enchant it with this command:
/enchant @s test_datapack:test_enchantment 5
3) Put 1 arrow in your inventory and switch to survival mode.
4) Try to reload the crossbow. The game crashes.
Expected Result:
The crossbow shouldn't be reloadable and the game shouldn't crash.
Observed Result:
The game crashes.
The related images and the crash log is attached.
Please update the description to include steps to reproduce this issue, as well as expected VS observed results.
Please also attach any needed datapacks, resourcepacks, screenshots, videos or worlds needed to help reproduce this issue.