103 Commits

Author SHA1 Message Date
Dylan K. Taylor
becee92e7d
Reduce the size of ItemStackData when json-encoded
Many items need only the name, so we can just place the name directly in this case.
JsonMapper supports hydrating the object directly from the string using the pre-existing constructor for this.
2025-02-18 02:09:53 +00:00
Dries C
91ac64783f
Bedrock 1.21.60 (#6627)
Co-authored-by: Dylan K. Taylor <dktapps@pmmp.io>
2025-02-16 20:51:53 +00:00
Dylan K. Taylor
47cb04f6a6
tools: fix PHPStan 2.0 issues 2025-01-07 22:15:50 +00:00
Dylan K. Taylor
6a1d80e021
tools/convert-world: fixed some UI issues 2024-12-21 17:49:02 +00:00
Dylan K. Taylor
5325ecee37
Deal with a whole lot of PHPStan suppressed key casting errors
closes #6534
2024-11-25 14:30:58 +00:00
Dylan T.
9e19391f20
Merge branch 'minor-next' into blockstate-schema-generator-improvements 2024-11-03 14:06:57 +00:00
Dries C
4814db4fe7
Assemble 1.21.40 (#6471) 2024-10-25 14:21:51 +01:00
Dylan K. Taylor
d01203d7c4
Reduce code duplication 2024-10-24 18:50:39 +01:00
Dylan K. Taylor
22718c4971
Add support for specialized flattenedProperties in schema format 2024-10-24 16:12:28 +01:00
Dylan K. Taylor
acbfb0a3e9
Support for updating a batch of schemas using BlockPaletteArchive 2024-10-24 13:30:55 +01:00
Dylan K. Taylor
7f9e79c83e
Automatically test new schemas to ensure they produce the results predicted by the input file 2024-10-24 13:30:24 +01:00
Dylan K. Taylor
3ef7001d8e
Merge branch 'stable' into blockstate-schema-generator-improvements 2024-10-17 20:55:34 +01:00
Dylan K. Taylor
f1b1a7022d
and a sanity check just in case 2024-10-17 20:55:12 +01:00
Dylan K. Taylor
59d14de1d8
generate-blockstate-upgrade-schema: fallback to exact state match when encountering ambiguous filters
this popped up due to new changes in 1.20.40. Really we need to improve the way the filters are calculated, but this workaround solves the issue for now.
2024-10-17 20:51:17 +01:00
Dylan K. Taylor
c8f567b093
Fix missing arg count check 2024-10-17 20:24:57 +01:00
Dylan K. Taylor
33dc995cc7
blockstate-upgrade-schema-utils: added a command to update old schemas to a newer format
this is useful when the generator was updated with new features & optimisations, to reduce the size and/or improve readability of existing schemas.
2024-08-09 13:12:46 +01:00
Dylan K. Taylor
26761c2b87
Blockstate schema tool now supports testing schemas as well as generating them
this is useful when making changes to the generator, since regenerated schemas can now be tested for validity. This helps to find bugs in the generator.
2024-08-09 12:38:03 +01:00
IvanCraft623
2aa64dc15e
Simplify phpstan-doc type hint for better readability 2024-08-05 17:13:23 -05:00
Dylan K. Taylor
be2437ac6e
Support for flattening TAG_Byte and TAG_Int properties
this allows optimisation in upcoming versions.
2024-08-05 22:38:02 +01:00
Dylan K. Taylor
bdb5845cec
Allow name flattening rules where multiple old values map to the same new ID
this allows more compaction in certain cases, such as tallgrass recently.
instead of blacklisting any mapping which reuses the same flattened infix, we select the flatten property which produces the smallest number of distinct rules, which produces the most compact schema possible.
this change also permits potentially flattening other types of properties such as for corals (live/dead and type), although only one may be selected at a time.
2024-08-05 22:34:40 +01:00
Dylan K. Taylor
f121654452
Assemble 1.21.0 2024-06-13 18:41:41 +01:00
Dylan K. Taylor
6077748caa
Changes for 1.20.80 2024-04-25 11:31:41 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
efd113bdc8
Integrate pmmp/BedrockProtocol@65b3d0b341 2024-02-26 17:09:09 +00:00
Dylan K. Taylor
d211392b67
Merge remote-tracking branch 'origin/stable' into minor-next 2024-02-12 11:46:48 +00:00
Dylan K. Taylor
f54ed8362d
tools/convert-world: add a namespace
not sure why this was left in the global namespace to its own devices
2024-02-07 12:49:05 +00:00
Dylan K. Taylor
20837c9894
Merge remote-tracking branch 'origin/stable' into minor-next 2024-02-05 12:43:39 +00:00
Dylan K. Taylor
81d5b9ba06
tools/generate-bedrock-data-from-packets: add more exception detail for unexpected block runtimeIDs 2024-01-22 18:49:06 +00:00
Dylan K. Taylor
d97c8e2fd2
tools/generate-item-upgrade-schema: filter old IDs that were already renamed by previous schemas
this caused weird outputs if an item was renamed multiple times.
2024-01-22 18:48:32 +00:00
Dylan K. Taylor
c7c20d4d79
tools/generate-block-palette-spec: fixed sorting 2024-01-09 16:43:11 +00:00
Dylan K. Taylor
8ccaf907d1
tools/generate-blockstate-upgrade-schema: do not optimize state remaps with unchanged IDs
processRemappedStates() needs to know about the full set of states to generate reliable mappings.
Without it, it may generate flattening rules or state matching criteria that unintentionally match states that it's not aware of.
Sadly, this does make some schemas bigger, but it's for the best.
2023-11-08 15:19:02 +00:00
Dylan K. Taylor
c3bca9e172
tools/generate-bedrock-data-from-packets: fixed interpreting item metadata as blockstates when the item ID could be interpreted as a block ID
this broke crafting recipes which accepted skulls as inputs, as well as nether wart and bed recipes.
2023-09-27 12:37:26 +01:00
Dylan K. Taylor
540f088eda
tools/generate-bedrock-data-from-packets: make duplicate reporting less spammy 2023-09-01 20:51:45 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
882d50b14e
Reapply 470a3e1a3: tools/generate-blockstate-upgrade-schema: reduce dependencies for generating blockstate mappings 2023-06-26 16:09:51 +01:00
Dylan K. Taylor
0b0b72f596
Reapply b8788c55c: tools/generate-blockstate-upgrade-schema: improve property remapping checks
this is now able to determine which properties were renamed and/or changed when multiple renames occurred in a single version.
This also fixes unrelated properties being considered mapped to each other when there was only one property in the old and new state (e.g. mapped_type and deprecated for hay_bale in 1.10). Now, these are properly considered as unrelated.
2023-06-26 16:09:09 +01:00
Dylan K. Taylor
ff0199cdf8
Fixed blue candle being missing from the creative inventory
this coincidentally fixes mangrove doors being tagged with unwanted blockstate runtime IDs. Their items client-side are not actually blockitems, so the client doesn't expect them to have blockstate IDs attached.
This reduces the chaos in the creative inventory slightly (for some reason the client responds to this stuff by putting random creative items in the wrong places), but the mess is still substantial and I don't know what caused the rest of it.

closes #5818

technically we shouldn't be breaking BC of internals signatures in a patch release, but it's internals, and that's an unwritten rule anyway. In any case, no one is likely to be affected.
2023-06-13 18:03:10 +01:00
Dylan K. Taylor
ed021d193d
BlockTranslator: cut memory usage in half
this was achieved by storing binary representations of the blockstates, rather than the original BlockStateData.

Due to the insane object:data ratio of Tag objects (40:1 for ByteTag for example), modestly sized NBT can explode in memory footprint. This has been previously seen with the absurd 25 MB footprint on file load.
Previously, I attempted to mitigate this by deduplicating tag objects, but this was mitigating a symptom rather than addressing the cause.

We don't actually need to keep the NBT around in memory, since we don't actually use it for anything other than matching blockstates. In this case, we can allow the code to be possibly a little slower, since the lookup is anyway slow and the result will be cached.
In fact, using encoded ordered states as hash keys significantly improves the speed of lookups for stuff like walls, which have many thousands of states.

We keep around generateStateData(), since it's still possible we may need the BlockStateData associated, and it can be easily reconstructed from the binary-encoded representation in BlockStateDictionaryEntry.
2023-05-03 23:11:00 +01:00
Dylan K. Taylor
32e6fdd95a
Rename RuntimeBlockMapping -> BlockTranslator 2023-05-03 22:18:27 +01:00
Dylan K. Taylor
f29e2f7110
WorldProviders now accept Loggers 2023-05-02 15:41:11 +01:00
Dylan K. Taylor
728e0bc869
tools/generate-blockstate-upgrade-schema: allow multi-ID remaps to be processed as regular states if their ID didn't change
this allows remappedStates to only deal with stuff that has a different ID, which reduced the size of the 1.12 -> 1.13 schema quite nicely.
2023-04-28 20:58:18 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
a8dec1adb1
PM5-specific changes for 1.19.80 2023-04-26 23:30:56 +01:00
Dylan K. Taylor
769be8e140
Fix CSÂ 2023-04-20 00:18:32 +01:00
Dylan K. Taylor
c878bd8289
Merge remote-tracking branch 'origin/minor-next' into major-next 2023-04-20 00:18:19 +01:00
Dylan K. Taylor
4147d0dc75
tools/generate-blockstate-upgrade-schema: give better errors when a weird new blockstate version is found 2023-04-19 16:43:29 +01:00
Dylan K. Taylor
b5dc72b0ee
tools/simulate-chunk-selector: fixed the script being completely broken
getopt() behaviour is really, really dumb
2023-04-16 16:47:17 +01:00
Dylan K. Taylor
777b4d6ac3
PM5-specific updates for 1.19.70 2023-03-14 18:50:04 +00:00
Dylan K. Taylor
7c95a65ade
... 2023-03-08 23:14:11 +00:00
Dylan K. Taylor
2b88b215bf
CS cleanup 2023-03-08 23:10:11 +00:00