mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-04 09:10:00 +00:00
Inventory: added API method isSlotEmpty()
This commit is contained in:
parent
cf3638ad8d
commit
c7e803372c
@ -237,6 +237,10 @@ abstract class BaseInventory implements Inventory{
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isSlotEmpty(int $index) : bool{
|
||||||
|
return $this->slots[$index] === null or $this->slots[$index]->isNull();
|
||||||
|
}
|
||||||
|
|
||||||
public function canAddItem(Item $item) : bool{
|
public function canAddItem(Item $item) : bool{
|
||||||
$item = clone $item;
|
$item = clone $item;
|
||||||
$checkDamage = !$item->hasAnyDamageValue();
|
$checkDamage = !$item->hasAnyDamageValue();
|
||||||
|
@ -171,6 +171,15 @@ interface Inventory{
|
|||||||
*/
|
*/
|
||||||
public function firstEmpty() : int;
|
public function firstEmpty() : int;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the given slot is empty.
|
||||||
|
*
|
||||||
|
* @param int $index
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isSlotEmpty(int $index) : bool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will remove all the Items that has the same id and metadata (if not null)
|
* Will remove all the Items that has the same id and metadata (if not null)
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user