mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-03 08:35:20 +00:00
Strip all remaining legacy item ID/meta stuff from blocks
the doors are now finally open, we can: - make all the wood types dynamic - fix glazed terracotta - add all the new blocks LET'S GOOOOOOOOOOOO
This commit is contained in:
@ -24,7 +24,6 @@ declare(strict_types=1);
|
||||
namespace pocketmine\block;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use pocketmine\item\ItemIds;
|
||||
use function asort;
|
||||
use function file_get_contents;
|
||||
use function is_array;
|
||||
@ -44,7 +43,7 @@ class BlockTest extends TestCase{
|
||||
* Test registering a block which would overwrite another block, without forcing it
|
||||
*/
|
||||
public function testAccidentalOverrideBlock() : void{
|
||||
$block = new MyCustomBlock(new BlockIdentifier(BlockTypeIds::COBBLESTONE, ItemIds::COBBLESTONE, 0), "Cobblestone", BlockBreakInfo::instant());
|
||||
$block = new MyCustomBlock(new BlockIdentifier(BlockTypeIds::COBBLESTONE), "Cobblestone", BlockBreakInfo::instant());
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->blockFactory->register($block);
|
||||
}
|
||||
@ -53,7 +52,7 @@ class BlockTest extends TestCase{
|
||||
* Test registering a block deliberately overwriting another block works as expected
|
||||
*/
|
||||
public function testDeliberateOverrideBlock() : void{
|
||||
$block = new MyCustomBlock(new BlockIdentifier(BlockTypeIds::COBBLESTONE, ItemIds::COBBLESTONE, 0), "Cobblestone", BlockBreakInfo::instant());
|
||||
$block = new MyCustomBlock(new BlockIdentifier(BlockTypeIds::COBBLESTONE), "Cobblestone", BlockBreakInfo::instant());
|
||||
$this->blockFactory->register($block, true);
|
||||
self::assertInstanceOf(MyCustomBlock::class, $this->blockFactory->fromFullBlock($block->getStateId()));
|
||||
}
|
||||
@ -64,7 +63,7 @@ class BlockTest extends TestCase{
|
||||
public function testRegisterNewBlock() : void{
|
||||
for($i = BlockTypeIds::FIRST_UNUSED_BLOCK_ID; $i < BlockTypeIds::FIRST_UNUSED_BLOCK_ID + 256; ++$i){
|
||||
if(!$this->blockFactory->isRegistered($i)){
|
||||
$b = new StrangeNewBlock(new BlockIdentifier($i, $i + 10000, 0), "Strange New Block", BlockBreakInfo::instant());
|
||||
$b = new StrangeNewBlock(new BlockIdentifier($i), "Strange New Block", BlockBreakInfo::instant());
|
||||
$this->blockFactory->register($b);
|
||||
self::assertInstanceOf(StrangeNewBlock::class, $this->blockFactory->fromFullBlock($b->getStateId()));
|
||||
return;
|
||||
@ -79,7 +78,7 @@ class BlockTest extends TestCase{
|
||||
*/
|
||||
public function testRegisterIdTooSmall() : void{
|
||||
self::expectException(\InvalidArgumentException::class);
|
||||
$this->blockFactory->register(new OutOfBoundsBlock(new BlockIdentifier(-1, -1, 0), "Out Of Bounds Block", BlockBreakInfo::instant()));
|
||||
$this->blockFactory->register(new OutOfBoundsBlock(new BlockIdentifier(-1), "Out Of Bounds Block", BlockBreakInfo::instant()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user