Commit Graph

388 Commits

Author SHA1 Message Date
Dylan K. Taylor
5afeeb8f89 Remove nonsensical code from block and item serializers
At the time when I wrote this code, I was still in the head space of the kind of ID hijacking that PM4 plugins do to override built-in blocks.

However, this kind of internal ID reuse makes no sense in PM5, since said IDs are only used in the core itself at runtime to identify types and states.

Even if we were to allow overriding block deserializers, overriding serializers makes no sense whatsoever, since the original block would continue to exist and be accessible.
There is a case to be made to allow overriding the deserializer, but not for the serializer.
2023-05-20 18:55:36 +01:00
Dylan K. Taylor
9621836e36 Clean up confusing mess around block and item overriding
right now, I don't see an obvious reason to do this. If it turns out I was wrong later on, we can add functionality back, but we can't remove functionality after release.
2023-05-17 15:21:49 +01:00
IvanCraft623
30f1d3e016 Fix code style (#5740) 2023-05-10 13:41:25 +01:00
Dylan K. Taylor
7b1a1e5a18 BlockStateToObjectDeserializer: remove redundant helper 2023-05-08 22:16:55 +01:00
Dylan K. Taylor
1b452f3a88 BlockStateToObjectDeserializer: make flat colour block handling less repetetive 2023-05-08 21:38:58 +01:00
ipad54
fa719f37d5 Implement Cave Vines & Glow Berries (#5424) 2023-05-08 19:24:23 +01:00
Dylan K. Taylor
6f0eb019d2 ItemIdMetaUpgrader: added some auxiliary methods 2023-05-07 19:28:07 +01:00
Dylan K. Taylor
299ff5d912 Register mangrove boat item 2023-05-04 16:39:23 +01:00
Dylan K. Taylor
6beb80b8fe Fixed usages of BlockDataUpgrader which weren't accounting for thrown exceptions 2023-05-02 17:13:31 +01:00
Dylan K. Taylor
5fcf5e0c40 LevelDB: log more stuff, stop bailing on recoverable errors 2023-05-02 16:46:45 +01:00
Dylan K. Taylor
29694c19af BlockStateUpgradeSchemaUtils: Use independent suffixes for each property mapping list 2023-05-01 14:46:30 +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
2121152b76 Fix CS 2023-04-28 20:03:53 +01:00
Dylan K. Taylor
a1cd1d7433 ... 2023-04-28 19:35:03 +01:00
Dylan K. Taylor
04aabaee5e Fix CS 2023-04-28 19:31:08 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
e2108557ab BlockStateUpgrader: make sure the returned state always has an updated version ID
PM itself doesn't require this, but it's useful for tools to know whether to upgrade the schema again (e.g. in testing scenarios).
2023-04-28 17:26:19 +01:00
Dylan K. Taylor
ff8301b86c BlockStateData: fixed outdated version ID 2023-04-28 17:23:32 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
a8dec1adb1 PM5-specific changes for 1.19.80 2023-04-26 23:30:56 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
777b4d6ac3 PM5-specific updates for 1.19.70 2023-03-14 18:50:04 +00:00
Dylan K. Taylor
a123194368 BlockStateData: added getVersionAsString() 2023-03-13 16:14:19 +00:00
Dylan K. Taylor
5eeb63f64b always the CS ... 2023-03-04 15:52:57 +00:00
Dylan K. Taylor
b9d62de29d Pack wall connections into 7 bits for runtime data encoding 2023-03-04 15:47:34 +00:00
Dylan K. Taylor
7608d5f04e Use BedrockDataFiles in more places 2023-02-23 22:03:35 +00:00
Dylan K. Taylor
c82b43a586 Merge branch 'next-minor' into next-major 2023-02-23 22:00:14 +00:00
Dylan K. Taylor
f704bfb63a Use BedrockData 2.0.0 2023-02-23 21:52:17 +00:00
Dylan K. Taylor
9acb4d64db Added generated constants for available BedrockData files
this makes it easier to detect unused files, detect removed files, and also avoid typos in usages.
2023-02-23 21:45:12 +00:00
Dylan K. Taylor
94ffef1a99 ItemIdMetaUpgrader: consistency of API method naming 2023-02-21 16:14:31 +00:00
Dylan K. Taylor
2feb9ca903 ItemIdMetaUpgrader: consistency of API method naming 2023-02-21 16:12:44 +00:00
Dylan K. Taylor
55a48e0c84 Block: specifying required type/state data bits is no longer required
RuntimeDataSizeCalculator allows calculating the number of required bits from describeType directly, which considerably reduces boilerplate code.
2023-02-16 16:45:19 +00:00
Dylan K. Taylor
c2f6d8139a Added interface RuntimeDataDescriber 2023-02-16 16:23:32 +00:00
ipad54
75f74454c6 Implemented reinforced deepslate (#5553) 2023-02-15 15:15:04 +00:00
Dylan K. Taylor
c0f3dbdd70 Regenerate constants for block and item data handling 2023-02-15 15:12:53 +00:00
Dylan K. Taylor
41ab698f93 wrong filename 2023-02-06 12:29:54 +00:00
Dylan K. Taylor
433b0ca6cc Fix PHPStan 2023-02-02 16:23:21 +00:00
Dylan K. Taylor
da5302ca86 BlockStateData: introduce and use current() 2023-02-02 16:21:50 +00:00
Dylan K. Taylor
6b7a4e2c41 Split up ItemDataUpgrader (preparing for code backport) 2023-02-02 16:08:49 +00:00
Dylan K. Taylor
e9b994cbc3 Allow limiting max schema ID loaded for item ID upgrading 2023-02-02 15:29:45 +00:00
Dylan K. Taylor
3c46bf01c6 Begin removing dependence on obsolete files from BedrockData
these files were only kept for backwards compatibility, and aren't actively maintained. They are only needed for legacy conversions in the modern day era.
2023-02-02 14:47:38 +00:00
Dylan K. Taylor
0e15a8698a BlockStateUpgrader: do not use blockstate version to manage internal schemas
these are no longer reliable.
2023-02-01 22:35:59 +00:00
Dylan K. Taylor
d3fff4e0b2 Updated to newer BedrockBlockUpgradeSchema 2023-02-01 21:21:55 +00:00
Dylan K. Taylor
0a3ecfdae9 Clean up terminology around block state IDs and their handling 2023-01-25 19:01:15 +00:00
Dylan K. Taylor
2f469ef4a0 Added mangrove, azalea and flowering azalea leaves 2023-01-25 18:50:14 +00:00
Dylan K. Taylor
ecd8f151f1 Merge branch 'next-minor' into next-major 2023-01-12 22:08:25 +00:00
Dylan K. Taylor
ca1f1bf09f Fixed glowing item frames
due to technical limitations, this requires separating them back into two different block types. However, this isn't too egregious since it's just one flag, and actually simplifies some code.

closes #5478
2023-01-12 21:52:52 +00:00
ipad54
85231215e7 Implemented Sculk (#5489) 2023-01-04 20:10:46 +00:00
Dylan K. Taylor
8fd4918429 Use Filesystem::fileGetContents() in more places 2022-12-25 18:26:53 +00:00
Dylan K. Taylor
c89df7eb1c Merge remote-tracking branch 'origin/next-minor' into next-major 2022-12-25 18:22:13 +00:00