Cast CraftBlock to specific Material

Discussion in 'Plugin Development' started by spacemoehre, Nov 20, 2014.

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

    spacemoehre

    Hey Guys,
    I want to safe the ClickedBlock in my PlayerInteractListener as Door d (check if it is material.WOODEN_DOOR exists)
    i used this:
    Door d = (Door) e.getClickedBlock();

    But I get a CastException. Does anybody knows how to get this Door?
     
  2. Offline

    mrCookieSlime

    spacemoehre
    You can only cast the BlockState. You can get that by simply attaching getState();
     
  3. Offline

    spacemoehre

  4. Offline

    mrCookieSlime

    spacemoehre
    Block.class includes the method setType which allows you to set a specific material to a block.
     
  5. Offline

    CoolGuy2001

    For the location you can use:
    Code:
    door.getLocation();
    This returns the door`s location.
     
Thread Status:
Not open for further replies.

Share This Page