mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-03 00:25:04 +00:00
Revert "ItemBlock: drop the charade about overriding built-in block types"
This reverts commit f64dc01bd1
.
I forgot that the ItemBlock constructor implicitly strips off any states
of the origin block, which is something that we unfortunately can't do
any other way right now, since the blocks don't remember their default
states.
This commit is contained in:
@ -62,9 +62,16 @@ class BlockTest extends TestCase{
|
||||
* Test registering a new block which does not yet exist
|
||||
*/
|
||||
public function testRegisterNewBlock() : void{
|
||||
$b = new StrangeNewBlock(new BlockIdentifier(BlockTypeIds::newId()), "Strange New Block", new BlockTypeInfo(BlockBreakInfo::instant()));
|
||||
$this->blockFactory->register($b);
|
||||
self::assertInstanceOf(StrangeNewBlock::class, $this->blockFactory->fromStateId($b->getStateId()));
|
||||
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), "Strange New Block", new BlockTypeInfo(BlockBreakInfo::instant()));
|
||||
$this->blockFactory->register($b);
|
||||
self::assertInstanceOf(StrangeNewBlock::class, $this->blockFactory->fromStateId($b->getStateId()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
throw new \RuntimeException("Can't test registering new blocks because no unused spaces left");
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user