Block Data Values

Discussion in 'Plugin Development' started by Basaa, Oct 13, 2011.

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

    Basaa

    Hello everyone,

    How can I detect if a block is a sticky piston or red wool?

    Bas
     
  2. A sticky piston base is actually an own block id and is not a data value.
    (For reference: http://www.minecraftwiki.net/wiki/Data_values)
    For colored wool, use block.getData() and cast it to Wool, then you have the required methods to perform your checks.
     
  3. Offline

    Don Redhorse

  4. If (block.getTypeId == 35 && block.getData == (byte) 14) {
    //red wool
    }
     
  5. Oh yeah, block.getData() returns the raw value, what I in fact meant is that: block.getState().getData().

    Make sure to save the state in a variable and update it when you modify it, though.
     
  6. Offline

    Afforess

    In my humble opinion, bukkit handles data with blocks poorly. Expect to begin memorizing random values.

    Or use Spout. Spout has a great block API. Your problem would be this easy with Spout:

    block.getMaterial().equals(MaterialData.redWool)
     
    ZNickq likes this.
Thread Status:
Not open for further replies.

Share This Page