diff --git a/src/pocketmine/block/Block.php b/src/pocketmine/block/Block.php index bdb8871d7..1cfcf5ce1 100644 --- a/src/pocketmine/block/Block.php +++ b/src/pocketmine/block/Block.php @@ -111,7 +111,13 @@ class Block extends Position implements BlockIds, Metadatable{ * @return int */ public function getItemId() : int{ - return $this->itemId ?? $this->getId(); + if($this->itemId !== null){ + return $this->itemId; + } + if($this->id > 255){ + return 255 - $this->id; + } + return $this->id; } /** diff --git a/src/pocketmine/block/BlockFactory.php b/src/pocketmine/block/BlockFactory.php index f8a091ce7..7fc4af2ae 100644 --- a/src/pocketmine/block/BlockFactory.php +++ b/src/pocketmine/block/BlockFactory.php @@ -61,14 +61,14 @@ class BlockFactory{ * this if you need to reset the block factory back to its original defaults for whatever reason. */ public static function init() : void{ - self::$fullList = new \SplFixedArray(4096); - self::$getInterceptors = new \SplFixedArray(4096); + self::$fullList = new \SplFixedArray(8192); + self::$getInterceptors = new \SplFixedArray(8192); - self::$lightFilter = \SplFixedArray::fromArray(array_fill(0, 256, 1)); - self::$diffusesSkyLight = \SplFixedArray::fromArray(array_fill(0, 256, false)); - self::$blastResistance = \SplFixedArray::fromArray(array_fill(0, 256, 0)); + self::$lightFilter = \SplFixedArray::fromArray(array_fill(0, 512, 1)); + self::$diffusesSkyLight = \SplFixedArray::fromArray(array_fill(0, 512, false)); + self::$blastResistance = \SplFixedArray::fromArray(array_fill(0, 512, 0)); - self::$stateMasks = \SplFixedArray::fromArray(array_fill(0, 256, 0)); + self::$stateMasks = \SplFixedArray::fromArray(array_fill(0, 512, 0)); self::registerBlock(new Air()); diff --git a/src/pocketmine/item/ItemBlock.php b/src/pocketmine/item/ItemBlock.php index 4fa540b14..da455e517 100644 --- a/src/pocketmine/item/ItemBlock.php +++ b/src/pocketmine/item/ItemBlock.php @@ -39,8 +39,15 @@ class ItemBlock extends Item{ * @param int|null $itemId */ public function __construct(int $blockId, int $meta = 0, int $itemId = null){ + if($blockId < 0){ //extended blocks + if($itemId === null){ + $itemId = $blockId; + } + $blockId = 255 - $blockId; + } $this->blockId = $blockId; $this->setDamage($meta); + parent::__construct($itemId ?? $blockId, $meta, $this->getBlock()->getName()); }