Set lever direction

Discussion in 'Plugin Development' started by gmfreaky, Apr 8, 2011.

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

    gmfreaky

    I've looked up on the wiki on how to set the direction of a lever. Didn't manage to get it working, the most logical it would be for me to do:

    Code:
    redblock.setType(Material.LEVER.setFacingDirection(BlockFace.DOWN));    
    But it says that it can't convert Material to Lever. Anyone knows how to do this?
     
  2. Offline

    Ne0nx3r0

    You've just got the chain a little inverted:

    Code:
    redblock.setType(Material.LEVER)
    redblock.setFacingDirection(BlockFace.DOWN);
    
    Chaining them might also work, but I'm not sure.

    I don't think you can face 'down', but give it a shot, heh.
     
  3. Offline

    gmfreaky

    Thanks, but that doesn't work. redblock is a 'Block', and it cant convert from Block to lever when I try to cast.
     
  4. Offline

    Ne0nx3r0

    Oh right right...

    Code:
    Lever myLever = (Lever) redblock;
    
    Btw, the word lever has now lost all meaning for me temporarily, and I can't even figure out if that's the correct way to spell it, heh.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 13, 2016
Thread Status:
Not open for further replies.

Share This Page