Solved Get which block a wall sign is at?

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

Thread Status:
Not open for further replies.
  1. Offline

    Bobfan

    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. Offline

    Tirelessly

    What's the context?
     
  3. Offline

    evilmidget38

    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.

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

    Bobfan

    Thank you. If you don't check it and it isn't a sign, than it'll show an error
     
Thread Status:
Not open for further replies.

Share This Page