I've been trying to write some Java code to read .mca files, based on the information at http://wiki.vg/Map_Format and http://wiki.vg/User:Sprenger120 . I am at the point where I can read in the header correctly, and read the header for each section, telling me its compression mode and size. I am now trying to inflate the NBT blob that is the actual section, but it's not working at all. I just get "java.io.IOException: Not in GZIP format".

I'm starting the deflation stream five bytes into the memory segment specified by the header, and given that I am consistently getting sane section sizes and compression types, it seems like I'm managing to parse correctly up to this point, but now I'm stuck.

The code is at: https://github.com/Zarkonnen/Ager/tree/master/src/ager

I don't know if this is the correct forum to ask this kind of question - if it isn't, I apologise and would be very thankful if someone could direct me to a good place to ask it.

  • \$\begingroup\$ Your github link is a 404. You pasted a URL that actually has ... in it. \$\endgroup\$ – doppelgreener Apr 28 '12 at 22:30
  • \$\begingroup\$ So the 5th byte of the data header is a 1 for the file you are parsing? \$\endgroup\$ – Joshua Drake Apr 30 '12 at 15:16

OK, so the immediate answer to this turns out to be that JNBT internally tries to decompress the stream using GZIP, so I was decompressing it twice.

In the end, the better way of going about it was to use the code supplied by Mojang at http://www.mojang.com/2012/02/new-minecraft-map-format-anvil/ .

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.