Commit Graph

21 Commits

Author SHA1 Message Date
6d4279671e A giant hack to cut down code needed for runtime block serialization by 50%
this also avoids repeated information and inconsistencies.
2022-07-18 18:25:41 +01:00
ba2baba7cc Added netherite blocks and items 2022-07-14 20:39:09 +01:00
68cbe46600 Exterminate legacy item IDs 2022-07-05 15:12:55 +01:00
bd773c2f84 VanillaBlocks: use BlockFactory::fromTypeId() 2022-07-05 13:40:07 +01:00
323c563684 Break Block's dependence on ItemFactory, and item legacy IDs
let's GOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
2022-07-02 17:29:28 +01:00
dd63681f94 Assign auto-generated runtime type IDs to all items 2022-06-29 13:50:58 +01:00
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
1ff69136a3 Merge branch 'next-major' into modern-world-support 2022-06-07 20:01:40 +01:00
38d6284671 Use PHP-CS-Fixer to enforce file header presence 2022-06-04 17:34:49 +01:00
68491be847 Merge branch 'next-major' into modern-world-support 2022-05-20 11:21:35 +01:00
95ad3f16e1 Modernize private property declarations in src/item 2022-05-17 20:59:24 +01:00
ede9e78fbd ItemBlock: make final, and document its purpose more clearly 2022-03-29 12:49:49 +01:00
7a35fdb1bb Allow Blocks to specify their max stack size 2021-06-30 19:28:16 +01:00
c42a6d7552 ItemBlock no longer depends on legacy ID/metadata 2020-10-04 18:27:20 +01:00
d3a3a41d2b Revert back to separated floor/wall sign
the conditionally useless properties are problematic.
2020-10-04 17:52:23 +01:00
2e0f7102e8 ItemBlock: remove superfluous doc comments generated by PhpStorm 2020-08-01 16:06:38 +01:00
4fc134bd04 Separate item ID/meta to ItemIdentifier structure 2020-06-29 12:16:34 +01:00
d2089afbc3 ItemBlock: get rid of -1 meta check (meta is never -1 in this code path now) 2020-06-20 09:52:02 +01:00
13d784cd0c Convert BlockFactory to singleton 2020-04-23 23:45:13 +01:00
67bcc1c0fb phpdoc armageddon for master, pass 1 2020-01-22 11:55:03 +00:00
5499ac620c Removed pocketmine subdirectory, map PSR-4 style 2019-07-30 19:14:57 +01:00