Closed underscoren closed 2 years ago
Thanks for this, without it I would have drop back to using an early version of Minecraft.
I had however missed the automatic removal of the minecraft: namespace from block names, that was a bit of a gotcha. I hadn't expected it in a PR that was adding support for a new version.
Yeah sorry about that, but it was just really bugging me lol. it just doesn't make sense in the context of a library that reads chunk data. Imo, you should hand off the handling of namespaces and the choice of whether or not to keep them to the application that is using the library rather than deciding to remove them before the user even sees them.
If this is somehow important functionality that I'm messing up, it can always be reverted though.
Yeah, I think it is best if the package doesn't remove it. So I don't really mind that it doesn't remove it as you said I can always do that myself.
After all it is intended to be a generic package rather than specifically a Minecraft world reader/writer.
If something did have names that didn't have any namespace, so more like a global namespace then stripping minecraft: would make them look he same as being in the global namespace.
@twoolie I'm currently not actively using the NBT library, and don't use the Minecraft-specific parts in chunk.py
. Given the conversation, I propose to merge the pull request as is. Unless you have another plan, I'll do so in a few days.
Since 1.16 (DataVersion 2566) block indexes are now packed with padding when the number of elements doesn't fit in exactly 64 bits (thank god someone at mojang finally realised the slight storage inefficiency was not worth the performance drop). I added support for reading this updated format, meaning all versions between 1.12.2 to 1.17.1 (and probably 1.18 when it comes out) should work.
In order to do so, I renamed the
_init_index
method inAnvilSection
to_init_index_unpadded
and made a new method_init_index_padded
for reading the new format.Total list of changes are as follows:
_init_index
to be more readable (this isn't code golf, there's no need for two-letter variable names)minecraft:
namespace from block names (doesn't work when reading modded chunks, also just doesn't make sense in this context)BlockStates
tag in the section before trying to parse the section (it seems like later DataVersions contain sections which only have lighting information)I only tested 1.15.2, 1.16, and 1.17.1 (and modded 1.16.5). From what I can find on various wikis there doesn't seem to be breaking changes between 1.12.2 and 1.15.2 in the format, but it would be a good idea to explicitly test all versions.