mojira.dev
MC-156705

Player conditions for chest loot tables don't work when breaking the chest

There are two instances in which a chest with loot table generates its 'treasure', when its opened or when its broken, and it is expected that these two instances generate the same items if meeting the same requirements.

When you use player related conditions (like entity_scores, entity_properties) while opening chests, the conditions work fine. But while breaking chests, these conditions don't work. Other items in the loot table without these conditions are generated anyways.

It seems like chest loot tables forget to grab the data of the entity that broke the chest, unlike block loot tables that are working fine in this aspect.

For testing this bug I made a loot table and put it into this datapack: 

[media]

To get a chest with this loot table:

/setblock ~ ~ ~ minecraft:chest{LootTable:"minecraft:chests/test_loot"}
/give @p minecraft:chest{BlockEntityTag:{LootTable:"minecraft:chests/test_loot"}} 1

You will get emeralds if you open the chest while sprinting, but not if you break the chest while sprinting.

You will get diamonds if you open the chest while having "test" dummy score of 0, but not if you break the chest while having "test" dummy score of 0.

And you always will get maps because they have no conditions.

 

 

Linked issues

Attachments

Comments 2

It seems this confirmed bug doesn't have a priority assigned yet

FACS01

(Unassigned)

Confirmed

Platform

Low

Loot tables

chest, condition, container, containers, loot_table

Minecraft 1.14.4 Pre-Release 5, Minecraft 1.14.4 Pre-Release 6, 1.14.4, 19w34a, 19w35a, ..., 1.17, 1.17.1 Pre-release 1, 1.18.2, 22w11a, 1.21.1

Retrieved