19 Commits

Author SHA1 Message Date
Dylan K. Taylor
4ba4d556ed
Tidy up world version related things
I decided to scrap the max schema ID stuff, since it just adds extra places to forget updating. Instead, it's better to use minor version locks and version metadata, as we do for BedrockData and BedrockProtocol.
2023-03-14 23:27:16 +00:00
Dylan K. Taylor
777b4d6ac3
PM5-specific updates for 1.19.70 2023-03-14 18:50:04 +00:00
Dylan K. Taylor
8933064cd5
Fixed missing blockstate upgrader 2023-03-06 17:02:33 +00:00
Dylan K. Taylor
da5302ca86
BlockStateData: introduce and use current() 2023-02-02 16:21:50 +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
8fd4918429
Use Filesystem::fileGetContents() in more places 2022-12-25 18:26:53 +00:00
Dylan K. Taylor
f88ae93897
BC break: Replaced webmozart/path-util with symfony/filesystem, closes #5332 2022-10-13 16:43:36 +01:00
Dylan K. Taylor
1609b11c8e
Make blockstate (de)serializer names a bit less verbose 2022-09-24 13:43:00 +01:00
Dylan K. Taylor
590eb74703
Make Block(De)Serializer much less nasty to interact with
this makes it a lot less inconvenient to access the primary blockstate serializer/deserializer, which is necessary for registering new blocks.
2022-09-24 13:31:50 +01:00
Dylan K. Taylor
bedf79e2cd
BaseWorldProvider: don't crash the server when encountering an unknown block 2022-07-21 16:12:27 +01:00
Dylan K. Taylor
afaf9dbc88
Rename LegacyBlockStateMapper -> BlockIdMetaUpgrader
this more accurately describes what it's used for.
2022-07-19 15:32:08 +01:00
Dylan K. Taylor
f24f2d9ca9
Hit block legacy metadata with the biggest nuke you've ever seen
This commit completely revamps the way that blocks are represented in memory at runtime.

Instead of being represented by legacy Mojang block IDs and metadata, which are dated, limited and unchangeable, we now use custom PM block IDs, which are generated from VanillaBlocks.
This means we have full control of how they are assigned, which opens the doors to finally addressing inconsistencies like glazed terracotta, stripped logs handling, etc.

To represent state, BlockDataReader and BlockDataWriter have been introduced, and are used by blocks with state information to pack said information into a binary form that can be stored on a chunk at runtime.
Conceptually it's pretty similar to legacy metadata, but the actual format shares no resemblance whatsoever to legacy metadata, and is fully controlled by PM.
This means that the 'state data' may change in serialization format at any time, so it should **NOT** be stored on disk or in a config.

In the future, this will be improved using more auto-generated code and attributes, instead of hand-baked decodeState() and encodeState(). For now, this opens the gateway to a significant expansion of features.
It's not ideal, but it's a big step forwards.
2022-06-24 23:19:37 +01:00
Dylan K. Taylor
1533fcf8f6
Separate block legacy data upgrading from block deserialization
this commit provides a central place where all block data can go to be upgraded to the latest version (currently 1.19), irrespective of how old it is.

Previously I had issues during debugging, because it wasn't possible to just upgrade a block without deserializing it into a Block object, which isn't currently supported for many blocks.
This commit solves that problem by separating the upgrading from the deserialization.
2022-06-23 16:45:02 +01:00
Dylan K. Taylor
4aa1a3da8b
Moving more stuff around 2022-06-08 15:57:02 +01:00
Dylan K. Taylor
680615eed8
Namespace rename 2022-06-08 15:54:45 +01:00
Dylan K. Taylor
cf7d42b3ea
Fix CS according to new rules 2022-06-07 20:02:24 +01:00
Dylan K. Taylor
5c85aa6e58
Eliminate remaining usages of legacy block ID+meta on disk
flower pots loaded from vanilla worlds should now correctly display the plant inside
2022-06-05 21:49:51 +01:00
Dylan K. Taylor
a95749f968
Now using new repository for block upgrade schemas 2022-02-22 22:09:47 +00:00
Dylan K. Taylor
e58b3ba46c
First look at loading 1.13+ worlds 2022-02-07 03:06:59 +00:00