mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-11 04:17:48 +00:00
Player: be aware of held item changing during click-block
this caused bugs if the inventory was cleared while using a hoe.
This commit is contained in:
parent
89ea7f0a76
commit
a72e6ee706
@ -2388,7 +2388,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
$item = $this->inventory->getItemInHand();
|
$item = $this->inventory->getItemInHand();
|
||||||
$oldItem = clone $item;
|
$oldItem = clone $item;
|
||||||
if($this->level->useItemOn($blockVector, $item, $face, $packet->trData->clickPos, $this, true)){
|
if($this->level->useItemOn($blockVector, $item, $face, $packet->trData->clickPos, $this, true)){
|
||||||
if(!$item->equalsExact($oldItem)){
|
if(!$item->equalsExact($oldItem) and $oldItem->equalsExact($this->inventory->getItemInHand())){
|
||||||
$this->inventory->setItemInHand($item);
|
$this->inventory->setItemInHand($item);
|
||||||
$this->inventory->sendHeldItem($this->hasSpawned);
|
$this->inventory->sendHeldItem($this->hasSpawned);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user