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:
Dylan K. Taylor 2020-03-10 12:10:01 +00:00
parent 89ea7f0a76
commit a72e6ee706

View File

@ -2388,7 +2388,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$item = $this->inventory->getItemInHand();
$oldItem = clone $item;
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->sendHeldItem($this->hasSpawned);
}