mojira.dev
MC-1555

Items get deleted when the crafting recipe overflows the inventory

When crafting something that gives more than one item as an result (e.g. diamond blocks to diamonds, stairs, slabs) and not all resulting items fit into the inventory, the overflow gets deleted.

Steps to reproduce
1. Prepare your inventory like this (Put the diamond blocks into the free spot, instead of the crafting field)

[media]

2. Make sure you are in survival (/gamemode 0)

3. Craft the 8 diamond blocks into diamonds.
4. The expected result would be 72 diamonds (8*9), but you only get 64

[media]

Ways to fix
I mainly see two ways to fix this.
1. Check if there is enough space in the inventory before hand (This is probably a bit more work to implement as there is no such method, I think)
2. Drop the overflowing items.
While I personally prefer the first one, the second one should be easy to implement.
It is a one liner, but due to old copy paste code it would need to be change in several different spots (Villager, Player, Workbench, maybe also Furnace and Anvil).

So for a nice fix some more generic Inventory/Container code would be good.

Code analysis: https://bugs.mojang.com/browse/MC-1555?focusedCommentId=288028&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-288028


Fix note: https://twitter.com/_LadyAgnes/status/762734666042441730

Linked issues

MC-2571 When crafting from Metal Block form to ingots or diamonds there is a possiblity of losing some of said block. Resolved MC-10237 Deleting item when crafting several at the same time and shift-clicking. Resolved MC-25282 Loss Of Block Resolved MC-44291 Shift-clicking with full inventory destroys some items Resolved MC-52198 Crafting loss Resolved

Attachments

Comments 75

Confirmed. Nasty bug.

Edit: Can I suggest changing title of bug to something like "Splitting blocks into separate items not properly checking for full inventory"

Affects 1.6.4 and snapshot 13w38c.

Still a bug in 1.7.2.

Jacob Petersen

I can verify that this bug still exists in 1.7.2.

This is true for all recipes that create more than one item per one input. Can confirm for 14w08a (latest snapshot as of now). It's a nasty bug and someone should fix it.

65 more comments

Confirmed for 1.10-pre1.

Confirmed for 1.10-pre2.

Confirmed for 1.10.

Confirmed for 1.10.1.

Confirmed fixed for 16w32a

James Donal Conley

Panda4994

Agnes Larsson

Confirmed

Minecraft 1.4.2, Minecraft 1.4.5, Minecraft 1.4.7, Snapshot 13w04a, Snapshot 13w07a, ..., Minecraft 1.10 Pre-Release 1, Minecraft 1.10 Pre-Release 2, Minecraft 1.10, Minecraft 1.10.1, Minecraft 1.10.2

Minecraft 16w32a

Retrieved