mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-06 11:57:10 +00:00
Fixed crash when getting an item from a block which came from an item which came from a block
had a stroke yet?
This commit is contained in:
parent
007ef833d4
commit
9c6d4093ae
@ -93,7 +93,9 @@ class Block{
|
||||
$this->describeBlockOnlyState($calculator);
|
||||
$this->requiredBlockOnlyStateDataBits = $calculator->getBitsUsed();
|
||||
|
||||
$this->defaultState = clone $this;
|
||||
$defaultState = clone $this;
|
||||
$this->defaultState = $defaultState;
|
||||
$defaultState->defaultState = $defaultState;
|
||||
}
|
||||
|
||||
public function __clone(){
|
||||
|
@ -124,4 +124,12 @@ class BlockTest extends TestCase{
|
||||
$block = $this->blockFactory->fromStateId(Block::EMPTY_STATE_ID);
|
||||
self::assertInstanceOf(Air::class, $block);
|
||||
}
|
||||
|
||||
public function testAsItemFromItem() : void{
|
||||
$block = VanillaBlocks::FLOWER_POT();
|
||||
$item = $block->asItem();
|
||||
$defaultBlock = $item->getBlock();
|
||||
$item2 = $defaultBlock->asItem();
|
||||
self::assertTrue($item2->equalsExact($item));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user