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

How to put a block only 1 player can see (FakeBlock)

Discussion in 'Development' started by Besher, May 10, 2021.

  1. Besher

    Besher Witch

    Messages:
    51
    I want to put a block that only 1 player that enters a command can see I just need help with setting the block as I haven't seen any threads on here.

    Help is appreciated
     
    Last edited: May 10, 2021
  2. Axon

    Axon Zombie

    Messages:
    276
    Agent and Besher like this.
  3. Besher

    Besher Witch

    Messages:
    51
    can u show me and example of how i would use this in a function
     
  4. Besher

    Besher Witch

    Messages:
    51
    Nvm i got it thank you
     
  5. Axon

    Axon Zombie

    Messages:
    276
    Sure!
    PHP:
    // NameSpaces
    use pocketmine\block\Block;
    use 
    pocketmine\Player;
    // Function
    public function addClientBlock(int $blockID,Player $player){
        
    $block Block::get($blockID);
        
    $block->= (int) $player->x;
        
    $block->= (int) $player->-2;
        
    $block->= (int) $player->z;
        
    $block->level $player->level;
        
    $player->level->sendBlocks([$player],[$block]);
    }
    // How to Call function
    $this->addClientBlock(5$player// BlockId 5 is planks, to get more ids check out https://minecraft-ids.grahamedgecombe.com/
     
    Agent 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.