24 Commits

Author SHA1 Message Date
Dylan K. Taylor
8e600b4a78
ItemBlock: fixed unnecessary double singleton usage 2022-12-06 12:48:28 +00:00
Dylan K. Taylor
d5762d3f44
Item: allow describing type data to a reader as well as a writer
we don't currently need this, but it's better to have it in case we need it after PM5 release.

This is also now consistent with blocks.
2022-08-27 19:18:30 +01:00
Dylan K. Taylor
5c5d96d00b
ItemBlock: remember fuel time, fireproof and max stack size
this avoids repeatedly creating blocks for no reason when calling these methods.

This does assume that these methods always return the same result for a given block type, but I think that's a fair enough assumption.
2022-08-27 18:04:11 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
ba2baba7cc
Added netherite blocks and items 2022-07-14 20:39:09 +01:00
Dylan K. Taylor
68cbe46600
Exterminate legacy item IDs 2022-07-05 15:12:55 +01:00
Dylan K. Taylor
bd773c2f84
VanillaBlocks: use BlockFactory::fromTypeId() 2022-07-05 13:40:07 +01:00
Dylan K. Taylor
323c563684
Break Block's dependence on ItemFactory, and item legacy IDs
let's GOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
2022-07-02 17:29:28 +01:00
Dylan K. Taylor
dd63681f94
Assign auto-generated runtime type IDs to all items 2022-06-29 13:50:58 +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
1ff69136a3
Merge branch 'next-major' into modern-world-support 2022-06-07 20:01:40 +01:00
Dylan K. Taylor
38d6284671
Use PHP-CS-Fixer to enforce file header presence 2022-06-04 17:34:49 +01:00
Dylan K. Taylor
68491be847
Merge branch 'next-major' into modern-world-support 2022-05-20 11:21:35 +01:00
Dylan K. Taylor
95ad3f16e1
Modernize private property declarations in src/item 2022-05-17 20:59:24 +01:00
Dylan K. Taylor
ede9e78fbd
ItemBlock: make final, and document its purpose more clearly 2022-03-29 12:49:49 +01:00
Dylan K. Taylor
7a35fdb1bb
Allow Blocks to specify their max stack size 2021-06-30 19:28:16 +01:00
Dylan K. Taylor
c42a6d7552 ItemBlock no longer depends on legacy ID/metadata 2020-10-04 18:27:20 +01:00
Dylan K. Taylor
d3a3a41d2b Revert back to separated floor/wall sign
the conditionally useless properties are problematic.
2020-10-04 17:52:23 +01:00
Dylan K. Taylor
2e0f7102e8 ItemBlock: remove superfluous doc comments generated by PhpStorm 2020-08-01 16:06:38 +01:00
Dylan K. Taylor
4fc134bd04 Separate item ID/meta to ItemIdentifier structure 2020-06-29 12:16:34 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
13d784cd0c Convert BlockFactory to singleton 2020-04-23 23:45:13 +01:00
Dylan K. Taylor
67bcc1c0fb phpdoc armageddon for master, pass 1 2020-01-22 11:55:03 +00:00
Dylan K. Taylor
5499ac620c Removed pocketmine subdirectory, map PSR-4 style 2019-07-30 19:14:57 +01:00