Just Enough Calculation

Just Enough Calculation

18M Downloads

Recipes being deleted between world shutdown and world startup

ASchneider-GitHub opened this issue ยท 1 comments

commented

I'm not sure what's causing this, but occasionally when I exit a world and then re-enter it later, recipes are deleted from the calculator's memory. For example, last night this was what my calculator recipes looked like:
2024-12-27_01 22 54

When I opened my world again this is what my calculator contained:
2024-12-27_09 57 46

It seems like something about exiting and re-entering the world causes the calculator to lose recipes (sometimes 100% of them), but I'm not sure what causes it. I'm utilizing ATM9 as the base modpack, but more info is below.

  • JEC version jecalculation-forge-1.20.1-4.0.4.jar
  • Java version C:/Program Files/Java/jdk-17.0.4/bin/java.exe
  • Modlist (remove .txt extension for working hyperlinks:
    modlist.html.txt
  • Debug-level logs from entering world (to find recipes have been dropped):
    debug.log
  • Debug-level logs from exiting world last night (ZIPped for size):
    debug-1.log.gz

May look at adding some additional logging around the init code to see if I can figure out what's going wrong, but I saw #156 and wanted to provide more context for the issue. I've had this bug in the past and was hoping it would be patched by now, so hopefully this new info helps.

commented

I added some additional logging to the serialization method:

        @Override
        public CompoundTag serializeNBT() {
            CompoundTag tag = container.getRecord().serialize();
            JustEnoughCalculation.logger.info("Serializing recipes to NBT: " + tag, new RuntimeException("Trace"));
            return tag;
        }

and some additional logging to the deserialization method:

        @Override
        public void deserializeNBT(CompoundTag nbt) {
            JustEnoughCalculation.logger.info("Deserializing recipes from NBT: " + nbt, new RuntimeException("Trace"));
            boolean s = LPlaceholder.state;
            LPlaceholder.state = false;
            container.setRecord(new RecordPlayer(nbt));
            LPlaceholder.state = s;
        }

and got this log message after launching a singleplayer world:

[27Dec2024 17:17:05.620] [Server thread/INFO] [jecalculation/]: Deserializing recipes from NBT: {recipes:{}}
java.lang.RuntimeException: Trace
	at me.towdium.jecalculation.forge.JecaCapability$Provider.deserializeNBT(JecaCapability.java:91) ~[jecalculation-4.0.5.jar%23795!/:?]
	at me.towdium.jecalculation.forge.JecaCapability$Provider.deserializeNBT(JecaCapability.java:74) ~[jecalculation-4.0.5.jar%23795!/:?]
	at net.minecraftforge.common.capabilities.CapabilityDispatcher.deserializeNBT(CapabilityDispatcher.java:126) ~[forge-1.20.1-47.3.11-universal.jar%231013!/:?]
	at net.minecraftforge.common.capabilities.CapabilityProvider.deserializeCaps(CapabilityProvider.java:148) ~[forge-1.20.1-47.3.11-universal.jar%231013!/:?]
	at net.minecraft.world.entity.Entity.m_20258_(Entity.java:1739) ~[client-1.20.1-20230612.114412-srg.jar%231008!/:?]
	at net.minecraft.server.players.PlayerList.m_11224_(PlayerList.java:320) ~[client-1.20.1-20230612.114412-srg.jar%231008!/:?]
	at net.minecraft.server.players.PlayerList.m_11261_(PlayerList.java:157) ~[client-1.20.1-20230612.114412-srg.jar%231008!/:?]
	at net.minecraft.server.network.ServerLoginPacketListenerImpl.m_143699_(ServerLoginPacketListenerImpl.java:139) ~[client-1.20.1-20230612.114412-srg.jar%231008!/:?]
	at net.minecraft.server.network.ServerLoginPacketListenerImpl.m_10055_(ServerLoginPacketListenerImpl.java:126) ~[client-1.20.1-20230612.114412-srg.jar%231008!/:?]
	at net.minecraft.server.network.ServerLoginPacketListenerImpl.m_9933_(ServerLoginPacketListenerImpl.java:70) ~[client-1.20.1-20230612.114412-srg.jar%231008!/:?]
	at net.minecraft.network.Connection.m_129483_(Connection.java:263) ~[client-1.20.1-20230612.114412-srg.jar%231008!/:?]
	at net.minecraft.server.network.ServerConnectionListener.m_9721_(ServerConnectionListener.java:142) ~[client-1.20.1-20230612.114412-srg.jar%231008!/:?]
	at net.minecraft.server.MinecraftServer.m_5703_(MinecraftServer.java:907) ~[client-1.20.1-20230612.114412-srg.jar%231008!/:?]
	at net.minecraft.server.MinecraftServer.m_5705_(MinecraftServer.java:814) ~[client-1.20.1-20230612.114412-srg.jar%231008!/:?]
	at net.minecraft.client.server.IntegratedServer.m_5705_(IntegratedServer.java:89) ~[client-1.20.1-20230612.114412-srg.jar%231008!/:?]
	at net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:661) ~[client-1.20.1-20230612.114412-srg.jar%231008!/:?]
	at net.minecraft.server.MinecraftServer.m_206580_(MinecraftServer.java:251) ~[client-1.20.1-20230612.114412-srg.jar%231008!/:?]
	at java.lang.Thread.run(Thread.java:833) ~[?:?]

