Railcraft

Railcraft

34M Downloads

Village Chests Have No Loot

Zalaniar opened this issue ยท 9 comments

commented

The chests inside the Railcraft buildings generate with nothing inside them. The server console gives this warning upon launch:
Server thread/WARN Couldn't find resource table railcraft:chests/village_workshop
The chests are there, and other features of the buildings generate properly, but the chests are empty. Other village chests also generate normally.

commented

Sadly, my loot code is utterly broken and it has been pretty low priority to fix. At some point I'll probably need to bug @mezz to see how he did it in Forestry.

commented

Forestry's loot handling is a crazy hack...

I wrote a set of loot tables as if they were the vanilla loot tables,
https://github.com/ForestryMC/ForestryMC/tree/mc-1.10/src/main/resources/assets/forestry/loot_tables/chests

and the load them with my own loader:
https://github.com/ForestryMC/ForestryMC/blob/mc-1.10/src/main/java/forestry/core/loot/LootTableLoader.java

Then I inject my table's stuff into the matching vanilla one on this event:
https://github.com/ForestryMC/ForestryMC/blob/mc-1.10/src/main/java/forestry/core/EventHandlerCore.java#L101-L117

This is the only way I could come up with to do it without writing everything in code, which is poorly supported.

commented

My eyes burn! Its worse than I thought!

commented

lol. the sad reality of forestry mod loot tables...

commented

Some mods I use are using the Additional Loot Tables Mod to handle adding loot tables to Minecraft. Might be worth a look to see if it would work for you, or if you can glean some insight on how to get it to work.

commented

A recent Forge PR has allowed me to implement this in a less eye-burning way in 1.11:
ForestryMC/ForestryMC@3e175aa

commented

@mezz my main issue with the current implementation is that it chokes hard on missing items, rather than ignore them. Which makes it a pain for people who disable Railcraft items or modules, they also have to provide their own loot tables with the disabled items removed.

commented

I should split up the loot table additions so they are one file per module to help with that.
Did you find a better way to do it in Railcraft or does it still have the same issue?

commented

@mezz I considered making a custom Loot Type, one that would react gracefully to missing items, but unfortunately the Forge code for that in 1.10 just leads to a "TODO: put custom Loot Type code here eventually". So at the moment, if you disable an item in a loot table, you either get no loot at all or you have to make a new table and put it in a resource pack.