diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index c9ba779df2..98ddd6547e 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -2595,7 +2595,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $block = $this->level->getBlock($this->temporalVector->setComponents($packet->blockX, $packet->blockY, $packet->blockZ)); //TODO: this doesn't handle crops correctly (need more API work) - $item = Item::get($block->getItemId(), $block->getDamage() & $block->getVariantBitmask()); + $item = Item::get($block->getItemId(), $block->getVariant()); if($packet->addUserData){ $tile = $this->getLevel()->getTile($block); diff --git a/src/pocketmine/block/Block.php b/src/pocketmine/block/Block.php index 7bc1c2329d..7f385e3ddf 100644 --- a/src/pocketmine/block/Block.php +++ b/src/pocketmine/block/Block.php @@ -136,6 +136,14 @@ class Block extends Position implements BlockIds, Metadatable{ return -1; } + /** + * Returns the block meta, stripped of non-variant flags. + * @return int + */ + public function getVariant() : int{ + return $this->meta & $this->getVariantBitmask(); + } + /** * Places the Block, using block space and block target, and side. Returns if the block has been placed. * @@ -352,7 +360,7 @@ class Block extends Position implements BlockIds, Metadatable{ */ public function getDrops(Item $item) : array{ return [ - ItemFactory::get($this->getItemId(), $this->getDamage() & $this->getVariantBitmask(), 1) + ItemFactory::get($this->getItemId(), $this->getVariant(), 1) ]; } diff --git a/src/pocketmine/block/WoodenStairs.php b/src/pocketmine/block/WoodenStairs.php index 09dc4f88db..c813924e32 100644 --- a/src/pocketmine/block/WoodenStairs.php +++ b/src/pocketmine/block/WoodenStairs.php @@ -44,7 +44,7 @@ class WoodenStairs extends Stair{ public function getDrops(Item $item) : array{ //TODO: Hierarchy problem (base class is for stone stairs) return [ - ItemFactory::get($this->getItemId(), $this->getDamage() & $this->getVariantBitmask(), 1) + ItemFactory::get($this->getItemId(), $this->getVariant(), 1) ]; } } \ No newline at end of file