Paper: Loot table auto-replenish mechanism can not be disabled and breaks vanilla behavior

Created on 16 Feb 2019  路  4Comments  路  Source: PaperMC/Paper

What behaviour is expected:

Consider a simple vanilla loot table rolling machine to implement a "casino"

2019-02-16_14 14 08

Just a button that sets the loot table of the chest above it with this command:

data merge block ~ ~1 ~ {LootTable:"epic:r1/casino/slot_machine_chest"}

In vanilla, when you open that loot table chest, the loot table is cleared. If you click the button again, the loot table chest will be reset with new contents (even if it had existing contents).

What behaviour is observed:

In paper, this does not work because the loot table for the chest is preserved in the chest's NBT data. No combination of settings under lootables in paper.yml will disable this feature.

Steps/models to reproduce:

These settings in paper.yml should disable this "feature":

    lootables:
      auto-replenish: false

You can use a vanilla minecraft loot table to reproduce this:

data merge block ~ ~1 ~ {LootTable:"minecraft:entities/zombie"}

With current paper, regardless of settings, every time you click the button the chest will remain the same.

Plugin list:

None needed. Though this also breaks plugins replacing chests (for example, Fast Async World Edit)

Paper build number:

Latest build from source as of Feb 16, 2019. Last commit was Aikar's large chunk saving patch fix for the dupe exploit.

Anything else:

I'm happy to implement this change myself with some guidance. I originally attempted to do so but ended up making enough changes that I'm certain there must be a better way. For now I've just reverted the loot table API and loot table regeneration in my own local builds so as to work around this problem.

accepted bug

Most helpful comment

fixed in latest build of 1.12 and 1.13

All 4 comments

it actually does clear the loot table, the issue is the restriction on relooting is kicking in, ill fix that.

fixed in latest build of 1.12 and 1.13

Thanks for the fast fix! Just tested, and this does fix my problem.

There's still one odd thing that's different from vanilla behavior though that I personally don't like (but can work around). Not a bug per se - but an oddity.

In vanilla, when you set the loot table tag on a chest, it overwrites all of the chests contents with the new loot table contents (destroying whatever was in the chest before). With this Lootable system, paper adds items to the container without clearing them. When the container gets full, no more items are added to the container, and the server log contains the message [Server thread/WARN]: Tried to over-fill a container

For vanilla's overwriting behavior, you can even have the chest open when this happens (test with a few repeaters as a delay, throw something in box and then when loot table updates it replaces the contents).

My particular use case here is a silly casino (as I hinted before). Players put in a chip, and the loot table box gets new loot. Tons of the loot is junk - so people just leave it in the box and roll it again to delete it. I can trivially use data remove to clear the chest before hand, but I do not need to do so with vanilla.

Wanted to make you aware of this so you could consider adopting vanilla behavior if you'd like.

Thanks again!

I think its because in vanilla when the NBT is loaded, if the table is set, the items are ignored.

I assume the /data command saves the chest NBT tag, adds the key, then reloads it, which then wipes out the items.

we had to always keep the items loaded to enable the replenishable feature.

We might be able to fix that if world is set to check the config, ill look into it as it wasn't intended to modify vanilla behavior in the default off state

Was this page helpful?
0 / 5 - 0 ratings

Related issues

James94665 picture James94665  路  3Comments

BillyGalbreath picture BillyGalbreath  路  3Comments

Shevchik picture Shevchik  路  3Comments

Decme picture Decme  路  3Comments

successed picture successed  路  3Comments