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

setBlock help?

Comments in 'Plugin Development' started by Radix, Jul 22, 2015.

  1. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    PHP:
    $player->getLevel()->getBlockIdAt($x$y$z);
    Andrey Nazarchuk likes this.
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    It is correct, assuming $pos is a valid Vector3.
    Andrey Nazarchuk likes this.
  3. Andrey Nazarchuk
    Offline

    Andrey Nazarchuk Active Member

    Joined:
    Dec 30, 2013
    Posts:
    332
    Minecraft User:
    digita1eclipse
    PHP:
     $pos = new Vector3($x$y$z$level); 
    Should I have level as a variable in vector3 also?
  4. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
  5. Andrey Nazarchuk
    Offline

    Andrey Nazarchuk Active Member

    Joined:
    Dec 30, 2013
    Posts:
    332
    Minecraft User:
    digita1eclipse
  6. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    So if you want to set a wall to air, how would I do that with a for/while loop? Since no body will be stupid enough to set all 64 blocks to air. My wall is 8*8.
  7. Xenturio
    Offline

    Xenturio Active Member

    Joined:
    Sep 19, 2014
    Posts:
    333
    Minecraft User:
    Xenturio
    like this

    PHP:
    for($i 1;$i 100;$i++)
    {
           for(
    $i1 1;$i1 100;$i1++)
           {
            
    $pos = new Vector3($x+$i$y+$i1$z$level);
            
    $this->getServer()->getLevel()->setBlock($posBLOCK::get(3), falsetrue);
           }
    }
    then u got a 100x100 wall
    PocketKiller and Legoboy0215 like this.

Share This Page

Advertisement