GregTechCEu Modern

GregTechCEu Modern

6M Downloads

Bedrock fluid veins get cleared after saving world

FairySunny opened this issue ยท 0 comments

commented

Checked for existing issues

  • I have checked for existing issues, and have found none.

Tested latest version

  • I have checked that this occurs on the latest version.

GregTech CEu Version

1.3.1

Minecraft Version

1.20.1

Recipe Viewer Installed

JEI

Environment

Singleplayer

Cross-Mod Interaction

Yes

Other Installed Mods

Modpack: GregTech CEu Modern Community Pack

Expected Behavior

Bedrock fluid veins should not be cleared after saving world

Actual Behavior

Bedrock fluid veins get cleared after saving world (the 'vein' field is deleted in the nbt file)

Steps to Reproduce

(This bug only happens on some of my worlds.) Open a world, then close the world.

Additional Information

I tested on both the latest version on Github and the latest version on curseforge. This bug only happens on some of my worlds in the modpack 'GregTech CEu Modern Community Pack'.

I opened the world, first the GTRegistries.BEDROCK_FLUID_DEFINITIONS was initialized, then BedrockFluidVeinSavedData.veinFluids was initialized from NBT, then SPacketSyncFluidVeins.execute was called to initialize GTRegistries.BEDROCK_FLUID_DEFINITIONS again. When saving the world, BedrockFluidVeinSavedData.veinFluids contains BedrockFluidDefinition instances created during the first initialization, and GTRegistries.BEDROCK_FLUID_DEFINITIONS contains BedrockFluidDefinition instances created during the second initialization. This caused GTRegistries.BEDROCK_FLUID_DEFINITIONS.getKey returning null and clearing the field vein in the NBT file.

In some of my worlds, the SPacketSyncFluidVeins.execute was called before BedrockFluidVeinSavedData.veinFluids was initialized from NBT, so there is no bug in this case.