Daomephsta / LootTweaker

A CraftTweaker addon that adds the ability to tweak loot tables
MIT License
17 stars 2 forks source link

Chests are not populated with loot tables on SpongeForge server #90

Open zediious opened 2 years ago

zediious commented 2 years ago

Describe the bug

Loot tables defined with LootTweaker do not appear in chests on multiplayer servers that have SpongeForge installed. Testing on a normal Forge server results in the mod working correctly.

To Reproduce

Steps to reproduce the behavior:

I've tested this using my modpack, although you can of course test with whichever setup you have. If you want to use the same setup, here is the latest release

1) In singleplayer with cheats enabled, use /setblock ~ ~2 ~ minecraft:chest 1 0 {LootTable:"gdtable:hilund"} and see the loot table populate the spawned chest. One can also find or spawn a WroughtBuilding recurrent complex structure. 2) Doing such on a multiplayer server with SpongeForge installed results in no items.

Expected behavior

The chests to be filled with loot. The loot tables are generated properly within the server world at /world/data/loot_tables, and CraftTweaker reports no errors from the script, so I cannot understand why they are not called and populating the chests.

Logs & scripts

Chest Loot Craftweaker Script: https://github.com/zediious/galacticdrive/blob/0.2alpha/overrides/scripts/chestloot.zs

Server Crafttweaker Log: https://gist.github.com/zediious/50df74e839a0d0c901414920de9d1c08

Version Info (Exact versions only):

LootTweaker: LootTweaker-0.3.1+MC1.12.2 CraftTweaker/Minetweaker: CraftTweaker2-1.12-4.1.20.674 Forge: forge-14.23.5.2860 SpongeForge Version: spongeforge-1.12.2-2838-7.4.7 Minecraft: 1.12.2

Additional context

I commented this information on an already closed issue, however decided to just post a new issue as it's quite old.

Daomephsta commented 2 years ago

Sidenotes on your script:

zediious commented 2 years ago

Sidenotes on your script:

  • newTable() returns the table it creates. You can assign it directly to a variable, instead of calling getTable() afterwards.
  • addItemEntry autogenerates loot functions if the stack has metadata, size, or NBT. hilundPool1.addItemEntry(<mekanism:dirtydust:2>, 32, 32); is the same as hilundPool1.addItemEntry(<mekanism:dirtydust>, 32, 32, [Functions.setMetadata(2, 2)], []);

Thank you for the scrutiny :) I'm not sure what inspired me to use a metadata function instead of just putting it in the ItemStack; I’ll definitely improve the script more when I start adding the rest of the tables.