It seems to indicate that there's an issue when the mod goes to read the recipe records from the <playerUUID>.dat folder, as this is what a normal launch looks like:

[27Dec2024 20:54:44.331] [Server thread/INFO] [jecalculation/]: Deserializing recipes from NBT: {last:"",recipes:{Default:[{catalyst:[],input:[{content:{amount:4L,name:"forge:sawdust"},type:"itemTag"}],output:[{content:{amount:1L,item:"mekanism:cardboard_box"},type:"itemStack"}]},{catalyst:[],input:[{content:{amount:5L,name:"minecraft:planks"},type:"itemTag"},{content:{amount:1L,item:"minecraft:stonecutter"},type:"itemStack"},{content:{amount:3L,item:"minecraft:iron_ingot"},type:"itemStack"}],output:[{content:{amount:1L,item:"productivetrees:sawmill"},type:"itemStack"}]},{catalyst:[],input:[{content:{amount:1L,item:"minecraft:iron_ingot"},type:"itemStack"},{content:{amount:3L,item:"minecraft:stone"},type:"itemStack"}],output:[{content:{amount:1L,item:"minecraft:stonecutter"},type:"itemStack"}]},{catalyst:[],input:[{content:{amount:8L,name:"forge:glass"},type:"itemTag"},{content:{amount:1L,item:"rftoolsbuilder:shape_card_quarry_fortune"},type:"itemStack"}],output:[{content:{amount:1L,item:"rftoolsbuilder:shape_card_quarry_clear_fortune"},type:"itemStack"}]},{catalyst:[],input:[{content:{amount:4L,item:"rftoolsbase:dimensionalshard"},type:"itemStack"},{content:{amount:1L,item:"minecraft:ghast_tear"},type:"itemStack"},{content:{amount:1L,item:"minecraft:emerald"},type:"itemStack"},{content:{amount:1L,item:"rftoolsbuilder:shape_card_quarry"},type:"itemStack"},{content:{amount:1L,item:"minecraft:diamond"},type:"itemStack"},{content:{amount:1L,item:"minecraft:redstone"},type:"itemStack"}],output:[{content:{amount:1L,item:"rftoolsbuilder:shape_card_quarry_fortune"},type:"itemStack"}]},{catalyst:[],input:[{content:{amount:4L,item:"minecraft:redstone"},type:"itemStack"},{content:{amount:1L,item:"minecraft:diamond_pickaxe",nbt:{Damage:0}},type:"itemStack"},{content:{amount:2L,item:"minecraft:iron_ingot"},type:"itemStack"},{content:{amount:1L,item:"rftoolsbuilder:shape_card_def"},type:"itemStack"},{content:{amount:1L,item:"minecraft:diamond_shovel",nbt:{Damage:0}},type:"itemStack"}],output:[{content:{amount:1L,item:"rftoolsbuilder:shape_card_quarry"},type:"itemStack"}]},{catalyst:[],input:[{content:{amount:4L,item:"minecraft:paper"},type:"itemStack"},{content:{amount:2L,item:"minecraft:bricks"},type:"itemStack"},{content:{amount:2L,item:"minecraft:redstone"},type:"itemStack"},{content:{amount:1L,item:"minecraft:iron_ingot"},type:"itemStack"}],output:[{content:{amount:1L,item:"rftoolsbuilder:shape_card_def"},type:"itemStack"}]},{catalyst:[],input:[{content:{amount:4L,item:"minecraft:brick"},type:"itemStack"}],output:[{content:{amount:1L,item:"minecraft:bricks"},type:"itemStack"}]},{catalyst:[],input:[{content:{amount:1L,item:"minecraft:clay_ball"},type:"itemStack"}],output:[{content:{amount:1L,item:"minecraft:brick"},type:"itemStack"}]},{catalyst:[],input:[{content:{amount:1L,item:"minecraft:diamond"},type:"itemStack"},{content:{amount:2L,name:"forge:rods/wooden"},type:"itemTag"}],output:[{content:{amount:1L,item:"minecraft:diamond_shovel",nbt:{Damage:0}},type:"itemStack"}]},{catalyst:[],input:[{content:{amount:3L,item:"minecraft:diamond"},type:"itemStack"},{content:{amount:2L,name:"forge:rods/wooden"},type:"itemTag"}],output:[{content:{amount:1L,item:"minecraft:diamond_pickaxe",nbt:{Damage:0}},type:"itemStack"}]},{catalyst:[],input:[{content:{amount:4L,item:"allthemodium:allthemodium_nugget"},type:"itemStack"},{content:{amount:1L,name:"forge:ender_pearls"},type:"itemTag"},{content:{amount:3L,item:"minecraft:redstone_block"},type:"itemStack"},{content:{amount:1L,item:"rftoolsbase:machine_frame"},type:"itemStack"}],output:[{content:{amount:1L,item:"rftoolsbuilder:builder"},type:"itemStack"}]},{catalyst:[],input:[{content:{amount:4L,item:"minecraft:iron_ingot"},type:"itemStack"},{content:{amount:2L,name:"forge:dyes/blue"},type:"itemTag"},{content:{amount:2L,item:"minecraft:gold_nugget"},type:"itemStack"}],output:[{content:{amount:1L,item:"rftoolsbase:machine_frame"},type:"itemStack"}]},{catalyst:[],input:[{content:{amount:1L,item:"minecraft:hopper"},type:"itemStack"},{content:{amount:2L,item:"minecraft:redstone"},type:"itemStack"},{content:{amount:1L,item:"minecraft:iron_ingot"},type:"itemStack"},{content:{amount:1L,item:"minecraft:paper"},type:"itemStack"}],output:[{content:{amount:1L,item:"rftoolsbase:filter_module"},type:"itemStack"}]},{catalyst:[],input:[{content:{amount:5L,item:"minecraft:iron_ingot"},type:"itemStack"},{content:{amount:1L,name:"forge:chests/wooden"},type:"itemTag"}],output:[{content:{amount:1L,item:"minecraft:hopper"},type:"itemStack"}]},{catalyst:[],input:[{content:{amount:8L,name:"minecraft:planks"},type:"itemTag"}],output:[{content:{amount:1L,name:"forge:chests/wooden"},type:"itemTag"}]}]}}
java.lang.RuntimeException: Trace
	at me.towdium.jecalculation.forge.JecaCapability$Provider.deserializeNBT(JecaCapability.java:91) ~[jecalculation-4.0.5.jar%23795!/:?]
	at me.towdium.jecalculation.forge.JecaCapability$Provider.deserializeNBT(JecaCapability.java:74) ~[jecalculation-4.0.5.jar%23795!/:?]
	at net.minecraftforge.common.capabilities.CapabilityDispatcher.deserializeNBT(CapabilityDispatcher.java:126) ~[forge-1.20.1-47.3.11-universal.jar%231013!/:?]
	at net.minecraftforge.common.capabilities.CapabilityProvider.deserializeCaps(CapabilityProvider.java:148) ~[forge-1.20.1-47.3.11-universal.jar%231013!/:?]
	at net.minecraft.world.entity.Entity.m_20258_(Entity.java:1739) ~[client-1.20.1-20230612.114412-srg.jar%231008!/:?]
	at net.minecraft.server.players.PlayerList.m_11224_(PlayerList.java:320) ~[client-1.20.1-20230612.114412-srg.jar%231008!/:?]
	at net.minecraft.server.players.PlayerList.m_11261_(PlayerList.java:157) ~[client-1.20.1-20230612.114412-srg.jar%231008!/:?]
	at net.minecraft.server.network.ServerLoginPacketListenerImpl.m_143699_(ServerLoginPacketListenerImpl.java:139) ~[client-1.20.1-20230612.114412-srg.jar%231008!/:?]
	at net.minecraft.server.network.ServerLoginPacketListenerImpl.m_10055_(ServerLoginPacketListenerImpl.java:126) ~[client-1.20.1-20230612.114412-srg.jar%231008!/:?]
	at net.minecraft.server.network.ServerLoginPacketListenerImpl.m_9933_(ServerLoginPacketListenerImpl.java:70) ~[client-1.20.1-20230612.114412-srg.jar%231008!/:?]
	at net.minecraft.network.Connection.m_129483_(Connection.java:263) ~[client-1.20.1-20230612.114412-srg.jar%231008!/:?]
	at net.minecraft.server.network.ServerConnectionListener.m_9721_(ServerConnectionListener.java:142) ~[client-1.20.1-20230612.114412-srg.jar%231008!/:?]
	at net.minecraft.server.MinecraftServer.m_5703_(MinecraftServer.java:907) ~[client-1.20.1-20230612.114412-srg.jar%231008!/:?]
	at net.minecraft.server.MinecraftServer.m_5705_(MinecraftServer.java:814) ~[client-1.20.1-20230612.114412-srg.jar%231008!/:?]
	at net.minecraft.client.server.IntegratedServer.m_5705_(IntegratedServer.java:89) ~[client-1.20.1-20230612.114412-srg.jar%231008!/:?]
	at net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:661) ~[client-1.20.1-20230612.114412-srg.jar%231008!/:?]
	at net.minecraft.server.MinecraftServer.m_206580_(MinecraftServer.java:251) ~[client-1.20.1-20230612.114412-srg.jar%231008!/:?]
	at java.lang.Thread.run(Thread.java:833) ~[?:?]

Looking at the <playerUUID>.dat file I can see that the entire recipes block has been wiped out:
Screenshot_1

I'm unsure whether the issue is the deserialization process that reads the recipes in the <playerUUID>.dat file into memory when the world launches, or if it's a problem with the serialization process that stores recipes from memory in the <playerUUID>.dat when the world closes. Still working on finding a way to reliably reproduce the issue.