jmc2obj / j-mc-2-obj

Java-based Minecraft-to-OBJ exporter.
http://www.jmc2obj.net
349 stars 58 forks source link

getSectionBlocks ignores chunkVer? Minestom export issue #262

Closed AntonIXO closed 1 month ago

AntonIXO commented 1 month ago

Hello, Having issues with Minestom world exports after updating to 1.21 There is two worlds, 1.20 exports succesfully, 1.21 not. minestom.zip I added debug to investigate issue image Error:

Processing chunks...
Chunk DataVersion: 3953
old block format
new biome format
Chunk DataVersion: 3953
old block format
new biome format
Chunk DataVersion: 3953
Exception in thread "ReadThread-0" java.lang.ArrayIndexOutOfBoundsException: Index 15 out of bounds for length 2
        at org.jmc.Chunk$SectionBlocks.fillBlocks(Chunk.java:519)
        at org.jmc.Chunk.getSectionBlocks(Chunk.java:403)
        at org.jmc.Chunk.access$100(Chunk.java:29)
        at org.jmc.Chunk$BlocksSections$1.make(Chunk.java:213)
        at org.jmc.Chunk$BlocksSections$1.make(Chunk.java:210)
        at org.jmc.util.CachedGetter.get(CachedGetter.java:61)
        at org.jmc.Chunk$BlocksSections.getBlockData(Chunk.java:221)
        at org.jmc.threading.ThreadChunkDeligate.getBlockData(ThreadChunkDeligate.java:88)
        at org.jmc.threading.ChunkProcessor.process(ChunkProcessor.java:193)
        at org.jmc.threading.ReaderRunnable.exportChunk(ReaderRunnable.java:57)
        at org.jmc.threading.ReaderRunnable.run(ReaderRunnable.java:36)
        at java.base/java.lang.Thread.run(Thread.java:1583)

Code call fillBlocks instead fillBiomes ignoring DataVersion? But DataVersion value is ok and reads fine: image

mmdanggg2 commented 1 month ago

It's reading the version just fine and correctly calling both fillBlocks and fillBiomes. Your error here is because the data long array is only 64 elements long and not in the standard format which requres at minimum 256 elements. I think I see what they've done, they're trying to reduce the file size by removing the 4 bit palette index limit but that's not standard.

AntonIXO commented 1 month ago

So should I fix this in Minestom or you could add workaround for this?

mmdanggg2 commented 1 month ago

I'm not gonna work around that one I'm afraid. Minecraft won't even load those chunks, the 1.20 ones at least got loaded (albeit on top of eachother at 0,0 due to the missing x,z tags as I mentioned previously)