mojira.dev
MC-110336

Breaking a container before opening it bypasses quality check

Breaking a container (chest, hopper, dispenser...) with a custom loot table before opening it ignores quality and luck modifiers.

Using this loot table as an example:

{"pools":[{"rolls":1,"entries":[{"type":"item","weight":100,"name":"minecraft:leather_helmet","functions":[{"function":"set_attributes","modifiers":[{"name":"null","attribute":"generic.luck","operation":"addition","amount":3,"slot":"head"}]}]},{"type":"item","weight":1,"name":"minecraft:dirt","quality":100000}]}]}

What I expected to happen:

  • near 100% chance (100/101) for a helmet with +3 luck if the player has 0 (or theoretically any nonpositive) luck

  • near 100% chance (300,001/300,101) for dirt if the player has that +3 luck

What actually happened:
When the chest was broken before being opened, the helmet would have the same 100/101 chance to drop regardless of luck-enhancing equipment or the luck effect. Opening it normally (with m2) does, however, do what was expected.

Steps to reproduce:
1. Create the custom aforementioned loot table and load it into a world.
2. Setblock some chests with said LootTable.
3. Break the chests without right-clicking them and observe the drops.

Linked issues

Attachments

Comments 2

Easy way to reproduce without data packs:

/setblock ~ ~ ~ chest{LootTable:"gameplay/fishing"}
/effect give @s luck 100 100 true

Open the chest and you will always get a rare item. Break the chest and you will usually get fish. Repeat until statistically significant 😛

alphappy

(Unassigned)

Confirmed

Loot tables

loot-table

Minecraft 1.11, 20w07a, 1.18.2, 1.21.1

Retrieved