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

Is there a way with the api to send block change to a client only (not at server side)

Comments in 'Plugin Development' started by blocksandgold, May 15, 2014.

  1. blocksandgold
    Offline

    blocksandgold Active Member

    Joined:
    May 7, 2014
    Posts:
    68
    Minecraft User:
    bifag
    Is there a way with the api to send block change to a client, (but not change the block in the world).
    In bukkit i do it with this command : player.sendBlockChange ?

    Thx
  2. shoghicp
    Offline

    shoghicp Staff Member PocketMine Team

    Joined:
    Aug 22, 2013
    Posts:
    436
    Plugins:
    14
    Minecraft User:
    shoghicp
    You would have to send the packet directly, UpdateBlockPacket.

    Besides, that method you use has been deprecated on the Bukkit API
    LDX likes this.
  3. blocksandgold
    Offline

    blocksandgold Active Member

    Joined:
    May 7, 2014
    Posts:
    68
    Minecraft User:
    bifag
    Yes i know it's deprecated, but i dont know why.
    It's usefull for me. That allow me to show to players the limit of their territory wihout modify the wold.

    UpdateBlockPacket is public and won't be deprecated or deleted in futur version of the API ?
    PEMapModder likes this.
  4. blocksandgold
    Offline

    blocksandgold Active Member

    Joined:
    May 7, 2014
    Posts:
    68
    Minecraft User:
    bifag
    I will test that... thx :)

    $pk = new UpdateBlockPacket;
    $pk->x = $block->x;
    $pk->y = $block->y;
    $pk->z = $block->z;
    $pk->block = $block->getID();
    $pk->meta = $block->getMetadata();
    $player->dataPacket($pk);
  5. blocksandgold
    Offline

    blocksandgold Active Member

    Joined:
    May 7, 2014
    Posts:
    68
    Minecraft User:
    bifag
    I've done it that way :

    private function sendBlockChange(Player $player, Position $position , $blockid) {
    $player->dataPacket(MC_UPDATE_BLOCK, array(
    "x" => $position->x,
    "y" => $position->y,
    "z" => $position->z,
    "block" => $blockid,
    "meta" => 0));
    }

    UpdateBlockPacket was not known by the plugin.
    LDX likes this.
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Same idea long time ago, never started on it (for factions)

Share This Page

Advertisement