Protect Item->count

This commit is contained in:
Dylan K. Taylor
2018-10-07 14:34:04 +01:00
parent 82c718cff0
commit 139aaa5577
8 changed files with 8 additions and 8 deletions

View File

@ -72,7 +72,7 @@ abstract class Crops extends Flowable{
$this->getLevel()->setBlock($this, $ev->getNewState());
}
$item->count--;
$item->pop();
return true;
}

View File

@ -98,7 +98,7 @@ class Grass extends Solid{
public function onActivate(Item $item, Player $player = null) : bool{
if($item->getId() === Item::DYE and $item->getDamage() === 0x0F){
$item->count--;
$item->pop();
TallGrassObject::growGrass($this->getLevel(), $this, new Random(mt_rand()), 8, 2);
return true;

View File

@ -61,7 +61,7 @@ class Sapling extends Flowable{
//TODO: change log type
Tree::growTree($this->getLevel(), $this->x, $this->y, $this->z, new Random(mt_rand()), $this->getVariant());
$item->count--;
$item->pop();
return true;
}

View File

@ -76,7 +76,7 @@ class Sugarcane extends Flowable{
$this->getLevel()->setBlock($this, $this);
}
$item->count--;
$item->pop();
return true;
}