Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to use UpdateBlockPacket?

Comments in 'Plugin Development' started by CraftYourBukkit, May 13, 2015.

  1. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    Hey there, I want to spawn a block only to the Client and don't want to change the world. I thought about using UpdateBlockPacket but it won't change the Block, how do I use it correctly?
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Take a look at the test command for WorldEditArt.
  3. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    I will, thanks!:)
  4. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    Why doesn't this work?
    PHP:
    public function sendBlockChange(Player $playerPosition $position$id){
    $pk = new UpdateBlockPacket();
    $pk->$position->x;
    $pk->$position->y;
    $pk->$position->z;
    $pk->block $id;
    $pk->meta 0;
    $player->dataPacket($pk);
    }
  5. SpiderPig
    Offline

    SpiderPig Active Member

    Joined:
    Sep 21, 2013
    Posts:
    128
    Minecraft User:
    SpiderPig
    Put use pocketmine\network\protocol\UpdateBlockPacket;
  6. xpyctum
    Offline

    xpyctum Active Member Plugin Developer

    Joined:
    Jan 13, 2014
    Posts:
    292
    Plugins:
    4
    Minecraft User:
    tylerdisney
    BLock Position?
  7. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    Everything is imported, but it doesn't update/change the block
  8. SpiderPig
    Offline

    SpiderPig Active Member

    Joined:
    Sep 21, 2013
    Posts:
    128
    Minecraft User:
    SpiderPig
    This is correct
    PHP:
    public function sendBlockChange(Player $playerPosition $position$id){
    $pk = new UpdateBlockPacket;
    $pk->$position->x;
    $pk->$position->y;
    $pk->$position->z;
    $pk->block $id;
    $pk->meta 0;
    $player->dataPacket($pk);
    }
  9. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    Doesn't work.
  10. shoghicp
    Offline

    shoghicp Staff Member PocketMine Team

    Joined:
    Aug 22, 2013
    Posts:
    433
    Plugins:
    14
    Minecraft User:
    shoghicp
    If using 0.11 and PocketMine 1.5, please use Level->sendBlocks()
  11. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    $level->sendBlocks($player, Block::DIAMOND_BLOCK); ? How do I set the coords for the block then?
  12. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder

Share This Page

Advertisement