FabricMC / fabric

Essential hooks for modding with Fabric.
Apache License 2.0
2.13k stars 382 forks source link

Loot table data generation does not include random sequences #3751

Open haykam821 opened 1 month ago

haykam821 commented 1 month ago

The random_sequence field is expected for loot tables produced by data generation, but instead, it is not present. As a result, generated loot tables use the world random rather than a loot table-specific random sequence.

Compare the implementations of the Fabric API FabricLootTableProviderImpl#run and vanilla LootTableProvider#run methods. The Fabric API implementation does not call builder.randomSequenceId(identifier) when accepting each loot table builder from the provider, leading to this issue.

As a workaround, the following code can be added to the end of FabricBlockLootTableProvider#generate implementations in individual mods:

this.lootTables.forEach((id, lootTable) -> {
    lootTable.randomSequenceId(id);
});
maityyy commented 1 month ago

Can we get rid of FabricLootTableProvider(s) to avoid further similar bugs? Recently I also discovered a similar bug and they are difficult to track