Solved Stupid question time- getting a Lever given a Block

Discussion in 'Plugin Development' started by dibujaron, Mar 3, 2013.

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

    dibujaron

    Hello. It's late, I'm tired, my dog is snoring on my bed behind me and making me even sleepier. I know I should know how to do this, but I don't, so here I am.

    Given a block that I have already verified is a lever, how can I get the Lever object of it? I need to be able to tell what surface the lever is attatched to and if it is powered or not, so I think I need the Lever object, but correct me if I am wrong.

    Again, stupid question, I know, don't judge me :D Also, if you could provide an example, I find that examples speak louder than explanations.

    Thanks!
     
  2. You convert its data value to Lever object:
    Code:
    Lever lever = new Lever(0, block.getData());
    0 is the block type, it's not used by any of the Lever methods so you can set it to 0 or if you want to be consistent set it to block.getTypeId() :p
     
  3. Offline

    dibujaron

    Wow, wasn't so stupid after all. Thanks very much!
     
Thread Status:
Not open for further replies.

Share This Page