mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 00:07:30 +00:00
Player: don't dump cursor contents on mouseover interaction
this can fire while the player has the inventory window open, because it also gets sent when the player swaps their held itemstack for something new. We already had a special-case for mouseover with entity ID 0, but since this isn't just a zero problem, a more general fix suits better (particularly since we might need to handle the 0 case anyway). closes #4140 closes #4141
This commit is contained in:
parent
609dff1aae
commit
125837324f
@ -2834,15 +2834,11 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
if(!$this->spawned or !$this->isAlive()){
|
||||
return true;
|
||||
}
|
||||
if($packet->action === InteractPacket::ACTION_MOUSEOVER and $packet->target === 0){
|
||||
//TODO HACK: silence useless spam (MCPE 1.8)
|
||||
//this packet is EXPECTED to only be sent when interacting with an entity, but due to some messy Mojang
|
||||
//hacks, it also sends it when changing the held item now, which causes us to think the inventory was closed
|
||||
//when it wasn't.
|
||||
return true;
|
||||
}
|
||||
|
||||
$this->doCloseInventory();
|
||||
if($packet->action !== InteractPacket::ACTION_MOUSEOVER){
|
||||
//mouseover fires when the player swaps their held itemstack in the inventory menu
|
||||
$this->doCloseInventory();
|
||||
}
|
||||
|
||||
$target = $this->level->getEntity($packet->target);
|
||||
if($target === null){
|
||||
|
Loading…
x
Reference in New Issue
Block a user