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
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;
 }
Example #2
0
 public static function isCreativeItem(Item $item)
 {
     foreach (self::$creative as $i => $d) {
         if ($item->equals($d, !$item->isTool())) {
             return true;
         }
     }
     return false;
 }
Example #3
0
 public final function deepEquals(Item $item, $checkDamage = true, $checkCompound = true)
 {
     if ($item->equals($item, $checkDamage, $checkCompound)) {
         return true;
     } elseif ($item->hasCompoundTag() or $this->hasCompoundTag()) {
         return NBT::matchTree($this->getNamedTag(), $item->getNamedTag());
     }
     return false;
 }
Example #4
0
 public function first(Item $item)
 {
     $count = \max(1, $item->getCount());
     $checkDamage = $item->getDamage() === \null ? \false : \true;
     $checkTags = $item->getCompoundTag() === \null ? \false : \true;
     foreach ($this->getContents() as $index => $i) {
         if ($item->equals($i, $checkDamage, $checkTags) and $i->getCount() >= $count) {
             return $index;
         }
     }
     return -1;
 }
Example #5
0
 public function first(Item $item)
 {
     $count = max(1, $item->getCount());
     $checkDamage = $item->getDamage() === null ? false : true;
     foreach ($this->getContents() as $index => $i) {
         if ($item->equals($i, $checkDamage) and $i->getCount() >= $count) {
             return $index;
         }
     }
     return -1;
 }
Example #6
0
 public function getCreativeItemIndex(Item $item) : int
 {
     foreach ($this->personalCreativeItems as $i => $d) {
         if ($item->equals($d, !$item->isTool())) {
             return $i;
         }
     }
     return -1;
 }