applyDamage(1); $this->ignite(); return true; } return false; } public function hasEntityCollision() : bool{ return true; } public function onEntityCollide(Entity $entity) : void{ if($entity instanceof Arrow and $entity->isOnFire()){ $this->ignite(); } } public function ignite(int $fuse = 80){ $this->getLevel()->setBlock($this, BlockFactory::get(Block::AIR)); $mot = (new Random())->nextSignedFloat() * M_PI * 2; $nbt = Entity::createBaseNBT($this->add(0.5, 0, 0.5), new Vector3(-sin($mot) * 0.02, 0.2, -cos($mot) * 0.02)); $nbt->setShort("Fuse", $fuse); $tnt = Entity::createEntity("PrimedTNT", $this->getLevel(), $nbt); if($tnt !== null){ $tnt->spawnToAll(); } } public function getFlameEncouragement() : int{ return 15; } public function getFlammability() : int{ return 100; } public function onIncinerate() : void{ $this->ignite(); } }