Create Diesel Generators crashes when EMI injects loot tables without an ID
m0ddixx opened this issue · 0 comments
Summary
loadLootTable in GameEvents assumes every LootTableLoadEvent exposes a non-null ResourceLocation. EMI Loot 0.7.6 (NeoForge build) synthesizes “direct drop” tables without IDs, so event.getTable().getLootTableId() returns null. The next line calls tableId.getPath(), hard-crashing the server during datapack/loot reload.
Game & Mod Versions
- Minecraft 1.21.1 (NeoForge 21.1.214)
- Java 21 (server, Dockerized on Windows 11 host)
- Create Diesel Generators 1.3.7
- EMI Loot 0.7.6+1.21+neoforge
- EMI 1.1.22
- Create 6.0.8
Steps to Reproduce
- Start a NeoForge 1.21.1 server with the mods above.
- Leave
mobLootIncludeDirectDrops = trueinconfig/emi_loot_config.toml. - Launch the server or reload datapacks.
What Happens
java.lang.NullPointerException: Cannot invoke "net.minecraft.resources.ResourceLocation.getPath()" because "tableId" is null
at com.jesz.createdieselgenerators.events.GameEvents.loadLootTable(GameEvents.java:80)
at net.neoforged.neoforge.event.EventHooks.loadLootTable(EventHooks.java:714)
at fzzyhmstrs.emi_loot.neoforge.EMILootAgnosNeoForge.loadLootTableAgnos(EMILootAgnosNeoForge.java:48)
...
What I Expected
Create Diesel Generators should ignore loot tables that do not expose an identifier instead of crashing.
Suggested Fix
Guard the handler before touching the loot table path (see GameEvents.java#L76-L97):
@SubscribeEvent
public static void loadLootTable(LootTableLoadEvent event) {
LootTable table = event.getTable();
ResourceLocation tableId = table.getLootTableId();
if (tableId == null || !tableId.getPath().startsWith("entities/")) {
return;
}
...
}
Workaround
None I know of