12 Commits

Author SHA1 Message Date
Bjarne Koll
f0661c3514
#1230: Move unstructured PDC NBT serialisation to SNBT
The initial implementation of the CraftNBTTagConfigSerialiser attempted
to represent the entire NBT tree in yaml. While the tree structure
itself is nicely represented, the values and their respective types
become increasingly difficult to properly store in the context of
snakeyml/yml in general.

This is mainly due to the fact that nbt offers a lot of different types
compared to yaml, specifically the primitive arrays and different
floating point values are troublesome as they require parsing via mojang
parsers due to their custom format.

To build a future proof system for unstructured nbt in spigot yml,
this commit moves the entire serialisation fully into SNBT,
producing a single string as output rather than a full yml tree.
SNBT remains easily readable and editable for server owners, which was
one of the main criteria during the initial implementation of the
serialiser (preventing the use of bas64ed gzipped nbt bytes), while also
completely using mojangs parsing, eliminating any need for custom
parsing logic in spigot.

Additionally, a string allows for very straight forward handling of
legacy data by simply parsing strings as SNBT and maps/yml trees as
legacy content, depending on what type snakeyml produces after parsing
the yml content, removing the need for a versioning schema.
2023-09-24 10:12:19 +10:00
Doc
40945171bf
#1182: Consolidate Preconditions use and minor cleanup 2023-06-12 19:41:02 +10:00
Bjarne Koll
f49e9d1932
#971: Remove strong chunk reference in PDC
A previous fix for SPIGOT-6814 implemented a callback function for the
PDC implementation that could be set to actively define a chunk as
unsaved, allowing chunks that have not been mutated through block
changes to still require saving if the chunks pdc was mutated.

This implementation however would pass a callback that references the
chunk access internally, meaning the PDC now actively holds onto a
callback that holds a reference to the entire chunk.

Aditionally, this change also impacted the pdc for item metas and
entities for really no reason whatsoever.

This commit re-implements the fix by introducing a new child of the pdc
implementation that the chunk now uses as its pdc. This specific
implementation maintains a dirty flag that is set to `true` on any form
of mutation and set back to false by the chunk that owns the PDC
whenever the chunk itself is flag as no longer dirty.
2021-12-05 08:53:46 +11:00
DerFrZocker
04f8e7e21f
SPIGOT-6814: (Chunk) PersistentData is lost after restart 2021-11-29 09:28:19 +11:00
md_5
a7b8b0270a
Update to Minecraft 1.18-pre5 2021-11-22 09:00:00 +11:00
Wesley Smith
d49530f9c4
#845: Remove unnecessary calls to Class#getSimpleName in PDC 2021-05-21 08:25:11 +10:00
md_5
90d6905b15
Repackage NMS 2021-03-16 09:00:00 +11:00
Parker Hawke
c49b67ac91
#685: Implement support for PersistentDataContainer arrays 2020-06-26 10:49:28 +10:00
Parker Hawke
b900513035
#671: Implement PersistentDataContainer#getKeys() 2020-06-26 10:49:28 +10:00
md_5
ce66f6937b Misc checkstyle fixes 2020-04-14 12:34:43 +10:00
md_5
de42aa13f3 Update to Minecraft 1.15 2019-12-11 09:00:00 +11:00
Bjarne Koll
42f88f72b5 Replace ItemTag API with new API that also expands to Tiles and Entities 2019-04-25 14:42:39 +10:00