45 protected bool $unstable =
false;
46 protected bool $worksUnderwater =
false;
49 $w->bool($this->worksUnderwater);
53 $w->bool($this->unstable);
56 public function isUnstable() : bool{ return $this->unstable; }
60 $this->unstable = $unstable;
64 public function worksUnderwater() : bool{ return $this->worksUnderwater; }
68 $this->worksUnderwater = $worksUnderwater;
72 public function onBreak(
Item $item, ?
Player $player =
null, array &$returnedItems = []) : bool{
77 return parent::onBreak($item, $player, $returnedItems);
81 if($item->getTypeId() ===
ItemTypeIds::FIRE_CHARGE){
86 if($item instanceof
FlintSteel || $item->hasEnchantment(VanillaEnchantments::FIRE_ASPECT())){
88 $item->applyDamage(1);
97 public function ignite(
int $fuse = 80) : void{
98 $world = $this->position->getWorld();
99 $world->setBlock($this->position, VanillaBlocks::AIR());
101 $mot = (
new Random())->nextSignedFloat() * M_PI * 2;
103 $tnt =
new PrimedTNT(Location::fromObject($this->position->add(0.5, 0, 0.5), $world));
104 $tnt->setFuse($fuse);
105 $tnt->setWorksUnderwater($this->worksUnderwater);
106 $tnt->setMotion(
new Vector3(-sin($mot) * 0.02, 0.2, -cos($mot) * 0.02));
109 $tnt->broadcastSound(
new IgniteSound());
125 if($projectile->isOnFire()){