mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 10:22:56 +00:00
Separate consumable item interfaces from general consumable interfaces (#3595)
I wonder if there's a way to generalise item consuming beyond just eating/drinking. Stuff like lava bucket in a furnace needs the same kind of "leftover" logic.
This commit is contained in:
@ -73,7 +73,7 @@ use pocketmine\form\Form;
|
||||
use pocketmine\form\FormValidationException;
|
||||
use pocketmine\inventory\Inventory;
|
||||
use pocketmine\inventory\PlayerCursorInventory;
|
||||
use pocketmine\item\Consumable;
|
||||
use pocketmine\item\ConsumableItem;
|
||||
use pocketmine\item\enchantment\EnchantmentInstance;
|
||||
use pocketmine\item\enchantment\MeleeWeaponEnchantment;
|
||||
use pocketmine\item\Item;
|
||||
@ -1489,7 +1489,7 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
|
||||
*/
|
||||
public function consumeHeldItem() : bool{
|
||||
$slot = $this->inventory->getItemInHand();
|
||||
if($slot instanceof Consumable){
|
||||
if($slot instanceof ConsumableItem){
|
||||
$ev = new PlayerItemConsumeEvent($this, $slot);
|
||||
if($this->hasItemCooldown($slot)){
|
||||
$ev->setCancelled();
|
||||
|
Reference in New Issue
Block a user