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

Problems with sendblocks

Comments in 'Plugin Development' started by aliuly, Jun 4, 2015.

  1. aliuly
    Offline

    aliuly Notable Member Plugin Developer

    Joined:
    Feb 8, 2014
    Posts:
    1,086
    Plugins:
    17
    I have this code:

    PHP:
         $sndblks = [];
           foreach(
    $blocks as $i=>$block){
             list(
    $x,$y,$z)=array_map("intval"explode("."$i));
             
    $sndblks[] = Block::get($block->getId(),$block->getDamage(),
                             new 
    Position($x,$y,$z,$l));
           }
           
    $l->sendBlocks($l->getChunkPlayers($pl->getX()>>4,$pl->getZ()>>4),
                     
    $sndblksUpdateBlockPacket::FLAG_ALL_PRIORITY);
    Sometimes it works, sometimes it doesn't. Anybody can spot the problem? This is intended to run on PocketMine 1.5.

    Full code is here: https://github.com/alejandroliu/bad-plugins/blob/master/ToyBox/src/aliuly/toybox/MagicCarpet.php#L68
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    What about using ":" instead of "."?
    aliuly likes this.
  3. aliuly
    Offline

    aliuly Notable Member Plugin Developer

    Joined:
    Feb 8, 2014
    Posts:
    1,086
    Plugins:
    17
    That worked.

    I am actually surprised that it was the problem.
    Legoboy0215 likes this.
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I was thinking if there may be some, like, `.0` or even non-rounded things.

Share This Page

Advertisement