isShovel() public method

public isShovel ( )
Example #1
0
 public function getDrops(Item $item)
 {
     if ($item->isShovel() !== false) {
         return [[Item::SNOWBALL, 0, 1]];
     }
     return [];
 }
Example #2
0
 public function getDrops(Item $item)
 {
     if ($item->isShovel() !== false) {
         return [[Item::SNOWBALL, 0, $this->getDamage() + 1]];
         // Amount in PC version is based on the number of layers
     }
     return [];
 }
Example #3
0
 public function getDrops(Item $item) : array
 {
     if ($item->isShovel() !== false) {
         if ($item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0) {
             return [[Item::SNOW_BLOCK, 0, 1]];
         } else {
             return [[Item::SNOWBALL, 0, 4]];
         }
     } else {
         return [];
     }
 }
Example #4
0
 public function onActivate(Item $item, Player $player = \null)
 {
     if ($item->getId() === Item::DYE and $item->getDamage() === 0xf) {
         $item->count--;
         TallGrassObject::growGrass($this->getLevel(), $this, new Random(\mt_rand()), 8, 2);
         return \true;
     } elseif ($item->isHoe()) {
         $item->useOn($this);
         $this->getLevel()->setBlock($this, new Farmland());
         return \true;
     } elseif ($item->isShovel() and $this->getSide(1)->getId() === Block::AIR) {
         $item->useOn($this);
         $this->getLevel()->setBlock($this, new GrassPath());
         return \true;
     }
     return \false;
 }
Example #5
0
 public function getDrops(Item $item)
 {
     if ($item->isShovel()) {
         return [[Item::SNOWBALL, 0, $this->getDamage() + 1]];
     }
     return [];
 }