Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been trying to write some Java code to read .mca files, based on the information at and . 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 " 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:

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.

share|improve this question
Your github link is a 404. You pasted a URL that actually has ... in it. – doppelgreener Apr 28 '12 at 22:30
Gah! @Harry Stern: Thanks for fixing that! – Zarkonnen Apr 29 '12 at 7:06
So the 5th byte of the data header is a 1 for the file you are parsing? – Joshua Drake Apr 30 '12 at 15:16
up vote 0 down vote accepted

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 .

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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