Added API method Item->pop()

This commit is contained in:
Dylan K. Taylor
2017-09-27 10:55:50 +01:00
parent 7a77bb0402
commit c47f1f572c
6 changed files with 27 additions and 35 deletions

View File

@ -112,14 +112,8 @@ class FlowerPot extends Flowable{
$this->setDamage(self::STATE_FULL); //specific damage value is unnecessary, it just needs to be non-zero to show an item.
$this->getLevel()->setBlock($this, $this, true, false);
$pot->setItem($item);
$pot->setItem($item->pop());
if($player instanceof Player){
if($player->isSurvival()){
$item->setCount($item->getCount() - 1);
$player->getInventory()->setItemInHand($item->getCount() > 0 ? $item : ItemFactory::get(Item::AIR));
}
}
return true;
}