98 $position = $blockClicked->getPosition()->addVector($clickVector)->addVector(
Vector3::zero()->getSide($face)->multiply(0.15));
100 $randomDuration = (($this->flightTimeMultiplier + 1) * 10) + mt_rand(0, 12);
102 $entity =
new FireworkEntity(Location::fromObject($position, $player->getWorld(), Utils::getRandomFloat() * 360, 90), $randomDuration, $this->explosions);
103 $entity->setOwningEntity($player);
104 $entity->setMotion(
new Vector3(
105 (Utils::getRandomFloat() - Utils::getRandomFloat()) * 0.0023,
107 (Utils::getRandomFloat() - Utils::getRandomFloat()) * 0.0023
109 $entity->spawnToAll();
113 return ItemUseResult::SUCCESS;
117 parent::deserializeCompoundTag($tag);
120 if($fireworkData ===
null){
124 $this->setFlightTimeMultiplier($fireworkData->getByte(self::TAG_FLIGHT_TIME_MULTIPLIER, 1));
126 if(($explosions = $fireworkData->getListTag(self::TAG_EXPLOSIONS, CompoundTag::class)) !==
null){
127 foreach($explosions as $explosion){
128 $this->explosions[] = FireworkRocketExplosion::fromCompoundTag($explosion);
138 $fireworkData->setTag(self::TAG_EXPLOSIONS,
new ListTag(array_map(fn(FireworkRocketExplosion $e) => $e->toCompoundTag(), $this->explosions)));