Jump to content

Recommended Posts

Posted

When i was trying to create compressing tool for minecraft worlds and starts trying to extract chunks' NBT data I found that "padding to be a multiple of 4096B" which should be filled with zeroes is filled with some data. I found this data only in Forge world saves. Does Minecraft Forge save some data in region (.mca) files? If it is, what is this data is, like is this NBT or compressed NBT or other type of data?

 

Hope you will understand me.

Thanks in advance!

Posted (edited)
6 minutes ago, diesieben07 said:

The anvil chunk format supports block IDs up to 4095, this requires 12 bits per block. This is saved as a byte and an optional 4-bit nibble. The 4-bit nibble is never used by vanilla, because vanilla gets by with just 255 block IDs (and so only needs the byte). Forge uses this extra nibble to allow for block IDs up to 4095.

So 4-bit nibble's length is always 2048 bytes, right? And it placed just after main NBT data?

Edited by Olleggerr
Posted

That is great but i still have 758 bytes of unknown data in padding (excluding compressed NBT data, header, 4-bit nibble and 00 padding).

Do you have any idea of what is it?

Posted
Quote

Minecraft always pads the last chunk's data to be a multiple-of-4096B in length (so that the entire file has a size that is a multiple of 4KiB). Minecraft will not accept files in which the last chunk is not padded. Note that this padding is not included in the length field.

I am talking about this padding.

 

You described me 2048 bytes of additional data after compressed chunk's NBT data. But i still have data which meaning i cant understand. 758 bytes before 00 bytes of padding and after Nibble data.

Posted

Files are padded to 4KB to take advantage of how modern computers deal with files on disk. To help prevent fragmentation and to prevent disk thrashing. 

In the grand scheme of things you're talking a miniscule fraction of the file size. So there really isn't a need to change anything.

 

As for what Forge is doing, everything that Forge does is in the compressed data. So it sounds more to me that you're reading the entire format wrong. 

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted
2 hours ago, LexManos said:

Files are padded to 4KB to take advantage of how modern computers deal with files on disk. To help prevent fragmentation and to prevent disk thrashing. 

In the grand scheme of things you're talking a miniscule fraction of the file size. So there really isn't a need to change anything.

 

As for what Forge is doing, everything that Forge does is in the compressed data. So it sounds more to me that you're reading the entire format wrong. 

Here is mine example. And .mca file too.

Executable and region file: https://yadi.sk/d/wXBFG0M33LGxV2

Code: https://pastebin.com/ePMUhfhv

Posted

Ah, simple reasoning, if you look at the anvil save code, it doesn't re-zero chunks that get freed.

So thats left over chunk data from old chunks that existed in that slot.

So ya it may actually be worth it to go through and figure out what region files can be 'defragmented'

However I would suggest you do things CORRECTLY and actually go in and read the header info instead of just jumping around the file guessing.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.