Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 257 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
257 commits
Select commit Hold shift + click to select a range
5ae0679
Leverage new DataVersions enum throughout existing code base.
invalid-email-address Nov 7, 2021
f279206
Fix for section Y consistency, always use chunk's section y value whe…
invalid-email-address Nov 8, 2021
aa453f8
remove SectionContainer debris (idea which i've abandoned for now)
invalid-email-address Nov 8, 2021
efb961f
Add ChunkIterator test
invalid-email-address Nov 8, 2021
1107e0f
Add NBTUtil#debugWrite to dump large NBT strings to file - more conve…
invalid-email-address Nov 8, 2021
22c280c
removed incorrect TODO
invalid-email-address Nov 8, 2021
f35005a
updating chunk biome javadoc and error messaging to be more clear
invalid-email-address Nov 8, 2021
33687bc
DataVersion added details about chunk data changes in 1.18 snapshot p…
invalid-email-address Nov 8, 2021
f7aeb65
Adding tests to cover chunk#putSection and other minor tweaks/cleanup…
invalid-email-address Nov 8, 2021
d002cbb
Adding demo of auto return typing which will be used for new MCAUtil#…
invalid-email-address Nov 9, 2021
0c6d33b
Fixing template args to extend ChunkBase instead of Chunk
invalid-email-address Nov 9, 2021
5171e0c
Fix test tmp dir cleanup to delete recursively
invalid-email-address Nov 10, 2021
3b624a0
Added CompoundTag#getListTagAutoCast to remove need to always cast re…
invalid-email-address Nov 10, 2021
52fbb72
Adding TagWrapper interface to indicate classes which expose their Co…
invalid-email-address Nov 10, 2021
efd2be8
Adding POI & ENTITIES mca skeleton classes
invalid-email-address Nov 9, 2021
ea50fcd
Updating MCAUtil readers to support auto typing of of the various mca…
invalid-email-address Nov 9, 2021
8837945
Adding basic test for MCAUtil.autoMCAFile
invalid-email-address Nov 9, 2021
d132ea4
Updating MCAUtil readers to support auto typing of of the various mca…
invalid-email-address Nov 9, 2021
7afb99d
Adding basic test for MCAUtil.autoMCAFile
invalid-email-address Nov 9, 2021
367f720
Updating .17.1 test mca files - added nether portal to captured chunk…
invalid-email-address Nov 10, 2021
42c93f1
MCAFileTest Strengthening setter tests, fixed typo in helper function…
invalid-email-address Nov 10, 2021
94c5791
Add POI_RECORDS to LoadFlags
invalid-email-address Nov 10, 2021
5e17a84
MCAUtil updated write methods to take MCAFileBase and exposed MCA_CRE…
invalid-email-address Nov 10, 2021
7d7307d
Refactoring REGION classes to make it easier for users to extend and …
invalid-email-address Nov 10, 2021
ede8497
Adding boilerplate code to ENTITIES mca classes
invalid-email-address Nov 10, 2021
c57dc30
deprecating Chunk(int lastMCAUpdate) constructors, default ctor behav…
invalid-email-address Nov 12, 2021
ef74058
adding default value getters for CompoundTag
invalid-email-address Nov 12, 2021
d6910dd
add test helper NBTTestCase#assertThrowsIllegalArgumentException
invalid-email-address Nov 12, 2021
39620cb
Adding chunk constructor Chunk(CompoundTag data, long loadFlags)
invalid-email-address Nov 12, 2021
c80235a
Adding Mutable utility class (currently only planned use is in tests)
invalid-email-address Nov 12, 2021
09ff5e7
PoiRecord - adding copy constructor and changing setters to builder p…
invalid-email-address Nov 12, 2021
9138a67
Finalized implementation of PoiChunk and added full test coverage
invalid-email-address Nov 12, 2021
4a9e7ec
DataVersion adding 1.18 PRE1
invalid-email-address Nov 12, 2021
1306ebd
Add integration test for reading & writing poi mca files for 1.17.1
invalid-email-address Nov 12, 2021
cd73912
added additional check to poi 1.17.1 test
invalid-email-address Nov 12, 2021
7e61a3e
Created the start of MCAFileBaseTest abstract test and updated PoiMCA…
invalid-email-address Nov 12, 2021
4d9bf68
Adding mca files from various MC versions for better integration testing
invalid-email-address Nov 12, 2021
8ea39c1
Add POI read/write parity tests for all supported versions
invalid-email-address Nov 12, 2021
7f2ca13
Updating notes about test data
invalid-email-address Nov 12, 2021
83e889c
Adding helpers to CompoundTag get/set FloatTagListAsArray and get/set…
invalid-email-address Nov 13, 2021
0b3b00a
Adding ArgValidator utility class.
invalid-email-address Nov 13, 2021
ceafc59
Reordering methods in TagWrapper interface so get comes before update
invalid-email-address Nov 13, 2021
6191a95
Adding EntityUtil (helpers for uuid tags and normalising yaw and pitc…
invalid-email-address Nov 13, 2021
34cb4c4
Adding IllegalEntityTagException class
invalid-email-address Nov 13, 2021
07d0485
Adding utility functions to CompoundTag putStringsAsTagList and getSt…
invalid-email-address Nov 13, 2021
3e77fc3
EntityUtil adding removeUuid and normalizeYaw(double) helpers & tests
invalid-email-address Nov 14, 2021
efa8dce
RegionChunkBase adding ability to read/write BIOME data from MCA file…
invalid-email-address Nov 14, 2021
3c6aa6d
Trivial doc / error message changes to PoiRecord
invalid-email-address Nov 14, 2021
4acc283
Add class javadoc for PoiChunkBase
invalid-email-address Nov 14, 2021
a80996b
Add copy constructor test for PoiRecord
invalid-email-address Nov 14, 2021
1e4b9b4
NBTTestCase - fix assertEquals argument order within assertThrowsExce…
invalid-email-address Nov 14, 2021
a2a2c3d
MCAFileBase - adding DataValue enum getter/setter helpers to manipula…
invalid-email-address Nov 14, 2021
a82c422
Adding utility classes for 2d rectangular bounding box logic - namely…
invalid-email-address Nov 14, 2021
e9b3d4b
Adding MCAUtil#blockAbsoluteToChunkRelative(int) and MCAUtil#blockAb…
invalid-email-address Nov 14, 2021
b113741
Adding BlockAlignedBoundingRectangleTest & ChunkBoundingRectangleTest
invalid-email-address Nov 14, 2021
613f937
Everything entities! Basic entity mca support complete & tested.
invalid-email-address Nov 14, 2021
35b8e5c
Adding stream support to NBT tags that make sense to have it.
invalid-email-address Nov 15, 2021
1d55350
DataVersion#isCrossedByTransition added
invalid-email-address Nov 19, 2021
5e730eb
Adding UnsupportedVersionChangeException
invalid-email-address Nov 19, 2021
2218f69
Adding DataVersion#throwUnsupportedVersionChangeIfCrossed
invalid-email-address Nov 19, 2021
45cceba
Add ListTag#isEmpty
invalid-email-address Nov 21, 2021
512db8a
Improving remaining assertThrows... helpers to include useful stack t…
invalid-email-address Nov 21, 2021
a2c9e71
Making a pass over javadoc's
invalid-email-address Nov 22, 2021
582b4b9
Adding Data Version information up to 1.18.1 and adding support for n…
invalid-email-address Dec 24, 2021
60c4ee7
Fixed doc lint errors (some of which don't make any sense - such as u…
invalid-email-address Dec 24, 2021
16d50a9
NBTTestCase - added message to assertThrowsException fail case
invalid-email-address Dec 25, 2021
7b7132a
Adding NBTPath - a utility to allow getting/setting nested tags witho…
invalid-email-address Dec 25, 2021
1d59096
Adding VersionAware - A simple utility class for managing data versio…
invalid-email-address Dec 25, 2021
bb931e4
NBTPath - adding javadocs to all methods
invalid-email-address Dec 26, 2021
6a76cd5
Fix old bug which would cause invalid mca files to be created if the …
invalid-email-address Dec 26, 2021
67f2782
making MCAFileBase#serialize require the RandomAccessFile argument
invalid-email-address Dec 26, 2021
611b846
Making CompoundTag#toString's output be sorted by key
invalid-email-address Dec 26, 2021
133758b
Fix links in README.md
HoldYourWaffle Aug 15, 2022
f599a17
Upgrading to Gradle 8.7
ens-gijs Mar 23, 2024
34809d9
Update NBTTestCase to allow spaces in the project path when locating …
ens-gijs Mar 23, 2024
7451550
Update NBTTestCase to allow spaces in the project path when locating …
ens-gijs Mar 23, 2024
6a4fee2
Adding a simple Json pretty printer utility.
ens-gijs Mar 23, 2024
6156304
Fully completed DataVersion enum list from 1.9.0 to 1.20.2, plus data…
ens-gijs Mar 23, 2024
f565d8a
bulk commit making sweeping changes - mca read/write for vanilla mc t…
ens-gijs Apr 16, 2024
4f11ea7
Adding PalettizedCuboid class to take on block/biome palette serializ…
ens-gijs Apr 16, 2024
c9b9b8f
Update readme
ens-gijs Apr 16, 2024
1378a4a
Moved some classes, fixed some javadoc syntax
ens-gijs Apr 16, 2024
057d5cb
Moved PalettizedCuboid into mca.util & made use of ArgValidator helpers.
ens-gijs Apr 16, 2024
4283d02
Expanding MCAUtil API to include passing Path objects
ens-gijs Apr 17, 2024
59269ac
Adjusting how JsonPrettyPrinter formats snbt byte/int/long typed tag …
ens-gijs Apr 17, 2024
c77e3a8
Adding IntPointXYZ class and modifying IntPointXZ to be aware of it.
ens-gijs Apr 17, 2024
165fa46
formatted class doc
ens-gijs Apr 17, 2024
6dba37e
Expanding SNBTUtil API to include pretty printing option and helpers …
ens-gijs Apr 17, 2024
0333b18
cleaning up MCAFileBaseTest validateReadWriteParity, which dumps an s…
ens-gijs Apr 17, 2024
ffe602e
taught NBTTestCase::deserializeFromFile how to read .snbt (text nbt) …
ens-gijs Apr 17, 2024
422a89f
Removed a temp test from TerrainMCAFileTest
ens-gijs Apr 17, 2024
556823d
bugfix for computing absolute chunk location when reading region data…
ens-gijs Apr 17, 2024
42ecad0
PalettizedCuboid bug fixes in fromCompoundTag logic, added usage of I…
ens-gijs Apr 17, 2024
c090844
Add IntPointXYZ::XYZ static creation shorthand helper.
ens-gijs Apr 18, 2024
87b3250
Enhanced PalettizedCuboid::countIf impl for a touch more speed and to…
ens-gijs Apr 18, 2024
bdb1135
Bracketed all, and multi-lined nearly all, IF statements in Palettize…
ens-gijs Apr 18, 2024
f6a3210
Bracketed all, and multi-lined nearly all, IF statements in Palettize…
ens-gijs Apr 18, 2024
11317e3
Bracketed all, and multi-lined nearly all, IF statements in Palettize…
ens-gijs Apr 18, 2024
33858df
Documented why the mca_palettes samples are each interesting.
ens-gijs Apr 18, 2024
9afc9d6
Tweaked javadocs on NBTPath after a read through
ens-gijs Apr 18, 2024
301b750
Give up on all pretext of ever merging this fork back into Querz's ma…
ens-gijs Apr 18, 2024
fbc34fd
Reset package version to 1.0
ens-gijs Apr 18, 2024
f6a367b
Continuing hard fork changes - focus area nbt data reading and writing.
ens-gijs Apr 18, 2024
f0deeee
Added unit tests for text nbt parser/writer changes - reading/writing…
ens-gijs Apr 18, 2024
92fc692
Terrain data refactoring started... read/write idempotency tests for …
ens-gijs Apr 19, 2024
21e7bba
Changing CompoundTag to use a LinkedHashMap to preserve key order. Ke…
ens-gijs Apr 19, 2024
ee8105b
bugfix in BinaryNbtHelpers::detectDecompression when reading a file c…
ens-gijs Apr 19, 2024
d1db8bc
adding NamedTag::getTagAutoCast
ens-gijs Apr 19, 2024
1430a60
TextNbtHelpers focused changes
ens-gijs Apr 19, 2024
17043a6
IntPointXZ adding accelerator constructor shortcut XZ, added toString…
ens-gijs Apr 21, 2024
504e3c6
Tons of changes - short version is java 1.9 through 1.20.4 are suppor…
ens-gijs Apr 21, 2024
8c65dda
adding 1.20.4 sampled mca test data
ens-gijs Apr 21, 2024
200afff
NbtPath - adding getters for byte/int/long arrays
ens-gijs Apr 21, 2024
c6dbe5e
Implementing moveChunk support for PoiChunks
ens-gijs Apr 21, 2024
7c7b661
Expanding EntityChunk's moveChunk support to function when working in…
ens-gijs Apr 21, 2024
63205d6
Teach IntPointXZ about long packing (added helpers to pack and unpack…
ens-gijs Apr 21, 2024
8cc674d
Fix javadoc @inheritDoc -> {@inheritDoc}
ens-gijs Apr 21, 2024
93ed5c6
checking in text_nbt_samples
ens-gijs Apr 21, 2024
e644c09
Adding a chunk with mineshaft "structure.start" info in it for 1.20.4
ens-gijs Apr 21, 2024
f7daa9a
Adding move chunk functionality to TerrainChunk's and basic moveRegio…
ens-gijs Apr 21, 2024
af065a9
Adding move chunk functionality to TerrainChunk's and basic moveRegio…
ens-gijs Apr 21, 2024
89f148b
TextNbtHelpers changes
ens-gijs Apr 27, 2024
5d37373
Moving CompressionType from mca to nbt namespace.
ens-gijs Apr 27, 2024
8708f95
CompressionType commented most used compression type
ens-gijs Apr 27, 2024
853021f
PoiChunkTest commented out System.out.println debugging line in test
ens-gijs Apr 27, 2024
2d9468a
McaFileBase#serialize added overloads taking CompressionType
ens-gijs Apr 27, 2024
b6bda2d
DataVersion Adding JAVA_1_20_5, JAVA_1_20_6_RC1
ens-gijs Apr 27, 2024
39b4941
Adding default constructors for all chunk types
ens-gijs Apr 28, 2024
44e8ff4
ChunkIterator - adding default impls for X Z functions/
ens-gijs Apr 28, 2024
02ee4df
CompressionType - javadoc - documenting when different compressions a…
ens-gijs Apr 28, 2024
6dfaa41
Changing default chunk compression strategy from GZIP to ZLIB per htt…
ens-gijs Apr 28, 2024
ab76717
PoiChunkBase - adding comment on poiSectionValidity copied from https…
ens-gijs Apr 28, 2024
50eedd1
TerrainChunkBase
ens-gijs Apr 28, 2024
97da3db
McaRegionFileTest - updating tests to pass mca timestamp, chunk x, ch…
ens-gijs Apr 28, 2024
a2afe82
adding class PositionTrackingInputStream
ens-gijs Apr 28, 2024
87ba0fc
adding class McaFileChunkIterator which can be used to iterate over t…
ens-gijs Apr 28, 2024
d7599b1
adding class McaFileStreamingWriter as a streaming chunk sink to writ…
ens-gijs Apr 28, 2024
06fa90b
Moving various files from .mca into .mca.io and .mca.util packages
ens-gijs Apr 28, 2024
b7c9341
Fixing Gradle build (fixing javadocs)
ens-gijs Apr 28, 2024
6c15cf0
Dropping Gradle project version from 1.0 to 0.1
ens-gijs Apr 28, 2024
2c08610
PositionTrackingInputStream bugfix contract of InputStream::skip allo…
ens-gijs Apr 28, 2024
741b24f
IntPointXZ and IntPointXYZ adding zero's consts and isZero method.
ens-gijs Apr 28, 2024
f4a1186
McaFileStreamingWriter
ens-gijs Apr 28, 2024
003decb
moveChunk bug fixes
ens-gijs Apr 28, 2024
132dba7
Adding MoveChunkFlags and propagating through the moveChunk methods.
ens-gijs Apr 28, 2024
2b6bfd8
Adding MoveChunkFlags and propagating through the moveChunk methods.
ens-gijs Apr 28, 2024
cbd7ac5
Adding RegionBoundingRectangle class
ens-gijs Apr 28, 2024
f4e6dbb
McaFileHelpers adding reateNameFromRegionLocation(IntPointXZ) overload
ens-gijs Apr 28, 2024
d65d787
McaFileChunkIterator changing read int (one byte at a time) EOF detec…
ens-gijs Apr 28, 2024
7207f88
Adding class RegionBoundingRectangle
ens-gijs Apr 28, 2024
bb80949
Adding BlockAlignedBoundingRectangle::constrain(int[]) to adjust boun…
ens-gijs Apr 28, 2024
08d2115
TerrainChunkBase moveChunk now supports moveChunkFlags
ens-gijs Apr 28, 2024
179de76
Adding class RegionFileRelocator and empty placeholder test (with com…
ens-gijs Apr 28, 2024
1102555
Adding a Stopwatch implementation.
ens-gijs Apr 29, 2024
c431ad2
Cleaning up McaFileChunkIteratorTest (removing system.out.print)
ens-gijs Apr 29, 2024
d616ed6
RegionFileRelocator - adding performance metrics (timing and counts)
ens-gijs Apr 29, 2024
79dd214
adding ScratchpadTest to .gitignore
ens-gijs Apr 29, 2024
81cfdf9
adding utility class McaDumper to dumpChunksAsTextNbt
ens-gijs Apr 29, 2024
e73c0b9
Making McaFileChunkIterator implement Closeable
ens-gijs Apr 30, 2024
e3a2f16
Adjusting all *BoundingRectangle impls to more specific about operati…
ens-gijs Apr 30, 2024
82d41ea
TextNbtSerializer::toString removed checked throws to clean up usage.…
ens-gijs Apr 30, 2024
cbb0572
Changing behavior of NameEvaluator::eval to return null when it encou…
ens-gijs Apr 30, 2024
a4622bc
NbtPath adding convenience put functions to put primitives (ints/long…
ens-gijs Apr 30, 2024
cc033ce
byte/int/long array tags - changing constructor to take `...` instead…
ens-gijs Apr 30, 2024
ffd16c5
NonNullEntrySet implementing remove function
ens-gijs Apr 30, 2024
1c480d5
CompoundTag minor javadoc improvements
ens-gijs Apr 30, 2024
ce367bf
EntityFactory adding static helper fromListTag for constructing a lis…
ens-gijs Apr 30, 2024
e2d10d2
NamedTag adding constructor overload taking Map.Entry<String, Tag<?>>
ens-gijs Apr 30, 2024
3874a1f
NbtTestCase added getNewTmpDirectory helper
ens-gijs Apr 30, 2024
6a4672d
Primarily adding tests for RegionFileRelocator.
ens-gijs Apr 30, 2024
34183b5
Create gradle-publish.yml
ens-gijs May 1, 2024
3efb68c
Chaning CompoundTag from implementing Iterable<Map.Entry<String, Tag<…
ens-gijs May 2, 2024
e8bb8df
ListTag now implements Collection
ens-gijs May 2, 2024
61bd916
readme bump
ens-gijs May 2, 2024
b1f9675
Adding ChunkBoundingRectangle.MAX_WORLD_BOARDER_BOUNDS and RegionBoun…
ens-gijs May 2, 2024
6bcd922
Adding AUTOMATICALLY_UPDATE_HANDLE MoveChunkFlag.
ens-gijs May 2, 2024
4330aa8
Make McaDumper write to r.X.Z instead of rX.Z
ens-gijs May 2, 2024
279fd78
Taking a pass over javadocs and doing some minor refactoring along th…
ens-gijs May 5, 2024
fce2a03
Switching namespace to io.github.ensgijs.nbt in preparation for publi…
ens-gijs May 5, 2024
d826c06
Updating readme javadoc links to point to io.github.ensgijs.nbt
ens-gijs May 5, 2024
41b6328
Updating build.gradle for namespace change to io.github.ensgijs and a…
ens-gijs May 5, 2024
bbaa2b1
Updating build.gradle package version to include -SNAPSHOT so local r…
ens-gijs May 5, 2024
c79a0c3
Fixing test namespace/paths
ens-gijs May 5, 2024
ba39a66
.gitignore ignore all ScratchpadTest files instead of some specific one
ens-gijs May 5, 2024
3d2d31d
McaFileChunkIterator - changing chunk header ingestion from reading o…
ens-gijs May 5, 2024
9e1ecbb
Migrating to java 17 - refactoring to take advantage of language leve…
ens-gijs May 5, 2024
14a745c
Adding toString to all 3 BoundingRectangle types.
ens-gijs May 5, 2024
dd4ee3a
McaFileStreamingWriter making the 4kb ZERO_FILL_BUFFER static
ens-gijs May 5, 2024
ad99b9e
Initial version of RandomAccessMcaFile - unit tests to come
ens-gijs May 5, 2024
3f1fee6
RandomAccessMcaFile
ens-gijs May 6, 2024
54dfc8e
LoadFlags add toHexString static helper
ens-gijs May 7, 2024
1fcf497
changed toString format for RegionBoundingRectangle, ChunkBoundingRec…
ens-gijs May 7, 2024
d98c1fb
Finished RandomAccessMcaFileTest - RandomAccessMcaFile is now fully t…
ens-gijs May 7, 2024
a37d3e0
Fixed javadoc syntax error in RandomAccessMcaFile
ens-gijs May 7, 2024
2835dfe
Add v 0.1-SNAPSHOT info and nbt/mca library highlights to README
ens-gijs May 7, 2024
6203ccb
DataVersion adding weekly build data versions for 1.20.3+ and a "test…
ens-gijs May 9, 2024
afe227c
DataVersion now fully complete up to 24w18a (post 1.20.6).
ens-gijs May 10, 2024
48a85d5
adding some comments on DataVersion & DataVersionTest around the data…
ens-gijs May 10, 2024
301e782
testFetchMissingDataVersionInformation move the cutoff for scanning f…
ens-gijs May 10, 2024
76f6931
TextNbtParser making missed parsing exceptions include context inform…
ens-gijs May 12, 2024
e277d19
Moving around string escaping logic to more appropriate locations. Al…
ens-gijs May 12, 2024
02dcdba
DataVersions adding weekly builds 24w19a & 24w19b
ens-gijs May 12, 2024
6cf80ee
McaFileChunkIterator - made reading empty (0 byte) files no longer th…
ens-gijs May 12, 2024
5345304
Added CompoundTag getOrCreateCompoundTag for improved usability
ens-gijs May 12, 2024
4fe4acf
DataVersion documented tag evolution through the versions. Also comme…
ens-gijs May 12, 2024
1c7db86
Updated terrain chunk logic to refine version support with findings o…
ens-gijs May 12, 2024
7b12e2d
Gradle config change - include javadocs and sources jars in the "publ…
ens-gijs May 12, 2024
8792758
javadoc format fix
ens-gijs May 12, 2024
434da20
RandomAccessMcaFile adding read-only mode & adding javadocs to all pu…
ens-gijs May 15, 2024
a39f40c
DataVersion - adding 24w20a
ens-gijs May 17, 2024
1097e10
Adding utility class LongArrayTagPackedIntegers, a comprehensive solu…
ens-gijs May 17, 2024
82c668e
LongArrayTagPackedIntegers fixing javadoc syntax
ens-gijs May 17, 2024
bda69be
Readme - adding a blurb about LongArrayTagPackedIntegers
ens-gijs May 17, 2024
6449ad9
LongArrayTagPackedIntegers
ens-gijs May 19, 2024
49b99e4
Changing interface TagWrapper to be templated rather than assuming al…
ens-gijs May 19, 2024
fac62cf
Making LongArrayTagPackedIntegers implement TagWrapper<LongArrayTag>.…
ens-gijs May 19, 2024
1616930
Implemented Comparable fully for all tag types.
ens-gijs May 20, 2024
8b1e612
Made ListTag implement List interface
ens-gijs May 20, 2024
c672616
Adding test for ListTag#subList and updating javadoc
ens-gijs May 21, 2024
2a59c4e
ListTag, removing inherits Collection<>, now that it inherits List<>
ens-gijs May 23, 2024
3d256a0
DataVersion adding version info for 24w21a & 24w21b
ens-gijs May 23, 2024
110f1fd
TerrainChunkBase making getStatus available when working with RAW data.
ens-gijs May 23, 2024
1a1e1f4
LongArrayTagPackedIntegers adding helpers allMatch and remap overload…
ens-gijs May 23, 2024
d36e76c
PalettizedCuboid
ens-gijs May 23, 2024
8716223
Readme - update info about PalettizedCuboid version support
ens-gijs May 24, 2024
8351947
LongArrayTagPackedIntegers.Builder - making .build() public... woops
ens-gijs May 25, 2024
53ad848
PalettizedCuboid adding setDataVersion method
ens-gijs May 25, 2024
f94461b
LongArrayTagPackedIntegers
ens-gijs May 25, 2024
1eadf31
CompoundTag adding `boolean containsKey(String key, Class<?> tagType)`
ens-gijs May 27, 2024
84c9f9d
PalettizedCuboid
ens-gijs May 27, 2024
7683ead
Terrain chunks - adding biome and block getters and setters using Pal…
ens-gijs May 29, 2024
ecc2459
TerrainChunkBase
ens-gijs May 30, 2024
26b506a
RandomAccessMcaFile - ensureFileInitialized bugfix, don't attempt to …
ens-gijs May 30, 2024
1962c2b
Add DataVersions up to JAVA_1_21_0_PRE2
ens-gijs Jun 2, 2024
2dba6ce
Add DataVersions up to JAVA_1_21_0
ens-gijs Jun 14, 2024
202ecbc
Add DataVersions up to JAVA_1_21_1
ens-gijs Aug 11, 2024
b851576
Add DataVersions up to 24w34a
ens-gijs Aug 24, 2024
84d89e0
Using Locale.ENGLISH for case conversions
ens-gijs Aug 24, 2024
2f665f4
Making bounding rects hashable. Adding static `of` helpers to all bou…
ens-gijs Aug 24, 2024
53ae073
Adjusting legacy biome version cutoff to be more specific - version w…
ens-gijs Aug 24, 2024
f431dbf
Adding isValidMcaFileName static helpers to McaFileHelpers
ens-gijs Aug 24, 2024
1fb5a03
Making RandomAccessMcaFile iterable (over ChunkBase type)
ens-gijs Aug 24, 2024
37c4dd0
Adding helper function accumulateChecksum for fingerprinting one or m…
ens-gijs Aug 24, 2024
6647af8
Put a TODO on RegionFileRelocator to document basic usage
ens-gijs Aug 24, 2024
e365c52
Adding class LegacyBiomes to provide int to/from string mapping for d…
ens-gijs Aug 24, 2024
e0cd7da
Adding class McaWorlds.
ens-gijs Aug 24, 2024
8ff1424
javadoc tweak
ens-gijs Sep 2, 2024
4dd6746
add data versions up to JAVA_1_21_2_24W35A
ens-gijs Sep 2, 2024
1a139b4
add helper getBlockNameAt
ens-gijs Sep 2, 2024
2e84fa7
corrected error in javadoc statement
ens-gijs Sep 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/gradle-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle

name: Gradle Package

on:
release:
types: [created]

jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file

- name: Setup Gradle
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0

- name: Build with Gradle
run: ./gradlew build

# The USERNAME and TOKEN need to correspond to the credentials environment variables used in
# the publishing section of your build.gradle
- name: Publish to GitHub Packages
run: ./gradlew publish
env:
USERNAME: ${{ github.actor }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,5 @@ doc/
out/

*.patch
TESTDBG/
ScratchpadTest.java
100 changes: 80 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,89 @@
# NBT
[![Build Status](https://travis-ci.org/Querz/NBT.svg?branch=master)](https://travis-ci.org/Querz/NBT) [![Coverage Status](https://img.shields.io/coveralls/github/Querz/NBT/master.svg)](https://coveralls.io/github/Querz/NBT?branch=master) [![Release](https://jitpack.io/v/Querz/NBT.svg)](https://jitpack.io/#Querz/NBT)
#### A java implementation of the [NBT protocol](http://minecraft.gamepedia.com/NBT_format) for Minecraft Java Edition.
<!-- [![Build Status](https://travis-ci.org/Querz/NBT.svg?branch=master)](https://travis-ci.org/Querz/NBT) [![Coverage Status](https://img.shields.io/coveralls/github/Querz/NBT/master.svg)](https://coveralls.io/github/Querz/NBT?branch=master) [![Release](https://jitpack.io/v/Querz/NBT.svg)](https://jitpack.io/#Querz/NBT) -->
A java implementation of the [NBT protocol](https://minecraft.gamepedia.com/NBT_format) for Minecraft Java Edition.

**!!! THIS FORK IS UNDER HEAVY DEVELOPMENT - May 2024!!!**

But, it is ready for early adopters!

This library includes a rich [NBT](https://minecraft.gamepedia.com/NBT_format) experience and powerful tools
for working with .mca files. The NBT portion is largely stable while the mca library is still going through heavy
iteration.

#### Highlights of the NBT library
* [NbtPath](src/main/java/io/github/ensgijs/nbt/query/NbtPath.java) Allows you to easily get and put nested tags.
* [TextNbtHelpers](src/main/java/io/github/ensgijs/nbt/io/TextNbtHelpers.java) Utilities for reading and writing text nbt data - with pretty printing! Yes, pretty printed text nbt data is also parseable.
* [BinaryNbtHelpers](src/main/java/io/github/ensgijs/nbt/io/BinaryNbtHelpers.java) Utilities for working with binary nbt files, compressed or uncompressed.

#### Highlights of the MCA library
* Version support from Minecraft Java 1.9.0 to 1.20.5 (no Bedrock support currently or planed at this time).
* [DataVersion](src/main/java/io/github/ensgijs/nbt/mca/DataVersion.java) nearly complete data version to minecraft version mapping and detection back to 1.9.0.
* Rich javadocs on most classes and methods.
* Excellent code coverage and extensive unit testing as well as integration testing for multiple Minecraft versions see [test resources](src/test/resources)
* _There's always room for improvement of the richness of integration data samples - some of the samples are a little less interesting than I would prefer._
* Supports editing of non-vanilla world files without data loss.
* Support for terrain (region), entities, and poi mca files - the various chunk class types are due for a heavy refactor, and I plan to add an abstraction layer to wrap all 3 mca/chunk types to provide a more seamless processing / editing experience.
* Safely relocate (move) chunks - all chunk implementations fully support being moved to a new location. All contents are updated to exist in the new chunk location. This feature is the primary reason I dusted off this project after 3 years and is well tested and very ready for consumption.
* [RegionFileRelocator](src/main/java/io/github/ensgijs/nbt/mca/io/RegionFileRelocator.java) relocate entire region files.
* Multiple options for reading and writing chunk data to .mca files using one of the following classes.
* [RandomAccessMcaFile](src/main/java/io/github/ensgijs/nbt/mca/io/RandomAccessMcaFile.java) read and write chunks with minimal memory overhead.
* [McaFileChunkIterator](src/main/java/io/github/ensgijs/nbt/mca/io/McaFileChunkIterator.java) iterate through the chunks in an mca file one after the other, again keeping memory overhead down.
* [McaFileStreamingWriter](src/main/java/io/github/ensgijs/nbt/mca/io/McaFileStreamingWriter.java) write an entire mca file one chunk at a time.

#### Powerful Utilities
* [LongArrayTagPackedIntegers](src/main/java/io/github/ensgijs/nbt/mca/util/LongArrayTagPackedIntegers.java) a comprehensive solution to working with all long[] packed values (block palettes, biome palettes, Heightmaps) across all DataVersions.
* [PalettizedCuboid](src/main/java/io/github/ensgijs/nbt/mca/util/PalettizedCuboid.java) powerful class for working with block and biome palettes. This class supports all MC versions that use data palettes; I may add block and biome child classes to improve usability in the future.

#### How to get started with 0.1-SNAPSHOT
This package is not yet published to a public repository - but using it from a local build is easy!

Download the source, open the project in your IDE of choice (Intellij, etc), run the gradle rule
`gradle publishToMavenLocal` to build the source and stash the 0.1-SNAPSHOT in your local maven cache.

Gradle:
```
dependencies {
...
implementation 'io.github.ensgijs:ens-nbt:0.1-SNAPSHOT'
}
```

Maven:
```
<dependency>
<groupId>io.github.ensgijs</groupId>
<artifactId>ens-nbt</artifactId>
<version>0.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
```


---
### Specification
### NBT Specification
According to the [specification](https://minecraft.gamepedia.com/NBT_format), there are currently 13 different types of tags:

| Tag class | Superclass | ID | Payload |
| --------- | ---------- | -- | ----------- |
| [EndTag](src/main/java/net/querz/nbt/EndTag.java) | [Tag](src/main/java/net/querz/nbt/Tag.java) | 0 | None |
| [ByteTag](src/main/java/net/querz/nbt/ByteTag.java) | [NumberTag](src/main/java/net/querz/nbt/NumberTag.java) | 1 | 1 byte / 8 bits, signed |
| [ShortTag](src/main/java/net/querz/nbt/ShortTag.java) | [NumberTag](src/main/java/net/querz/nbt/NumberTag.java) | 2 | 2 bytes / 16 bits, signed, big endian |
| [IntTag](src/main/java/net/querz/nbt/IntTag.java) | [NumberTag](src/main/java/net/querz/nbt/NumberTag.java) | 3 | 4 bytes / 32 bits, signed, big endian |
| [LongTag](src/main/java/net/querz/nbt/LongTag.java) | [NumberTag](src/main/java/net/querz/nbt/NumberTag.java) | 4 | 8 bytes / 64 bits, signed, big endian |
| [FloatTag](src/main/java/net/querz/nbt/FloatTag.java) | [NumberTag](src/main/java/net/querz/nbt/NumberTag.java) | 5 | 4 bytes / 32 bits, signed, big endian, IEEE 754-2008, binary32 |
| [DoubleTag](src/main/java/net/querz/nbt/DoubleTag.java) | [NumberTag](src/main/java/net/querz/nbt/NumberTag.java) | 6 | 8 bytes / 64 bits, signed, big endian, IEEE 754-2008, binary64 |
| [ByteArrayTag](src/main/java/net/querz/nbt/ByteArrayTag.java) | [ArrayTag](src/main/java/net/querz/nbt/ArrayTag.java) | 7 | `IntTag` payload *size*, then *size* `ByteTag` payloads |
| [StringTag](src/main/java/net/querz/nbt/StringTag.java) | [Tag](src/main/java/net/querz/nbt/Tag.java) | 8 | `ShortTag` payload *length*, then a UTF-8 string with size *length* |
| [ListTag](src/main/java/net/querz/nbt/ListTag.java) | [Tag](src/main/java/net/querz/nbt/Tag.java) | 9 | `ByteTag` payload *tagId*, then `IntTag` payload *size*, then *size* tags' payloads, all of type *tagId* |
| [CompoundTag](src/main/java/net/querz/nbt/CompoundTag.java) | [Tag](src/main/java/net/querz/nbt/Tag.java) | 10 | Fully formed tags, followed by an `EndTag` |
| [IntArrayTag](src/main/java/net/querz/nbt/IntArrayTag.java) | [ArrayTag](src/main/java/net/querz/nbt/ArrayTag.java) | 11 | `IntTag` payload *size*, then *size* `IntTag` payloads |
| [LongArrayTag](src/main/java/net/querz/nbt/LongArrayTag.java) | [ArrayTag](src/main/java/net/querz/nbt/ArrayTag.java) | 12 | `IntTag` payload *size*, then *size* `LongTag` payloads |
| [EndTag](src/main/java/io/github/ensgijs/nbt/tag/EndTag.java) | [Tag](src/main/java/io/github/ensgijs/nbt/tag/Tag.java) | 0 | None |
| [ByteTag](src/main/java/io/github/ensgijs/nbt/tag/ByteTag.java) | [NumberTag](src/main/java/io/github/ensgijs/nbt/tag/NumberTag.java) | 1 | 1 byte / 8 bits, signed |
| [ShortTag](src/main/java/io/github/ensgijs/nbt/tag/ShortTag.java) | [NumberTag](src/main/java/io/github/ensgijs/nbt/tag/NumberTag.java) | 2 | 2 bytes / 16 bits, signed, big endian |
| [IntTag](src/main/java/io/github/ensgijs/nbt/tag/IntTag.java) | [NumberTag](src/main/java/io/github/ensgijs/nbt/tag/NumberTag.java) | 3 | 4 bytes / 32 bits, signed, big endian |
| [LongTag](src/main/java/io/github/ensgijs/nbt/tag/LongTag.java) | [NumberTag](src/main/java/io/github/ensgijs/nbt/tag/NumberTag.java) | 4 | 8 bytes / 64 bits, signed, big endian |
| [FloatTag](src/main/java/io/github/ensgijs/nbt/tag/FloatTag.java) | [NumberTag](src/main/java/io/github/ensgijs/nbt/tag/NumberTag.java) | 5 | 4 bytes / 32 bits, signed, big endian, IEEE 754-2008, binary32 |
| [DoubleTag](src/main/java/io/github/ensgijs/nbt/tag/DoubleTag.java) | [NumberTag](src/main/java/io/github/ensgijs/nbt/tag/NumberTag.java) | 6 | 8 bytes / 64 bits, signed, big endian, IEEE 754-2008, binary64 |
| [ByteArrayTag](src/main/java/io/github/ensgijs/nbt/tag/ByteArrayTag.java) | [ArrayTag](src/main/java/io/github/ensgijs/nbt/tag/ArrayTag.java) | 7 | `IntTag` payload *size*, then *size* `ByteTag` payloads |
| [StringTag](src/main/java/io/github/ensgijs/nbt/tag/StringTag.java) | [Tag](src/main/java/io/github/ensgijs/nbt/tag/Tag.java) | 8 | `ShortTag` payload *length*, then a UTF-8 string with size *length* |
| [ListTag](src/main/java/io/github/ensgijs/nbt/tag/ListTag.java) | [Tag](src/main/java/io/github/ensgijs/nbt/tag/Tag.java) | 9 | `ByteTag` payload *tagId*, then `IntTag` payload *size*, then *size* tags' payloads, all of type *tagId* |
| [CompoundTag](src/main/java/io/github/ensgijs/nbt/tag/CompoundTag.java) | [Tag](src/main/java/io/github/ensgijs/nbt/tag/Tag.java) | 10 | Fully formed tags, followed by an `EndTag` |
| [IntArrayTag](src/main/java/io/github/ensgijs/nbt/tag/IntArrayTag.java) | [ArrayTag](src/main/java/io/github/ensgijs/nbt/tag/ArrayTag.java) | 11 | `IntTag` payload *size*, then *size* `IntTag` payloads |
| [LongArrayTag](src/main/java/io/github/ensgijs/nbt/tag/LongArrayTag.java) | [ArrayTag](src/main/java/io/github/ensgijs/nbt/tag/ArrayTag.java) | 12 | `IntTag` payload *size*, then *size* `LongTag` payloads |

* The `EndTag` is only used to mark the end of a `CompoundTag` in its serialized state or an empty `ListTag`.

* The maximum depth of the NBT structure is 512. If the depth exceeds this restriction during serialization, deserialization or String conversion, a `MaxDepthReachedException` is thrown. This usually happens when a circular reference exists in the NBT structure. The NBT specification does not allow circular references, as there is no tag to represent this.

<!--
### Add the library as a dependency using Gradle:
Add Jitpack to your `repositories`:
```
Expand All @@ -37,7 +96,7 @@ And then add it as a dependency as usual:
```
dependencies {
...
implementation 'com.github.Querz:NBT:6.1'
implementation 'com.github.ens-gijs:NBT:1.0'
}
```

Expand All @@ -54,9 +113,9 @@ Add Jitpack:
Dependency:
```
<dependency>
<groupId>com.github.Querz</groupId>
<groupId>com.github.ens-gijs</groupId>
<artifactId>NBT</artifactId>
<version>6.1</version>
<version>1.0</version>
</dependency>
```

Expand All @@ -83,7 +142,7 @@ All methods serializing instances or deserializing data track the nesting levels

These methods have a parameter for the maximum nesting depth they are allowed to traverse. A value of `0` means that only the object itself, but no nested object may be processed.

If an instance is nested further than allowed, a [MaxDepthReachedException](src/main/java/net/querz/nbt/MaxDepthReachedException.java) will be thrown. A negative maximum depth will cause an `IllegalArgumentException`.
If an instance is nested further than allowed, a [MaxDepthReachedException](src/main/java/io/github/ensgijs/io/MaxDepthReachedException.java) will be thrown. A negative maximum depth will cause an `IllegalArgumentException`.

Some methods do not provide a parameter to specify the maximum depth, but instead use `Tag.DEFAULT_MAX_DEPTH` (`512`) which is also the maximum used in Minecraft.

Expand Down Expand Up @@ -150,3 +209,4 @@ mcaFile.cleanupPalettesAndBlockStates();
chunk.cleanupPalettesAndBlockStates();
section.cleanupPaletteAndBlockStates();
```
-->
58 changes: 43 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,56 +1,84 @@
plugins {
id 'com.github.kt3k.coveralls' version '2.4.0'
id 'maven'
id 'maven-publish'
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'jacoco'

group = 'net.querz.nbt'
archivesBaseName = 'nbt'
version = '6.1'
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
group = 'io.github.ensgijs'
archivesBaseName = 'ens-nbt'
version = '0.1-SNAPSHOT'
sourceCompatibility = JavaLanguageVersion.of(17)
targetCompatibility = JavaLanguageVersion.of(17)
compileJava.options.encoding = 'UTF-8'
compileTestJava.options.encoding = 'UTF-8'

repositories {
jcenter()
mavenCentral()
}

publishing {
repositories {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/octocat/hello-world"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
publications {
maven(MavenPublication) {
groupId = System.getenv("group")
artifactId = 'ens-nbt'
version = System.getenv("version")

from components.java
}
}
}

dependencies {
testCompile 'junit:junit:4.12'
testImplementation 'junit:junit:4.13.2'
}

javadoc {
source = sourceSets.main.allJava
classpath = configurations.compile
destinationDir = file("./doc/")
options.windowTitle 'NBT'
include 'io/github/ensgijs/nbt/**'
options.windowTitle 'NBT (ENS)'
options.encoding 'UTF-8'
options.linkSource true
options.links 'https://docs.oracle.com/javase/8/docs/api/'
options.links 'https://docs.oracle.com/javase/17/docs/api/'
}

task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
archiveClassifier = 'sources'
from sourceSets.main.allSource
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}

jacocoTestReport {
reports {
xml.enabled = true
html.enabled = true
xml.required = true
html.required = true
}
}

artifacts {
archives sourcesJar
archives javadocJar
}

java {
withJavadocJar()
withSourcesJar()
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading