1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Hello the Firework position is spawn wrong when i do the Skywars win event.

Discussion in 'General discussion' started by Hoangviphb999, Dec 13, 2020.

  1. Hoangviphb999

    Hoangviphb999 Silverfish

    Messages:
    21
    GitHub:
    Hoangviphb999
    FIREWORKS
    /** @var Fireworks $fw */
    $fw = ItemFactory::get(Item::FIREWORKS);
    $fw->addExplosion(Fireworks::TYPE_SMALL_SPHERE, Fireworks::COLOR_RED, "", false, true);
    $fw->addExplosion(Fireworks::TYPE_SMALL_SPHERE, Fireworks::COLOR_GOLD, "", false, true);
    $fw->addExplosion(Fireworks::TYPE_SMALL_SPHERE, Fireworks::COLOR_BLUE, "", false, true);
    $fw->setFlightDuration(2);
    //Choose Level
    $level = $player->getLevel();
    // Choose some coordinates
    $vector3 = $level->getSpawnLocation()->add(0.5, 1, 0.5);
    // Create the NBT data
    $nbt = FireworkRocket::createBaseNBT($vector3, new Vector3(0.001, 0.05, 0.001), lcg_value() * 360, 90);
    // Construct and spawn
    $entity = FireworkRocket::createEntity("FireworkRocket", $level, $nbt, $fw);
    if ($entity instanceof FireworkRocket) {
    $entity->spawnToAll();
    }
    }

    I applied this code in Skywars plugins for winning event but it spawn in higher, it doesn't spawn in player position.
     
  2. RicardoMilos384

    RicardoMilos384 Slime

    Messages:
    82
    GitHub:
    ricardomilos384
    $vector3 = $player->asVector3();
     
    Hoangviphb999 likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.