Nuke Block->meta, split into variant and state properties, lots of cleanup

This is a major change to the way block metadata is handled within the PM core. This separates variant metadata (which really ought to be part of the ID) from state metadata, and in a couple of cases flattens separate states of blocks together.

The result of this is that invalid variants can be much more easily detected, and additionally state handling is much cleaner since meta is only needed at the serialize layer instead of throughout the code.
This commit is contained in:
Dylan K. Taylor
2018-09-21 19:28:10 +01:00
parent a55ab54ddb
commit 56d9943b0d
178 changed files with 2012 additions and 2120 deletions

View File

@ -99,11 +99,12 @@ class BlockTest extends TestCase{
*/
public function blockGetProvider() : array{
return [
[Block::STONE, Stone::ANDESITE],
[Block::STONE, 5],
[Block::STONE, 15],
[Block::GOLD_BLOCK, 5],
[Block::WOODEN_PLANKS, Planks::DARK_OAK],
[Block::SAND, 0]
[Block::GOLD_BLOCK, 0],
[Block::WOODEN_PLANKS, 5],
[Block::SAND, 0],
[Block::GOLD_BLOCK, 0]
];
}
@ -119,6 +120,13 @@ class BlockTest extends TestCase{
self::assertEquals($meta, $block->getDamage());
}
public function testBlockIds() : void{
for($i = 0; $i < 256; ++$i){
$b = BlockFactory::get($i);
self::assertEquals($i, $b->getId());
}
}
/**
* Test that all blocks have correctly set names
*/