mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-12 16:59:44 +00:00
fix banner block picking
This commit is contained in:
parent
08e1f6405c
commit
41705db687
@ -31,6 +31,7 @@ use pocketmine\block\utils\DyeColor;
|
|||||||
use pocketmine\item\Banner as ItemBanner;
|
use pocketmine\item\Banner as ItemBanner;
|
||||||
use pocketmine\item\Item;
|
use pocketmine\item\Item;
|
||||||
use pocketmine\item\ItemFactory;
|
use pocketmine\item\ItemFactory;
|
||||||
|
use pocketmine\item\ItemIds;
|
||||||
use pocketmine\math\AxisAlignedBB;
|
use pocketmine\math\AxisAlignedBB;
|
||||||
use pocketmine\math\Facing;
|
use pocketmine\math\Facing;
|
||||||
use pocketmine\math\Vector3;
|
use pocketmine\math\Vector3;
|
||||||
@ -165,8 +166,12 @@ class Banner extends Transparent{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function asItem() : Item{
|
||||||
|
return ItemFactory::get(ItemIds::BANNER, $this->baseColor->getInvertedMagicNumber());
|
||||||
|
}
|
||||||
|
|
||||||
public function getDropsForCompatibleTool(Item $item) : array{
|
public function getDropsForCompatibleTool(Item $item) : array{
|
||||||
$drop = ItemFactory::get(Item::BANNER, $this->baseColor->getInvertedMagicNumber());
|
$drop = $this->asItem();
|
||||||
if($drop instanceof ItemBanner and !$this->patterns->isEmpty()){
|
if($drop instanceof ItemBanner and !$this->patterns->isEmpty()){
|
||||||
$drop->setPatterns($this->patterns);
|
$drop->setPatterns($this->patterns);
|
||||||
}
|
}
|
||||||
@ -174,6 +179,14 @@ class Banner extends Transparent{
|
|||||||
return [$drop];
|
return [$drop];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPickedItem(bool $addUserData = false) : Item{
|
||||||
|
$result = $this->asItem();
|
||||||
|
if($addUserData and $result instanceof ItemBanner and !$this->patterns->isEmpty()){
|
||||||
|
$result->setPatterns($this->patterns);
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
public function isAffectedBySilkTouch() : bool{
|
public function isAffectedBySilkTouch() : bool{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user