Commit Graph

70 Commits

Author SHA1 Message Date
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
882d50b14e Reapply 470a3e1a3: tools/generate-blockstate-upgrade-schema: reduce dependencies for generating blockstate mappings 2023-06-26 16:09:51 +01:00
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
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
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
32e6fdd95a Rename RuntimeBlockMapping -> BlockTranslator 2023-05-03 22:18:27 +01:00
f29e2f7110 WorldProviders now accept Loggers 2023-05-02 15:41:11 +01:00
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
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
a8dec1adb1 PM5-specific changes for 1.19.80 2023-04-26 23:30:56 +01:00
769be8e140 Fix CSÂ 2023-04-20 00:18:32 +01:00
c878bd8289 Merge remote-tracking branch 'origin/minor-next' into major-next 2023-04-20 00:18:19 +01:00
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
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
777b4d6ac3 PM5-specific updates for 1.19.70 2023-03-14 18:50:04 +00:00
7c95a65ade ... 2023-03-08 23:14:11 +00:00
2b88b215bf CS cleanup 2023-03-08 23:10:11 +00:00
54c19fd662 Open-source script that generates recipes and other goodies for BedrockData
this script has been lurking in my workspace for years, waiting to be cleaned up and open-sourced.
2023-03-08 23:04:09 +00:00
2da9b76452 Added translatable descriptions for permissions 2022-12-27 20:29:38 +00:00
8fd4918429 Use Filesystem::fileGetContents() in more places 2022-12-25 18:26:53 +00:00
4d79aced07 Merge branch 'next-minor' into next-major 2022-12-15 19:50:27 +00:00
31465525e3 Fixed PHP-CS-Fixer not import global constants. (#5449) 2022-12-12 17:12:33 +00:00
142ccc7e87 Merge branch 'next-minor' into next-major 2022-12-05 14:14:39 +00:00
43bc3c7b25 Added tool to dump JSON contents of encoded crashdump data 2022-12-01 19:36:31 +00:00
7bcc663b60 Migrate core code to using symfony/filesystem
webmozart/path-util is retained for plugin compatibility, but is dropped in 5.0
2022-10-14 21:51:29 +01:00
f88ae93897 BC break: Replaced webmozart/path-util with symfony/filesystem, closes #5332 2022-10-13 16:43:36 +01:00
43a3151de3 Merge branch 'next-minor' into next-major 2022-08-14 18:49:19 +01:00
15586ed80e Fix CS 2022-08-12 21:09:15 +01:00
0f8ad8ecf7 Update permission doc output format 2022-08-12 20:47:38 +01:00
82b9afef77 Allow generating RST permission summaries, to be used on doc.pmmp.io 2022-08-12 18:00:52 +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
a8728a02f6 BlockStateDictionary: extract a more generic helper method for decoding block palette files 2022-07-06 14:37:46 +01:00
dc8f65c0dd Remove unnecessary BlockStateDictionary usages 2022-07-06 14:33:27 +01:00
227a481473 generate-block-palette-spec: include blocks with no properties 2022-07-03 02:01:28 +01:00
7994da07be Crafting recipe network serialization no longer depends on PM's internal legacy metadata
WOOOOOOOOOOOOOOOOOOOOOOHOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO!!!!!!!!!!!!!!!!!!!!!
2022-07-02 16:37:43 +01:00
680615eed8 Namespace rename 2022-06-08 15:54:45 +01:00
e78f20391e seriously? ... 2022-06-08 14:21:57 +01:00
0a22e4606d Wow, I'm really getting sloppy... 2022-06-08 13:51:15 +01:00
cf7d42b3ea Fix CS according to new rules 2022-06-07 20:02:24 +01:00
1ff69136a3 Merge branch 'next-major' into modern-world-support 2022-06-07 20:01:40 +01:00
1f8009954c Fix PHPStan errors 2022-06-07 19:52:16 +01:00
3a9e4bc357 Fix CS 2022-06-07 19:40:00 +01:00
3ce1be2a23 Added script to generate incremental item upgrade schemas 2022-06-07 19:39:06 +01:00
fe4ff3325b Add tool to dump JSON specification for block palettes
this makes for easier reading to determine available properties.
2022-06-07 19:05:49 +01:00
38d6284671 Use PHP-CS-Fixer to enforce file header presence 2022-06-04 17:34:49 +01:00
2f2ffe0aa4 fix phpstan 2022-05-13 21:03:49 +01:00
45150f1a52 fix CS 2022-02-10 13:47:20 +00:00
0f07b2499c Added blockstate upgrade schema generator 2022-02-10 13:45:39 +00:00
4d55935bd8 Replace disallowed operators in tools/ 2022-01-20 16:48:06 +00:00
7a385ddc8b simulate-chunk-selector: remove unused colour allocation 2021-12-08 20:04:03 +00:00