Solved Get which block a wall sign is at?

Discussion in 'Plugin Development' started by Bobfan, Dec 3, 2012.

  1. Offline


    What method is used to find the block a wall sign is located on? I've tried using Sign s; but I don't know how to initialize it.
  2. What's the context?
  3. First you need to do some sort of check to make sure your sign is a block. You can check the material, the id, whatever floats your boat. Then you can cast the Block's BlockState (Block.getState()) to a Sign.

    Code (Text):
    1. Block b = someBlockOfYourChoice;
    2. if (b.getState() instanceof Sign) {
    3.     Sign s = (Sign) b.getState();
    4.     //Do what you want with your sign.
    5. }
  4. Offline


    Thank you. If you don't check it and it isn't a sign, than it'll show an error

Share This Page