pocketmine\item\Item::equals PHP Method

equals() final public method

final public equals ( Item $item, boolean $checkDamage = true, boolean $checkCompound = true, boolean $checkCount = false ) : boolean
$item Item
$checkDamage boolean
$checkCompound boolean
$checkCount boolean
return boolean
    public final function equals(Item $item, bool $checkDamage = true, bool $checkCompound = true, bool $checkCount = false) : bool
    {
        return $this->id === $item->getId() and ($checkCount === false or $this->getCount() === $item->getCount()) and ($checkDamage === false or $this->getDamage() === $item->getDamage()) and ($checkCompound === false or $this->getCompoundTag() === $item->getCompoundTag());
    }

Usage Example

Example #1
0
 /**
  * @param Item $item
  * @return int
  */
 public static function getCreativeItemIndex(Item $item)
 {
     foreach (Item::$creative as $i => $d) {
         if ($item->equals($d, !$item->isTool())) {
             return $i;
         }
     }
     return -1;
 }
All Usage Examples Of pocketmine\item\Item::equals