block.getData()

Discussion in 'Plugin Development' started by Mattie112, Jan 25, 2011.

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

    Mattie112

    Hi,

    I want redstone to react ONLY to yellow wool blocks.
    To set the wool colour to yellow you can use this:
    Code:
    block.setData((byte) 4);
    
    However it seems that if you do a getData on that yellow block you can get diffrent values.
    At first i got a Data value of 14, then is was 12 and now it's 15?!?!

    So: what the ..... is the Data of a block??? And why does it change?
    question no2: If not using getData how can i get the coulour of a wool-block?

    thanks in advance,

    Matthijs
     
  2. Offline

    Shados

    Something like...
    Code:
    ((Wool) block.getState().getData()).getColor();
    
    Haven't tested that or anything, but looking at the Wool and Block interfaces, that looks to be how you do it, assuming you already know block is a wool block.
     
Thread Status:
Not open for further replies.

Share This Page