Tesla Core Lib

Tesla Core Lib

61M Downloads

Stoneblock2: TeslaCoreLib chunk error leads to corrupt worlds.

MirceaZisu opened this issue · 3 comments

commented

I am writing this on the behalf of some of my players as this has been bothering them for a few days. The console spams this every minute or so:

[01:28:12] [Server thread/ERROR] [FML]: A TileEntity type com.buuz135.industrial.tile.misc.FluidDictionaryConverterTile has throw an exception trying to write state. It will not persist. Report this to the mod author
java.lang.NullPointerException: Null string not allowed
        at java.util.Objects.requireNonNull(Objects.java:228) ~[?:1.8.0_212]
        at net.minecraft.nbt.NBTTagString.<init>(NBTTagString.java:19) ~[gm.class:?]
        at net.minecraft.nbt.NBTTagCompound.setString(NBTTagCompound.java:138) ~[fy.class:?]
        at net.minecraftforge.fluids.FluidStack.writeToNBT(FluidStack.java:107) ~[FluidStack.class:?]
        at net.minecraftforge.fluids.FluidTank.writeToNBT(FluidTank.java:77) ~[FluidTank.class:?]
        at net.ndrei.teslacorelib.inventory.FluidTank.serializeNBT(FluidTank.kt:13) ~[FluidTank.class:?]
        at net.ndrei.teslacorelib.inventory.FluidTank.serializeNBT(FluidTank.kt:8) ~[FluidTank.class:?]
        at net.ndrei.teslacorelib.inventory.FluidStorage.serializeNBT(FluidStorage.kt:158) ~[FluidStorage.class:?]
        at net.ndrei.teslacorelib.inventory.FluidStorage.serializeNBT(FluidStorage.kt:23) ~[FluidStorage.class:?]
        at net.ndrei.teslacorelib.tileentities.SyncTileEntity$registerSyncTagPart$2.get(SyncTileEntity.kt:233) ~[SyncTileEntity$registerSyncTagPart$2.class:?]
        at net.ndrei.teslacorelib.tileentities.SyncTileEntity$registerSyncTagPart$2.get(SyncTileEntity.kt:19) ~[SyncTileEntity$registerSyncTagPart$2.class:?]
        at net.ndrei.teslacorelib.tileentities.SyncTileEntity$makeWriter$1.invoke(SyncTileEntity.kt:204) ~[SyncTileEntity$makeWriter$1.class:?]
        at net.ndrei.teslacorelib.tileentities.SyncTileEntity$makeWriter$1.invoke(SyncTileEntity.kt:19) ~[SyncTileEntity$makeWriter$1.class:?]
        at net.ndrei.teslacorelib.tileentities.SyncTileEntity$writeSyncParts$1$1.accept(SyncTileEntity.kt:78) ~[SyncTileEntity$writeSyncParts$1$1.class:?]
        at net.ndrei.teslacorelib.tileentities.SyncTileEntity$writeSyncParts$1$1.accept(SyncTileEntity.kt:19) ~[SyncTileEntity$writeSyncParts$1$1.class:?]
        at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684) ~[?:1.8.0_212]
        at net.ndrei.teslacorelib.tileentities.SyncTileEntity.writeSyncParts(SyncTileEntity.kt:77) ~[SyncTileEntity.class:?]
        at net.ndrei.teslacorelib.tileentities.SyncTileEntity.writeToNBT(SyncTileEntity.kt:66) ~[SyncTileEntity.class:?]
        at com.buuz135.industrial.tile.misc.FluidDictionaryConverterTile.writeToNBT(FluidDictionaryConverterTile.java:129) ~[FluidDictionaryConverterTile.class:?]
        at net.minecraft.world.chunk.storage.AnvilChunkLoader.writeChunkToNBT(AnvilChunkLoader.java:383) [aye.class:?]
        at net.minecraft.world.chunk.storage.AnvilChunkLoader.saveChunk(AnvilChunkLoader.java:174) [aye.class:?]
        at net.minecraft.world.gen.ChunkProviderServer.saveChunkData(ChunkProviderServer.java:202) [on.class:?]
        at net.minecraft.world.gen.ChunkProviderServer.saveChunks(ChunkProviderServer.java:230) [on.class:?]
        at net.minecraft.world.WorldServer.saveAllChunks(WorldServer.java:1007) [oo.class:?]
        at net.minecraft.server.MinecraftServer.saveAllWorlds(MinecraftServer.java:408) [MinecraftServer.class:?]
        at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:691) [MinecraftServer.class:?]
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526) [MinecraftServer.class:?]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212]

Issue looks like this: https://media.discordapp.net/attachments/786597133821542440/922526323900022856/2021-12-21_03.29.58.png?width=1240&height=676

If this is in the wrong place, let me know.

commented

the problem there seems to be trying to serialize a fluid that is not registered... so FluidRegistry.getFluidName() returns null...

I could add a test around that I guess... but seems that the problem comes from somewhere else.

if you see here:

open class FluidTank(capacity: Int)
    : net.minecraftforge.fluids.FluidTank(capacity), ISerializableFluidTank {

    override fun serializeNBT(): NBTTagCompound {
        val nbt = NBTTagCompound()
        return super.writeToNBT(nbt)
    }

that's a straight call to forge's fluid tank...

commented
commented

ok :)