MinecraftModDevelopmentMods / Tesla-Core-Lib

Minecraft library useful in creating power hungry machines
https://minecraft.curseforge.com/projects/tesla-core-lib
MIT License
6 stars 8 forks source link

Stoneblock2: TeslaCoreLib chunk error leads to corrupt worlds. #62

Closed MirceaZisu closed 2 years ago

MirceaZisu commented 2 years ago

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.

faceofcat commented 2 years ago

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...

MirceaZisu commented 2 years ago

I wasn't sure entirely what the issue is, but an entire chunk was missing from the world, so I thought I should ask someone who might know better.

What my players had done was put too many molten metal cows in a single place and I guess overloaded the chunk? A single restart fixed it.

I'm sorry for not closing this ticket myself, I'm sending this reply via email. Thank you for your time.

On Wed, Dec 22, 2021, 11:08 Face of Cat @.***> wrote:

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...

— Reply to this email directly, view it on GitHub https://github.com/MinecraftModDevelopmentMods/Tesla-Core-Lib/issues/62#issuecomment-999449573, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOZQ6FLBSEYZL7F74XJOKVTUSGPR7ANCNFSM5KPAPCCQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.*** com>

faceofcat commented 2 years ago

ok :)