mojira.dev
MC-93483

Spectators opening Loot Table (double)Chests will generate the items inside

Update as of 15w51a: Double chests are still affected. Also, hoppers, when opened by a spectator, generate their own loot and the loot of containers above themselves. However this does not happen when the hopper is above a container or when a HopperMinecart is used.


If you open a chest with a loot table as a spectator, it will generate it's contents affecting gameplay for other survival/adventure players on the map.

Somebody with bad luck or luck effects that open a chest will have better/worse chance of getting good items from chests. A spectator could open all chests and make their contents fixed/unchangeable.

What should happen: A chest that has a loot table with a unspecified lootTableSeed should show a question mark in the chest and NOT generate the items. If the chest has fixed seed or fixed items inside that won't matter.
OR: a gamerule the allows spectators to generate loot in chests and other storage when opened.

Summarized:

  • Spectators influence loot table chests

  • Fix: Chests with loot table and random lootTableSeed will not generate items when opened by spectator

  • Alternate fix: /gamerule spectatorsGenerateLoot true/false. This will make spectators not generate any loot when they open chests/furnaces etc.


Code analysis by @unknown can be found in this comment.

Linked issues

Comments 10

Confirmed for 15w50a.

Confirmed for

  • 15w51b

Not fixed for:

  • Double chests

  • Hoppers: They generate their own loot and the loot of containers above themselves. However this does not happen when the hopper is above a container or when a HopperMinecart is used.

Please reopen

[Mod] redstonehelper

Reopened, am I understanding you right that hoppers generate their own loot and that of containers above only when opened by a spectator, but not completely on their own?

Yes you understood that with hoppers correctly. The only container which seems to be still affected is the double chest (also trapped version), there the loot is not created when the chests combine but only when the chest is opened

Confirmed for 16w02a.

Confirmed for 16w03a.

Confirmed for 16w04a.

Confirmed for 16w05a.

Confirmed for 1.9 pre-release 1.

Please link to this comment in the description

The following is based on a decompiled version of Minecraft 1.9 using MCP 9.24 beta.

The reason for this is that the class net.minecraft.inventory.InventoryLargeChest is not implementing the interface net.minecraft.world.storage.loot.ILootContainer.

Note: The method net.minecraft.world.storage.loot.ILootContainer.getLootTable() should be replaced with a method like boolean hasLootTable() or such a method should be added and called by the methods net.minecraft.entity.player.EntityPlayerMP.displayGui(IInteractionObject) and net.minecraft.entity.player.EntityPlayerMP.displayGUIChest(IInventory). Else there might be problems because a double chest can only return the loot table of one of the chests.

AgentM

boq

Confirmed

Chest, DoubleChest, Specator, loot-table

Minecraft 15w46a, Minecraft 15w47a, Minecraft 15w47b, Minecraft 15w47c, Minecraft 15w50a, ..., Minecraft 1.13-pre10, Minecraft 1.13, Minecraft 18w30b, Minecraft 18w31a, Minecraft 1.13.1

Minecraft 15w51a, Minecraft 19w02a

Retrieved