mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Changed constructor of ItemBlock to allow handling blocks with different item IDs, added more doors
This commit is contained in:
@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
namespace pocketmine\item;
|
||||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\block\BlockFactory;
|
||||
|
||||
/**
|
||||
* Class used for Items that can be Blocks
|
||||
@ -31,12 +32,13 @@ use pocketmine\block\Block;
|
||||
class ItemBlock extends Item{
|
||||
|
||||
/**
|
||||
* @param Block $block
|
||||
* @param int $meta Used in crafting recipes for any-damage ingredients (blocks must have meta values 0-15)
|
||||
* @param int $blockId
|
||||
* @param int $meta usually 0-15 (placed blocks may only have meta values 0-15)
|
||||
* @param int|null $itemId
|
||||
*/
|
||||
public function __construct(Block $block, int $meta = 0){
|
||||
$this->block = $block;
|
||||
parent::__construct($block->getId(), $meta, $block->getName());
|
||||
public function __construct(int $blockId, int $meta = 0, int $itemId = null){
|
||||
$this->block = BlockFactory::get($blockId, $meta & 0xf);
|
||||
parent::__construct($itemId ?? $this->block->getId(), $meta, $this->block->getName());
|
||||
}
|
||||
|
||||
public function setDamage(int $meta){
|
||||
|
Reference in New Issue
Block a user