46 protected bool $unstable =
false;
47 protected bool $worksUnderwater =
false;
50 $w->bool($this->worksUnderwater);
54 $w->bool($this->unstable);
57 public function isUnstable() : bool{ return $this->unstable; }
61 $this->unstable = $unstable;
65 public function worksUnderwater() : bool{ return $this->worksUnderwater; }
69 $this->worksUnderwater = $worksUnderwater;
73 public function onBreak(
Item $item, ?
Player $player =
null, array &$returnedItems = []) : bool{
78 return parent::onBreak($item, $player, $returnedItems);
82 if($item->getTypeId() ===
ItemTypeIds::FIRE_CHARGE){
87 if($item instanceof
FlintSteel || $item->hasEnchantment(VanillaEnchantments::FIRE_ASPECT())){
89 $item->applyDamage(1);
98 public function ignite(
int $fuse = 80) : void{
99 $world = $this->position->getWorld();
100 $world->setBlock($this->position, VanillaBlocks::AIR());
102 $mot = (
new Random())->nextSignedFloat() * M_PI * 2;
104 $tnt =
new PrimedTNT(Location::fromObject($this->position->add(0.5, 0, 0.5), $world));
105 $tnt->setFuse($fuse);
106 $tnt->setWorksUnderwater($this->worksUnderwater);
107 $tnt->setMotion(
new Vector3(-sin($mot) * 0.02, 0.2, -cos($mot) * 0.02));
110 $tnt->broadcastSound(
new IgniteSound());
126 if($projectile->isOnFire()){