Solved Are these leaves player placed or not?

Discussion in 'Plugin Development' started by ryanhamshire, Oct 1, 2012.

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

    ryanhamshire

    I know Minecraft tracks whether leaves are placed by players or not, because placed leaves don't decay when not near logs, while natural leaves do. Does Bukkit make this information available? I think I vaguely remember seeing it somewhere in the JavaDocs, but now that I've gone back and looked for it, I can't find it.

    Does anyone know how I can determine whether a leaf block was placed by a player or not?

    Thanks very much! :)
     
  2. Offline

    Comphenix

    By looking at the data values page on Minecraft Wiki, you can determine the meaning of a block's data field:

    So, get the block's data value with getData(), and test if bit 4 is set:
    Code:
    if ((block.getData() & 0x4) != 0) {
      // Player set
    }
     
    Radyth, Muizers, ryanhamshire and 2 others like this.
  3. Offline

    ryanhamshire

    Thank you so much! :)
     
Thread Status:
Not open for further replies.

Share This Page