In 1.12.x LootTableLoadEvent appears to be fired for all loot tables except those added into world/data. ForgeHooks.loadLootTable receives flag custom to determine that, where in 1.12.x it changed depending on which method used it - one was for world loot tables, and one was loading loot tables from vanilla and mods.
But in 1.13.x that custom flag is determined by resource pack name, and that comes from resource pack named Default is considered "custom", even if it's vanilla default loot table. On discord I got an answer that it should match 1.12.x.
To match the 1.12 behavior, I think it would need to get access to ResourcePackType, but I don't see any reasonable path to that data from IResource or IResourceManager.
agreed that this should match the old behaviour. the explicit design decision we made in 1.9 was that modders can modify any non-world folder loot table. If non-world tables from vanilla can't be modified, this would prevent e.g. injecting things into dungeon chests, which is probably the biggest use case for LootTableLoadEvent
This is still an issue in 1.14.2. Commenting about it since the issue got the "Needs Update" label.
The current bug appears to be caused by this patch, which sets custom to true whenever the resource pack name is default. The result is LootTableLoadEvent is fired for all loot tables loaded from JAR's except vanilla loot tables (I was unable to get a datapack loot table to hit that line in my testing, but might have just set my datapack up wrong). At a minimum, that should be inverted to !iresource.func_199026_d().equals("Default") so it calls for only vanilla loot tables, as that is really the primary usecase of the event.
On a related note, it seems getName() on the event is now returning the full resource path for a table, including the loot_tables folder and the .json extension. Instead of getting the expected simplytea:blocks/chorus_flower for one of my tables, I get simplytea:loot_tables/blocks/chorus_flower.json
This have been fixed in the 1.14.3 update. The event only returns vanilla loot tables now though, not sure if that is intended.
This is a big bummer for mods that modify/add loot to the original loot tables. Would look forward to a fix for 1.13.x versions
This is working in 1.14.4, looks like it got fixed in the 1.14.4 update. Since that patch has not changed in the 1.15 update, I assume it still works there too.
Most helpful comment
The current bug appears to be caused by this patch, which sets custom to true whenever the resource pack name is default. The result is LootTableLoadEvent is fired for all loot tables loaded from JAR's except vanilla loot tables (I was unable to get a datapack loot table to hit that line in my testing, but might have just set my datapack up wrong). At a minimum, that should be inverted to
!iresource.func_199026_d().equals("Default")so it calls for only vanilla loot tables, as that is really the primary usecase of the event.On a related note, it seems
getName()on the event is now returning the full resource path for a table, including theloot_tablesfolder and the.jsonextension. Instead of getting the expectedsimplytea:blocks/chorus_flowerfor one of my tables, I getsimplytea:loot_tables/blocks/chorus_flower.json