mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-11 08:19:45 +00:00
Protect Item->count
This commit is contained in:
parent
82c718cff0
commit
139aaa5577
@ -72,7 +72,7 @@ abstract class Crops extends Flowable{
|
||||
$this->getLevel()->setBlock($this, $ev->getNewState());
|
||||
}
|
||||
|
||||
$item->count--;
|
||||
$item->pop();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ class Sugarcane extends Flowable{
|
||||
$this->getLevel()->setBlock($this, $this);
|
||||
}
|
||||
|
||||
$item->count--;
|
||||
$item->pop();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ class Item implements ItemIds, \JsonSerializable{
|
||||
/** @var CompoundTag|null */
|
||||
private $cachedNBT = null;
|
||||
/** @var int */
|
||||
public $count = 1;
|
||||
protected $count = 1;
|
||||
/** @var string */
|
||||
protected $name;
|
||||
|
||||
|
@ -93,7 +93,7 @@ class PaintingItem extends Item{
|
||||
$entity = Entity::createEntity("Painting", $blockReplace->getLevel(), $nbt);
|
||||
|
||||
if($entity instanceof Entity){
|
||||
--$this->count;
|
||||
$this->pop();
|
||||
$entity->spawnToAll();
|
||||
|
||||
$player->getLevel()->broadcastLevelEvent($blockReplace->add(0.5, 0.5, 0.5), LevelEventPacket::EVENT_SOUND_ITEMFRAME_PLACE); //item frame and painting have the same sound
|
||||
|
@ -55,7 +55,7 @@ abstract class ProjectileItem extends Item{
|
||||
$projectile->setMotion($projectile->getMotion()->multiply($this->getThrowForce()));
|
||||
}
|
||||
|
||||
$this->count--;
|
||||
$this->pop();
|
||||
|
||||
if($projectile instanceof Projectile){
|
||||
$projectileEv = new ProjectileLaunchEvent($projectile);
|
||||
|
@ -40,7 +40,7 @@ class SpawnEgg extends Item{
|
||||
$entity = Entity::createEntity($this->meta, $player->getLevel(), $nbt);
|
||||
|
||||
if($entity instanceof Entity){
|
||||
--$this->count;
|
||||
$this->pop();
|
||||
$entity->spawnToAll();
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user