mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 02:08:21 +00:00
avoid direct mutation of Item->count field, use Item->pop() instead
I think this change was already applied on the master branch, but I don't remember for sure.
This commit is contained in:
@ -96,7 +96,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
|
||||
|
@ -54,7 +54,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);
|
||||
|
@ -44,7 +44,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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user