Problems reading a Region (*.mca) file. Chunk size incorrect

Discussion in 'Plugin Development' started by Zomis, Aug 26, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    Zomis

    This is not for a plugin but rather a Minecraft tool, and as there was not much of a response to this on the Minecraft forums I figured I could try here instead. I hope someone knows how to deal with this.

    I started working on a Minecraft-tool recently (written in Java) and I'm nearly done, I encountered a problem which I am unsure of how to solve.

    The world I'm trying to read contains 720 regions, and there's 28 of them that I can't read properly with my tool. The cause of this is always the same.

    For example, in region file "r.-4.-40.mca" it starts reading a chunk at file position 897024, it reads five bytes which contains: 00 00 0F 6D 02.
    0F 6D translates into 3949 bytes. So it reads another 3948 bytes (to skip the compression info byte). But the thing is that then you end up at file position 900978 and there's more chunk info to read there! Why is that? Actually, from what I can see in a hexadecimal editor, there's 4116 more bytes to read! And after that comes 122 empty bytes before the next chunk starts.

    Can anyone explain to me how this works? Why does it say it's a chunk length of 3949 bytes when there's an additional 4116 bytes for the chunk?

    I have the example file, r.-4.-40.mca here: http://junk.zomis.net/minecraft/r.-4.-40.mca

    Any help appreciated.
     
Thread Status:
Not open for further replies.

Share This Page