maruohon / itemscroller

A client-side Minecraft mod that adds various convenient ways of moving items within inventory GUIs, such as scrolling over stacks to move single items to or from it
GNU Lesser General Public License v3.0
147 stars 68 forks source link

[Bug] Mass craftEverything not using precise amounts of resources for rockets #59

Open GreenGinkgo opened 3 years ago

GreenGinkgo commented 3 years ago

MC version: 1.16.5 Item scroller: v1.15.0-dev.20210111.205029

When using the craftEverything feature to make rockets, You will sometimes get different types of rockets. Specifically, it may craft 1, 2, or 3 second rockets despite only executing the recipe for 3-second rockets. This does not seem to happen every time, but In trying to make around a chest of rockets (27 stacks), there resulted also 3 rockets that only have a 2 second duration. This implies that one of the slots of gunpowder had a smaller stack than the others, and ran out mid-crafting.

Testing more deliberately, I found that if you had gunpowder in your inventory at an imperfect ratio versus paper, you can get incorrect rocket types. I tested this by having 6 paper and 16 gunpowder in inventory (6 and 18 would be a perfect ratio of 1:3). When executing craftEverything, it seems that the function split the 6 gunpowder into uneven stacks (5, 5, 6), resulting in 15 3-second rockets, and 3 1-second rockets. Each paper used rocket crafting yields 3 rockets, so that mean that there were 5 cycles of 3 gunpowder + 1 paper, and one cycle of 1 GP + 1 paper. This issue even occurs with full, but incorrect ratio, stacks, as 64/3 = 2 stacks of 21, and 1 stack of 22. So if you had a single stack of gunpowder in your inventory and enough paper, you would get 63 longer rockets and a single 1-second rocket.

If it does not exist already, can you please implement a recipe completeness check that checks for partial stacks before firing the crafting action? Or maybe only load precise stacks into the crafting interface instead of doing a split of whatever is in inventory and putting all of it into the crafting interface? This might only need to be done for rockets (might be simpler to code), but I can foresee it being useful for custom datapack recipes, so making it universal may be more elegant.

Thanks so much for your hard work!