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:
Dylan K. Taylor
2023-03-02 15:51:55 +00:00
parent f64dc01bd1
commit 7c974a12e1
82 changed files with 149 additions and 94 deletions

View File

@ -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");
}
/**