Gamemode4Dev / GM4_Datapacks

Gamemode 4 is a collection of modular Minecraft Datapacks that change or expand on the vanilla experience whilst keeping the vanilla feel. Our modules are developed with a focus on usability and efficiency.
https://gm4.co
GNU General Public License v3.0
113 stars 56 forks source link

Custom crafters multi-crafting causes item duplication and deletion #47

Closed misode closed 6 years ago

misode commented 6 years ago

The bug

I expected the recipe not to work when different amounts of items are in the dropper. Instead I noticed the recipe worked and it just took the count of the last slot (bottom right) while ignoring the other slots.

How to reproduce

  1. Create a standard custom crafter
  2. Fill the dropper with flint making sure not all slots have the same number of flint → Notice the recipe works even though not all slots had the same number of items. It took the amount of items from the last slot and used that as the multiplier. This can cause item duplication and item deletion!

Installed modules

SpecialBuilder32 commented 6 years ago

GM4_Datapacks/gm4_custom_crafters/data/custom_crafters/functions/recipe_validity_check.mcfunction was supposed to address this issue.

misode commented 6 years ago

The problem is in custom_crafters:recipe_validity_check on line 34. It is only setting the gm4_stack_size score of @s when first_stack_count is greater than 0. This causes extension modules to be called. They then use the old value of gm4_stack_size of @s which is set to the count of the last slot.

execute if score first_stack_count gm4_stack_size matches 1.. run scoreboard players operation @s gm4_stack_size = first_stack_count gm4_stack_size