mojira.dev
MC-200593

Recipe book doesn't always move items when ingredients in crafting grid are unbalanced

The bug

The recipe book (correctly) auto-fills items based on the minimum stack size of the ingredients that are already in the crafting grid. However, when determining whether the player is holding enough ingredients to perform this action, the calculation uses the maximum stack size. As a result, ingredients sometimes remain in the player's inventory when a recipe is clicked.

How to reproduce

Example 1:

  1. Clear all items from your inventory:

    /clear
  2. Ensure you have unlocked the block of iron recipe:

    /recipe give @s iron_block
  3. Give yourself 27 iron ingots and a crafting table:

    /give @s iron_ingot 27
    /give @s crafting_table
  4. Place the crafting table and open it

  5. In the recipe book, click on the block of iron recipe twice

  6. Remove exactly one iron ingot from the crafting grid and place it back into your inventory

  7. Click on the block of iron recipe once
    → ✔ The iron ingot that you removed from the crafting grid is sent back into the crafting grid

  8. Completely remove one iron ingot from your inventory:

    /clear @s iron_ingot 1
  9. Open the crafting table and repeat steps 5-7
    → ❌ The iron ingot that you placed back into your inventory is not sent to the crafting grid

Example 2:

  1. Ensure you are in Survival or Adventure mode:

    /gamemode survival
  2. Clear all items from your inventory:

    /clear
  3. Ensure you have unlocked the torch recipe:

    /recipe give @s torch
  4. Give yourself 3 sticks and 3 pieces of coal:

    /give @s stick 3
    /give @s coal 3
  5. Open your inventory

  6. In the recipe book, click on the torch recipe twice

  7. Remove exactly one stick from the crafting grid and place it back into your inventory

  8. Click on the torch recipe once
    → ✔ The stick that you removed from the crafting grid is sent back into the crafting grid

  9. Completely remove one piece of coal from your inventory:

    /clear @s coal 1
  10. Repeat steps 5-8
    → ❌ The stick that you placed back into your inventory is not sent to the crafting grid

Linked issues

Attachments

Comments 2

I was able to reproduce this in 20w45a. Also, this might be related to MC-147729?

 This bug affects 1.19.3.

 If you click on item that is already been crafting from the recipe book, depending on the maximum and minimum number of items in ingredient grid, the number of ingredients needed for the ingredients to be placed automatically seems to be determinded.

 

 For example, when you put 7 planks and 4 sticks in ingredient compartments to craft 2 wooden pickaxe, 3 planks will be placed in one of the upper line's grid.
(There will be 2 in all other compartments,)

 

 At this time, when you click on the wooden pickaxe in the recipe book, 

 The maximum number of placed ingredients is determined by 3 (because of 3 planks) and
The minimum number of placed ingredients is determined by 2 (because of oteher ingredients).

 Because of the maximum number of placed ingredients (3), after clicking wooden pickaxe in the recipe book, the number of items to be crafted is determined by 4 on a temporary.

 So, To make 4 wooden pickaxes, 5 more planks and 4 more sticks are needed.
(when you try it in game, if the number of planks or sticks is not enough, it will not be automatically placed.)

 However, the number of item to be placed on the crafting table grid is set to 3 accoding to the minimum number of placed ingredients. so 3 planks and 2 sticks were left in your inventory.

[media]

 When determining the number of ingredients to be transferred to the crafting grid, it seems that the maximum numbers of placed ingredients should not be followed.

j_p_smith

(Unassigned)

Community Consensus

Platform

Normal

Crafting, UI

1.16.3, 1.16.4 Pre-release 1, 1.16.4 Pre-release 2, 1.16.4, 20w45a, ..., 1.21.3, 1.21.5, 1.21.6, 1.21.7, 1.21.8

Retrieved