Skip to content

Refactor in preparation for supporting POI and ENTITIES MCA files#68

Open
ens-gijs wants to merge 336 commits intoQuerz:masterfrom
ens-gijs:master
Open

Refactor in preparation for supporting POI and ENTITIES MCA files#68
ens-gijs wants to merge 336 commits intoQuerz:masterfrom
ens-gijs:master

Conversation

@ens-gijs
Copy link

@ens-gijs ens-gijs commented Nov 8, 2021

Love your library! I hope you can incorporate this large refactor which expands the mca API to improve ease of use and is a prerequisite for adding support for the new(ish) POI and ENTITES mca files. Also as I've started looking into the chunk data changes for 1.18... they look to be heading toward somewhat extensive and I'm willing to take on making the changes needed to support 1.18, but I'll be building in that support on top of my fork.

Let me know if you want to chat more, etc. Please perform your own integration testing as well as my changes add some fail-fast check to keep consumers from shooting themselves in the foot.

@coveralls
Copy link

coveralls commented Nov 9, 2021

Coverage Status

Coverage increased (+0.8%) to 78.493% when pulling 52fbb72 on ens-gijs:master into 04bad90 on Querz:master.

@Meeples10
Copy link

Any updates on this? MCAUtil.read currently throws an IllegalArgumentException when reading an MCA file without a Level tag, which neither the entities nor POI files have.

ens-gijs added 28 commits April 30, 2024 21:48
…lists so it is parseable by the SNBT parser - and it just looks better too.
…nbt view of the chunk data it has been given, and adding the TESTDBG path to .gitignore
…ntPointXYZ to its API, enhanced iterator to support filtered iteration
… detect palette corruption due to modification by the user provided filter.

 PalettizedCuboid::set - added overloads for filling a volume.
…dCuboid to get a better look at code coverage and filled gaps.

Reworked PalettizedCuboid.CursorIterator to always yield values by reference and to make a best-effort to detect palette corruption and detect palette modification made outside the iterator and throw ConcurrentModificationException.

Updated all PalettizedCuboid functions that take a Predicate and pass palette data (countIf, replaceIf) to check for concurrent modification and palette corruption.

Added minimumBitsPerIndex to PalettizedCuboid toCompoundTag and logic to make a good guess at what the value should be if one isn't provided (biome_states always use 4 bits per index - probably as a runtime optimization to avoid constantly resizing the palette).
…dCuboid to get a better look at code coverage and filled gaps.

Reworked PalettizedCuboid.CursorIterator to always yield values by reference and to make a best-effort to detect palette corruption and detect palette modification made outside the iterator and throw ConcurrentModificationException.

Updated all PalettizedCuboid functions that take a Predicate and pass palette data (countIf, replaceIf) to check for concurrent modification and palette corruption.

Added minimumBitsPerIndex to PalettizedCuboid toCompoundTag and logic to make a good guess at what the value should be if one isn't provided (biome_states always use 4 bits per index - probably as a runtime optimization to avoid constantly resizing the palette).

I think that wraps up PalettizedCuboid except for support for version LT JAVA_1_16_20W17A.
…dCuboid to get a better look at code coverage and filled gaps.

Reworked PalettizedCuboid.CursorIterator to always yield values by reference and to make a best-effort to detect palette corruption and detect palette modification made outside the iterator and throw ConcurrentModificationException.

Updated all PalettizedCuboid functions that take a Predicate and pass palette data (countIf, replaceIf) to check for concurrent modification and palette corruption.

Added minimumBitsPerIndex to PalettizedCuboid toCompoundTag and logic to make a good guess at what the value should be if one isn't provided (biome_states always use 4 bits per index - probably as a runtime optimization to avoid constantly resizing the palette).

I think that wraps up PalettizedCuboid except for support for version LT JAVA_1_16_20W17A.

fixed a couple javadoc syntax errors
…inline - time to rename things so they make more sense and generally are closer to how I like it!

Renamed namespace to avoid dependency conflicts in future consumers.

Also sneaking in a couple minor changes made along the way.
Update readme to re-add fork not ready for use warning,comment out package status badges for now, and update repo info to point to this github repo.
Took a polishing pass over binary and text nbt helper utility functions - added more overloads and organized things.

Made TextNbtParser implement NbtInput and therefore support NamedTag's.
…MCA region (terrain) now nearly all passing - just have to cover non-vanilla tags (aka paper) and figure out what's up with a wrong chunk section Y for a sample 1.20.4 subchunk.

Other changes
- block and biome stuff reworked (mostly removed / commented-out support for getting block and biome info for current data versions - will re-add later)
- Added DataVersion .next() and .previous()
- Added VersionLacksSupportException class and made use of it
- Made "sort compound tags by key" the default behavior for TextNbtHelpers toText* operations
- Added *Unsorted variants for TextNbtHelpers operations
- Added TextNbtParser::parseInline to make defining defaults in code easier than building a full tag part by part
- TextNbtSerializer now takes sortCompoundTagEntries in its constructor
…ys will now be ordered by insertion order (the order they were read in).
…ontaining less than 2 bytes of data.

made every write method in BinaryNbtHelpers return Path
…essionType param - they compute which CompressionType to use.
…NBT without full object overhead. Thi solution is solidly 5-6x faster than deserializing to Tag objects, sort and write to bin nbt
…s, lists, compound) to be placed on one-line to save a lot of vertical space in the result.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants