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

[NewAPI] Direction of Sign [SOLVED]

Comments in 'Plugin Development' started by xionbig, Dec 7, 2014.

  1. xionbig
    Offline

    xionbig Active Member Plugin Developer

    Joined:
    Jun 11, 2014
    Posts:
    106
    Plugins:
    2
    Minecraft User:
    NikoZazza
    how do I see the direction of the sign that the player has just placed and replace this sign when the sign does not exist anymore with the code:
    PHP:
    setBlock($pos$block$direct$update);
    (I need for my plugin SignShop)
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    The damage of the block contains the direction.
    xionbig likes this.
  3. xionbig
    Offline

    xionbig Active Member Plugin Developer

    Joined:
    Jun 11, 2014
    Posts:
    106
    Plugins:
    2
    Minecraft User:
    NikoZazza
    Thank you for your help!
    I solved with:
    PHP:
    $event->getBlock()->getDamage();
    but when I put the sign with this code the server puts the sign in the direction 0
    PHP:
     setBlock($pos$block$direct$update); 
    how can I fix this?
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    What params did you pass?
    xionbig likes this.
  5. xionbig
    Offline

    xionbig Active Member Plugin Developer

    Joined:
    Jun 11, 2014
    Posts:
    106
    Plugins:
    2
    Minecraft User:
    NikoZazza
    I pass the params:
    PHP:
    $pos->level->setBlock(new Vector3($pos->x$pos->y$pos->z), Block::get(Block::SIGN_POST), $get["direction"], true);
    $pos is a Position of sign;
    $get["direction"] is the direction of the sign created;
    iJoshuaHD likes this.
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    You can pass $pos directly; no need to make a new Vector3 object. Also, it should be Block::get($id, $damage) not Block::get($id), $damage.

    Also, you should leave $direct as false to make it faster.
    xionbig likes this.
  7. xionbig
    Offline

    xionbig Active Member Plugin Developer

    Joined:
    Jun 11, 2014
    Posts:
    106
    Plugins:
    2
    Minecraft User:
    NikoZazza
    thanks you for the help I have solved this problem with:
    PHP:
    $pos->level->setBlock($posBlock::get(Block::SIGN_POST$get["direction"]), falsetrue);
    I am very happy :) :)
    iksaku, iJoshuaHD and PEMapModder like this.

Share This Page

Advertisement