mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-14 17:59:41 +00:00
parent
74a919353f
commit
7f81507ea1
@ -34,7 +34,7 @@ use pocketmine\world\sound\BowShootSound;
|
|||||||
use function intdiv;
|
use function intdiv;
|
||||||
use function min;
|
use function min;
|
||||||
|
|
||||||
class Bow extends Tool{
|
class Bow extends Tool implements Releasable{
|
||||||
|
|
||||||
public function getFuelTime() : int{
|
public function getFuelTime() : int{
|
||||||
return 200;
|
return 200;
|
||||||
|
@ -28,7 +28,7 @@ use pocketmine\entity\Consumable;
|
|||||||
/**
|
/**
|
||||||
* Interface implemented by objects that can be consumed by mobs.
|
* Interface implemented by objects that can be consumed by mobs.
|
||||||
*/
|
*/
|
||||||
interface ConsumableItem extends Consumable{
|
interface ConsumableItem extends Consumable, Releasable{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the leftover that this Consumable produces when it is consumed. For Items, this is usually air, but could
|
* Returns the leftover that this Consumable produces when it is consumed. For Items, this is usually air, but could
|
||||||
|
31
src/item/Releasable.php
Normal file
31
src/item/Releasable.php
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ____ _ _ __ __ _ __ __ ____
|
||||||
|
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||||
|
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||||
|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||||
|
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* @author PocketMine Team
|
||||||
|
* @link http://www.pocketmine.net/
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace pocketmine\item;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface implemented by objects that can be used.
|
||||||
|
*/
|
||||||
|
interface Releasable{
|
||||||
|
|
||||||
|
}
|
@ -78,6 +78,7 @@ use pocketmine\item\enchantment\EnchantmentInstance;
|
|||||||
use pocketmine\item\enchantment\MeleeWeaponEnchantment;
|
use pocketmine\item\enchantment\MeleeWeaponEnchantment;
|
||||||
use pocketmine\item\Item;
|
use pocketmine\item\Item;
|
||||||
use pocketmine\item\ItemUseResult;
|
use pocketmine\item\ItemUseResult;
|
||||||
|
use pocketmine\item\Releasable;
|
||||||
use pocketmine\lang\Language;
|
use pocketmine\lang\Language;
|
||||||
use pocketmine\lang\TranslationContainer;
|
use pocketmine\lang\TranslationContainer;
|
||||||
use pocketmine\math\Vector3;
|
use pocketmine\math\Vector3;
|
||||||
@ -1476,8 +1477,7 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
|
|||||||
$this->inventory->setItemInHand($item);
|
$this->inventory->setItemInHand($item);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: check if item has a release action - if it doesn't, this shouldn't be set
|
$this->setUsingItem($item instanceof Releasable);
|
||||||
$this->setUsingItem(true);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user