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

Setting blocks error help

Comments in 'Plugin Development' started by BalAnce, Mar 15, 2015.

  1. BalAnce
    Offline

    BalAnce Active Member

    Joined:
    Mar 10, 2015
    Posts:
    125
    Minecraft User:
    BalAnce
    Currently trying to set a block using the following code:
    Code:
    $sender->sendMessage("Making Blocks! :D");
     $x = $sender->x;
     $y = $sender->z - 1;
    $z = $sender->z;
    $pos = new Vector3($x, $y, $z);
     $block = 5;
    $level = $sender->getLevel();
    $level->setBlock($pos, $block);
    currently getting this error:
    Code:
    [CRITICAL] Unhandled exception executing command 'blocks' in Blocks: Class FirstPlugin\Vector3 not found
    20:43:13 [CRITICAL] ClassNotFoundException: "Class FirstPlugin\Vector3 not found" (EXCEPTION) in "/src/spl/BaseClassLoader" at line 122
    Thanks in advance! :D
  2. BalAnce
    Offline

    BalAnce Active Member

    Joined:
    Mar 10, 2015
    Posts:
    125
    Minecraft User:
    BalAnce
    bump
  3. luca28pet
    Offline

    luca28pet Active Member

    Joined:
    Feb 20, 2014
    Posts:
    251
    Minecraft User:
    luca28pet
    Remember to:
    PHP:
     use pocketmine\math\Vector3;
    use 
    pocketmine\block\Block
    $block should be a block object:
    PHP:
     $block Block::get(50); 
    PEMapModder, EvolSoft and BalAnce like this.
  4. ButterCoder
    Offline

    ButterCoder New Member

    Joined:
    Jun 18, 2015
    Posts:
    8
    Minecraft User:
    ButterCoder
    I think the "$y = $sender->Z - 1;" needs to be this
    " $y = $sender->y - 1; "

Share This Page

Advertisement