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:
Dylan K. Taylor 2020-11-09 12:47:36 +00:00
parent 3bf87378ef
commit 4e91009492

View File

@ -23,7 +23,6 @@ declare(strict_types=1);
namespace pocketmine\item;
use pocketmine\block\Block;
use pocketmine\color\Color;
use pocketmine\event\entity\EntityDamageEvent;
use pocketmine\inventory\ArmorInventory;
@ -122,7 +121,7 @@ class Armor extends Durable{
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());
if(!$existing->isNull()){
return ItemUseResult::FAIL();