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

Solved How can I disappear the Blocks among the players?

Comments in 'Plugin Development' started by Lexodexo, Jan 5, 2016.

  1. Lexodexo
    Offline

    Lexodexo New Member

    Joined:
    Jan 4, 2016
    Posts:
    11
    Minecraft User:
    Henning
    As with TnTRun merely without TnT?
    Sorry for my bad English:(
  2. Tim // robske Büba
    Offline

    Tim // robske Büba Notable Member

    Joined:
    Feb 26, 2014
    Posts:
    606
    Minecraft User:
    robske_110
    So just for my understanding: You want to spawn a tnt, but the player should not see it?
  3. Lexodexo
    Offline

    Lexodexo New Member

    Joined:
    Jan 4, 2016
    Posts:
    11
    Minecraft User:
    Henning
    No, when the Player stand on a block, the block under the Player should disappear;)
  4. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    This Forum is english only. When talking in another language, use its forum or talk in PM.
    About the code, just replace the block under the player with Air.
    Vaivez66 likes this.
  5. Lexodexo
    Offline

    Lexodexo New Member

    Joined:
    Jan 4, 2016
    Posts:
    11
    Minecraft User:
    Henning
    Now i have a tiny bit of code, but it don't want to funktion..
    I dont have an error message or something else, but when i'am walking in the world, it happens nothing.
    What iam doing wrong?

    Here is my code:
    PHP:
    public function onPlayerMoveEvent(PlayerMoveEvent $event) {
    $level $event->getPlayer()->getLevel();
    //get the coords of the Player
                
    $coords = (round($player->getX()).','.round($player->getY()).','.round($player->getZ()));
                
    //Set Block to id 0
                
    $level->setBlock(new Vector3($coords), Block::get(0));
    }
  6. iDirtPlayzMC
    Offline

    iDirtPlayzMC Active Member

    Joined:
    Apr 10, 2015
    Posts:
    264
    Minecraft User:
    iZenith_xPr
    PHP:
    $player $event->getPlayer();
            
    $direction $player->getDirectionVector();
            
    $x $direction->getX();
            
    $z $direction->getZ();
            
    $block $player->getLevel()->getBlockIdAt($player->getX(), ($player->getY() - 0.5), $player->getZ());
            if(
    $block === 46){ //code
    }
    $level->setBlock(Block::get(0));
  7. Lexodexo
    Offline

    Lexodexo New Member

    Joined:
    Jan 4, 2016
    Posts:
    11
    Minecraft User:
    Henning
    Yeah, but this is not what i want, I want to remove the Block under the Player. HOW CAN I REMOVE THE BLOCK??;)
  8. iDirtPlayzMC
    Offline

    iDirtPlayzMC Active Member

    Joined:
    Apr 10, 2015
    Posts:
    264
    Minecraft User:
    iZenith_xPr
    I posted the code to check the bottom ? do you know how to remove the block ? xD
  9. Lexodexo
    Offline

    Lexodexo New Member

    Joined:
    Jan 4, 2016
    Posts:
    11
    Minecraft User:
    Henning
    That it is!:)
    I know it, but it don't want to function:(
  10. iDirtPlayzMC
    Offline

    iDirtPlayzMC Active Member

    Joined:
    Apr 10, 2015
    Posts:
    264
    Minecraft User:
    iZenith_xPr
    $this->setBlock ?
  11. iDirtPlayzMC
    Offline

    iDirtPlayzMC Active Member

    Joined:
    Apr 10, 2015
    Posts:
    264
    Minecraft User:
    iZenith_xPr
    Thats what he said
  12. iDirtPlayzMC
    Offline

    iDirtPlayzMC Active Member

    Joined:
    Apr 10, 2015
    Posts:
    264
    Minecraft User:
    iZenith_xPr
    \pocketmine\level\Level::setBlock(new Vector3($x, $y, $z), 0);
  13. Tim // robske Büba
    Offline

    Tim // robske Büba Notable Member

    Joined:
    Feb 26, 2014
    Posts:
    606
    Minecraft User:
    robske_110
    Whats wrong with static calls?
  14. Kvetinac97
    Offline

    Kvetinac97 Active Member Plugin Developer

    Joined:
    Nov 17, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    Kvetinac97
    PHP:
    public function onMove(PlayerMoveEvent $ev){
      
    $p $ev->getPlayer();
      
    $lv $p->getLevel();
      
    $b $lv->getBlock($p->getFloorX(), $p->getFloorY()-1$p->getFloorZ());
      if (
    $b->getId() === Block::SAND and $b->getDamage() === 1){ //this is e.g. red sand
        
    $lv->setBlock(new Vector3($b->getFloorX(), $b->getFloorY(), $b->getFloorZ()), Block::get(Block::AIR));
      }
    }
    You can do it also with other methods, i think this is not the best ("nothing isn't best")
  15. wolfdale
    Offline

    wolfdale Active Member Plugin Developer

    Joined:
    Dec 3, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    ace
    The first argument of Level::getBlock() must be instanceof Vector3
    PHP:
    public function onMove(PlayerMoveEvent $ev){
      
    $p $ev->getPlayer();
      
    $lv $p->getLevel();
      
    $b $lv->getBlock($p->subtract(0,1,0)->floor());
      if (
    $b->getId() === Block::SAND and $b->getDamage() === 1){ //this is e.g. red sand
        
    $lv->setBlock($bBlock::get(Block::AIR));
      }
    }

  16. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
  17. Tim // robske Büba
    Offline

    Tim // robske Büba Notable Member

    Joined:
    Feb 26, 2014
    Posts:
    606
    Minecraft User:
    robske_110
    Do you plan to merge your redstone stuff in the original pocketmine?
  18. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
  19. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Why are you so good at going offtopic?
  20. Tim // robske Büba
    Offline

    Tim // robske Büba Notable Member

    Joined:
    Feb 26, 2014
    Posts:
    606
    Minecraft User:
    robske_110
    Because... Nevermind
    @Lexodexo Is this solved now?

Share This Page

Advertisement