mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-03 00:25:04 +00:00
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:
@ -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
|
||||
*/
|
||||
|
Reference in New Issue
Block a user