Commit Graph

19 Commits

Author SHA1 Message Date
cd59e272bc PHPStan 2.0 fixes 2025-01-07 22:10:42 +00:00
22718c4971 Add support for specialized flattenedProperties in schema format 2024-10-24 16:12:28 +01:00
be2437ac6e Support for flattening TAG_Byte and TAG_Int properties
this allows optimisation in upcoming versions.
2024-08-05 22:38:02 +01:00
16f29c775e tools/generate-blockstate-upgrade-schema: added support for generating newFlattenedName with value transforms
as seen in pmmp/BedrockBlockUpgradeSchema@ebd768e5b2, this enables use of newFlattenedName in more places (by allowing the flattened values to be transformed before building the new ID), as well as reducing the number of remappedStates in general by compacting stuff which was partially transformed like color silver -> light_gray.
2024-04-05 17:13:38 +01:00
db665fefdb Harden JsonMapper defaults in general 2024-02-23 14:10:24 +00:00
c165670e0a Added support for using and generating blockstate upgrade schemas using newFlattenedName rules
see pmmp/BedrockBlockUpgradeSchema@f426fccbee
2023-06-26 16:20:01 +01:00
29694c19af BlockStateUpgradeSchemaUtils: Use independent suffixes for each property mapping list 2023-05-01 14:46:30 +01:00
a1d44de487 Added support for compressing blockstate remaps using copiedState
this significantly reduces the size of schemas when state remaps are used (see pmmp/BedrockBlockUpgradeSchema@85b83b360e).

in addition, this will likely offer a substantial performance and memory saving when walls get flattened, which will eventually happen.
2023-04-28 20:35:37 +01:00
2121152b76 Fix CS 2023-04-28 20:03:53 +01:00
a1cd1d7433 ... 2023-04-28 19:35:03 +01:00
75410a5412 BlockStateUpgradeSchemaUtils: sort data before emitting JSON
this makes it easier to see what's changing, as well as making the order stable across multiple regenerations.
2023-04-28 19:31:00 +01:00
869c836e2d BlockStateUpgradeSchemaUtils: ensure that remapped values are generated in a consistent order
this uses lexical order, which isn't ideal for numeric values (1, 10, 2, etc), but it's good enough to ensure that the order is stable.
2023-04-28 17:12:52 +01:00
0818388bd5 Allow remapped oldState and newState to accept null, to make it easier for third-party tools to use the schemas
since PHP emits empty JSON objects as arrays, this makes it pretty annoying to work with the schemas in other languages. However, nullability is something most languages understand pretty easily.

This should continue to support old schemas.
2023-03-25 19:41:40 +00:00
0e15a8698a BlockStateUpgrader: do not use blockstate version to manage internal schemas
these are no longer reliable.
2023-02-01 22:35:59 +00:00
8fd4918429 Use Filesystem::fileGetContents() in more places 2022-12-25 18:26:53 +00:00
f88ae93897 BC break: Replaced webmozart/path-util with symfony/filesystem, closes #5332 2022-10-13 16:43:36 +01:00
ccb3c3cb05 BlockStateData: use array<Tag> instead of CompoundTag to store state properties
this reduces the footprint of RuntimeBlockMapping by a further 1 MB, as well as simplifying various parts of the code, and solidifying the immutability guarantee of BlockStateData.
2022-07-09 16:03:51 +01:00
4909c0f257 Fixed schema loading when the file path contains at least 4 numbers in a row
this spectactularly stupid bug could also have been addressed using a [^\/] in place of the . in the pattern, but I thought it made sense to make it impossible for this to happen again by making sure the regex only sees the file name.

fixes #5129
2022-07-04 22:15:50 +01:00
680615eed8 Namespace rename 2022-06-08 15:54:45 +01:00