Treasure2!

Treasure2!

6M Downloads

[BUG] Treasure loot tables not handling modded loot functions anymore

Wabbit0101 opened this issue ยท 4 comments

commented

I can't check if this used to work but I'm pretty sure it did as I've not see this error before. For the latest build Treasure2-mc1.12.2-f14.23.5.2768-v1.3.0.jar , custom modded loot functions no longer work. Logged example error extract shown below thrown from TreasureLootFunctionManager. Whole loot file attached.

com.google.gson.JsonSyntaxException: Unknown function 'smarthoppers:on_looted'
	at com.someguyssoftware.treasure2.loot.functions.TreasureLootFunctionManager$Serializer.deserialize(TreasureLootFunctionManager.java:86) ~[TreasureLootFunctionManager$Serializer.class:?]
	at com.someguyssoftware.treasure2.loot.functions.TreasureLootFunctionManager$Serializer.deserialize(TreasureLootFunctionManager.java:77) ~[TreasureLootFunctionManager$Serializer.class:?]
	at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:69) ~[TreeTypeAdapter.class:?]
	at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:41) ~[TypeAdapterRuntimeTypeWrapper.class:?]
	at com.google.gson.internal.bind.ArrayTypeAdapter.read(ArrayTypeAdapter.java:72) ~[ArrayTypeAdapter.class:?]
	at com.google.gson.Gson.fromJson(Gson.java:887) ~[Gson.class:?]
	at com.google.gson.Gson.fromJson(Gson.java:952) ~[Gson.class:?]
	at com.google.gson.internal.bind.TreeTypeAdapter$GsonContextImpl.deserialize(TreeTypeAdapter.java:162) ~[TreeTypeAdapter$GsonContextImpl.class:?]
	at net.minecraft.util.JsonUtils.func_188179_a(SourceFile:439) ~[rc.class:?]
	at net.minecraft.util.JsonUtils.func_188174_a(SourceFile:447) ~[rc.class:?]
	at com.someguyssoftware.treasure2.loot.TreasureLootEntryItem.deserialize(TreasureLootEntryItem.java:104) ~[TreasureLootEntryItem.class:?]
	at com.someguyssoftware.treasure2.loot.TreasureLootEntry$Serializer.deserialize(TreasureLootEntry.java:92) ~[TreasureLootEntry$Serializer.class:?]
	at com.someguyssoftware.treasure2.loot.TreasureLootEntry$Serializer.deserialize(TreasureLootEntry.java:72) ~[TreasureLootEntry$Serializer.class:?]
	at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:69) ~[TreeTypeAdapter.class:?]
	at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:41) ~[TypeAdapterRuntimeTypeWrapper.class:?]
	at com.google.gson.internal.bind.ArrayTypeAdapter.read(ArrayTypeAdapter.java:72) ~[ArrayTypeAdapter.class:?]
	at com.google.gson.Gson.fromJson(Gson.java:887) ~[Gson.class:?]
	at com.google.gson.Gson.fromJson(Gson.java:952) ~[Gson.class:?]
	at com.google.gson.internal.bind.TreeTypeAdapter$GsonContextImpl.deserialize(TreeTypeAdapter.java:162) ~[TreeTypeAdapter$GsonContextImpl.class:?]
	at net.minecraft.util.JsonUtils.func_188179_a(SourceFile:439) ~[rc.class:?]
	at net.minecraft.util.JsonUtils.func_188174_a(SourceFile:447) ~[rc.class:?]
	at com.someguyssoftware.treasure2.loot.TreasureLootPool$Serializer.deserialize(TreasureLootPool.java:169) ~[TreasureLootPool$Serializer.class:?]
	at com.someguyssoftware.treasure2.loot.TreasureLootPool$Serializer.deserialize(TreasureLootPool.java:165) ~[TreasureLootPool$Serializer.class:?]
	at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:69) ~[TreeTypeAdapter.class:?]
	at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:41) ~[TypeAdapterRuntimeTypeWrapper.class:?]
	at com.google.gson.internal.bind.ArrayTypeAdapter.read(ArrayTypeAdapter.java:72) ~[ArrayTypeAdapter.class:?]
	at com.google.gson.Gson.fromJson(Gson.java:887) ~[Gson.class:?]
	at com.google.gson.Gson.fromJson(Gson.java:952) ~[Gson.class:?]
	at com.google.gson.internal.bind.TreeTypeAdapter$GsonContextImpl.deserialize(TreeTypeAdapter.java:162) ~[TreeTypeAdapter$GsonContextImpl.class:?]
	at net.minecraft.util.JsonUtils.func_188179_a(SourceFile:439) ~[rc.class:?]
	at net.minecraft.util.JsonUtils.func_188177_a(SourceFile:455) ~[rc.class:?]
	at com.someguyssoftware.treasure2.loot.TreasureLootTable$Serializer.deserialize(TreasureLootTable.java:216) ~[TreasureLootTable$Serializer.class:?]
	at com.someguyssoftware.treasure2.loot.TreasureLootTable$Serializer.deserialize(TreasureLootTable.java:213) ~[TreasureLootTable$Serializer.class:?]
	at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:69) ~[TreeTypeAdapter.class:?]
	at com.google.gson.Gson.fromJson(Gson.java:887) ~[Gson.class:?]
	at com.google.gson.Gson.fromJson(Gson.java:852) ~[Gson.class:?]
	at com.google.gson.Gson.fromJson(Gson.java:801) ~[Gson.class:?]
	at com.google.gson.Gson.fromJson(Gson.java:773) ~[Gson.class:?]
	at com.someguyssoftware.treasure2.loot.TreasureLootTableManager.hookLoadLootTable(TreasureLootTableManager.java:216) ~[TreasureLootTableManager.class:?]
	at com.someguyssoftware.treasure2.loot.TreasureLootTableManager$Loader.loadLootTable(TreasureLootTableManager.java:158) [TreasureLootTableManager$Loader.class:?]
	at com.someguyssoftware.treasure2.loot.TreasureLootTableManager$Loader.load(TreasureLootTableManager.java:114) [TreasureLootTableManager$Loader.class:?]
	at com.someguyssoftware.treasure2.loot.TreasureLootTableManager$Loader.load(TreasureLootTableManager.java:104) [TreasureLootTableManager$Loader.class:?]
	at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3716) [guava-21.0.jar:?]
	at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2424) [guava-21.0.jar:?]
	at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2298) [guava-21.0.jar:?]
	at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2211) [guava-21.0.jar:?]
	at com.google.common.cache.LocalCache.get(LocalCache.java:4154) [guava-21.0.jar:?]
	at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4158) [guava-21.0.jar:?]
	at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:5147) [guava-21.0.jar:?]
	at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:5153) [guava-21.0.jar:?]
	at com.someguyssoftware.treasure2.loot.TreasureLootTableManager.getLootTableFromLocation(TreasureLootTableManager.java:91) [TreasureLootTableManager.class:?]
	at com.someguyssoftware.treasure2.loot.TreasureLootTables.init(TreasureLootTables.java:178) [TreasureLootTables.class:?]
	at com.someguyssoftware.treasure2.eventhandler.WorldEventHandler.onWorldLoad(WorldEventHandler.java:40) [WorldEventHandler.class:?]
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_330_WorldEventHandler_onWorldLoad_Load.invoke(.dynamic) [?:?]
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) [ASMEventHandler.class:?]
	at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182) [EventBus.class:?]
	at net.minecraft.server.integrated.IntegratedServer.func_71247_a(IntegratedServer.java:132) [chd.class:?]
	at net.minecraft.server.integrated.IntegratedServer.func_71197_b(IntegratedServer.java:156) [chd.class:?]
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:486) [MinecraftServer.class:?]
	at java.lang.Thread.run(Unknown Source) [?:1.8.0_191]

armor_tool_chest.zip

commented

You are correct - this use to work. However, to get the custom loot table location to work correctly, I had to create my own loot table manager (and all related classes). So currently, any custom loot functions from other mods are registered only in the vanilla loot manager and not in the treasure loot manager. I will look into trying to load everything that is in vanilla into treasure.

commented

Np; I've just reworked those entries for now. Not sure how prevalent custom loot functions are for priority but (imo) this is a great loot/treasure chest mod so would be nice to be able to just basically replace boring ol' chests with this mod.

commented

Doesn't look like I can load in the custom loot functions. The method isn't exposed, so I can't grab what is loaded into vanilla. If I knew what mod and what the functions were I could possibly load them in (this would only work for those specific mods, not all mods in general).

commented

I've worked around this by placing "envelope" loot items instead of custom items directly as necessary. Those envelope items then front a vanilla loot table manager call which can pick up whatever custom functions are registered. So it's back to stuffing rare/scarce crates full of goodies! Thank you for the investigation.