mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-16 02:38:54 +00:00
Armor: fixed equipping when right-clicking air instead of a block
this action (which is more accurately referred to as 'activate item' or 'use item' in other areas) always fires on right-click when holding any item, whether aiming at a block or not.
This commit is contained in:
parent
3bf87378ef
commit
4e91009492
@ -23,7 +23,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace pocketmine\item;
|
namespace pocketmine\item;
|
||||||
|
|
||||||
use pocketmine\block\Block;
|
|
||||||
use pocketmine\color\Color;
|
use pocketmine\color\Color;
|
||||||
use pocketmine\event\entity\EntityDamageEvent;
|
use pocketmine\event\entity\EntityDamageEvent;
|
||||||
use pocketmine\inventory\ArmorInventory;
|
use pocketmine\inventory\ArmorInventory;
|
||||||
@ -122,7 +121,7 @@ class Armor extends Durable{
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onActivate(Player $player, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector) : ItemUseResult{
|
public function onClickAir(Player $player, Vector3 $directionVector) : ItemUseResult{
|
||||||
$existing = $player->getArmorInventory()->getItem($this->getArmorSlot());
|
$existing = $player->getArmorInventory()->getItem($this->getArmorSlot());
|
||||||
if(!$existing->isNull()){
|
if(!$existing->isNull()){
|
||||||
return ItemUseResult::FAIL();
|
return ItemUseResult::FAIL();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user