Solved How rotate sign ?

Discussion in 'Spigot Plugin Development' started by ProxyBite, Sep 26, 2015.

  1. I want rotate sign (Sign block)
    Code (Text):
       
    Block block = loc.getBlock();
    block.setType(Material.WALL_SIGN);
     
    Because when use this Sign placed in DIRECTION to: SOUTH
    and i want rotate sign with Location "YAW"

    (Sorry but my bad english)
     
  2. One second, I made a plugin that goes thru data values really fast. Let me test it out and get back to you.
     
  3. Ok :8
     
  4. If it is the way I think it is it would be something like:
    (Block).setData((Byte you want to use 1 to 15));
     
  5. i want calculate direction with .. loc.getYaw() (float)
    or you can giveme example ?
     
  6. Hmm if it goes by dataValue perhaps you can make a switch statement?
     
  7. Yet again, I am quite a nub. :p
     
  8. So like make a method for example public void setSouth(Block block){
    (Set block data here)
    }
     
  9. The data value defines it's direction, data value in this case is kind of like yaw.

    (Block).setData(4) Will rotate it 4 1/16th rotations around a circle.
     
    • Like Like x 1
    • Agree Agree x 1
  10. Code (Text):
      public static BlockFace getDirection(Float yaw)
       {
         yaw = Float.valueOf(yaw.floatValue() / 90.0F);
         yaw = Float.valueOf(Math.round(yaw.floatValue()));
         if ((yaw.floatValue() == -4.0F) || (yaw.floatValue() == 0.0F) || (yaw.floatValue() == 4.0F)) {
           return BlockFace.SOUTH;
         }
         if ((yaw.floatValue() == -1.0F) || (yaw.floatValue() == 3.0F)) {
                return BlockFace.EAST;
         }
         if ((yaw.floatValue() == -2.0F) || (yaw.floatValue() == 2.0F)) {
                return BlockFace.NORTH;  }
         if ((yaw.floatValue() == -3.0F) || (yaw.floatValue() == 1.0F)) {
                return BlockFace.WEST;
                }
         return null;
       }
       
    Code (Text):
    BlockFace bf = getDirection(loc.getYaw());

    Now, how set blockface to block?
     
  11. getDirection(Byte byte){
    //Check if byte = so and so
    }
     
  12. but how rotate sign to Direction SOUTH, WEST, EAST, NORTH
     
  13. As TheeNinja said "The data value defines it's direction, data value in this case is kind of like yaw.

    (Block).setData(4) Will rotate it 4 1/16th rotations around a circle."

    Just make methods as you find the direction like setSouth()
     
    • Like Like x 2
  14. ok i try now ;)
     
  15. Thanks fixed.
     
    • Like Like x 1