mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
Added API method Block->getVariant()
This commit is contained in:
@ -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)
|
||||
];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user