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

How To Spawn Beacon Light On Player?

Discussion in 'Facepalm' started by Bintang Putra, Jun 9, 2017.

  1. Bintang Putra

    Bintang Putra Witch

    Messages:
    63
    GitHub:
    chaostixzix
    Is it possible to spawn colored beacon light to a player?

    what function to use?
    i have not tried yet to implement it
     
  2. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    I think it is impossible without colored glass
     
  3. Bintang Putra

    Bintang Putra Witch

    Messages:
    63
    GitHub:
    chaostixzix
    but, is it possible if without color?
     
  4. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    Yes, spawn block entity
     
  5. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Yes, you'll need to send the player a ghost tile. This tile will not be handled by PocketMine. If you want it to be handled by PocketMine, then you will need to register a new tile. It's possible to register tiles without source editing, unlike registering inventories.

    Send BlockEntityDataPacket to the player you want to spawn the beacon to.
    PHP:
    /** @var Player $player */
    /** @var int $x, $y, $z */
    $pk = new BlockEntityDataPacket();
    $pk->$x;
    $pk->$y;
    $pk->$z;
    $pk->namedtag = new CompoundTag("", [
        new 
    StringTag("id""Beacon"),
        new 
    IntTag("x"$x),
        new 
    IntTag("y"$y),
        new 
    IntTag("z"$z)
    ]);
    $player->dataPacket($pk);
     
    Last edited: Sep 9, 2017
  6. Bintang Putra

    Bintang Putra Witch

    Messages:
    63
    GitHub:
    chaostixzix
    $x, $y, $z is the position of the player?
     
  7. Bintang Putra

    Bintang Putra Witch

    Messages:
    63
    GitHub:
    chaostixzix
    I Got This
    Code:
    [Server thread/CRITICAL]: TypeError: "Argument 1 passed to pocketmine\utils\BinaryStream::putVarInt() must be of the type integer, float given, called in /Users/chaostix/Desktop/pm1/src/pocketmine/network/mcpe/protocol/DataPacket.php on line 306" (EXCEPTION) in "/src/pocketmine/utils/BinaryStream" at line 321
    
     
  8. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Understand the error, it's English after all.
     
  9. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    $x,$y,$z is position of beacon no position of player
     
  10. Bintang Putra

    Bintang Putra Witch

    Messages:
    63
    GitHub:
    chaostixzix
    but i want to spawn it to player position
     
  11. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    Spawn beacon under player :D
     
  12. Bintang Putra

    Bintang Putra Witch

    Messages:
    63
    GitHub:
    chaostixzix
    oh, i forgot
     
  13. Az928

    Az928 Baby Zombie

    Messages:
    140
    GitHub:
    theaz928
    1 // This is an int
    1.202729 // This is a float

    try round($float);
     
  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.