Differ between Block ID's

Discussion in 'Plugin Development' started by Doodlemeat, May 24, 2014.

Thread Status:
Not open for further replies.
  1. I am using bukkit 1.7.9 Snapshot 2.

    I can't find a way to differ between an oak log or a birch log in my BlockBreakEvent.
    There is only two material, LOG and LOG2.
    But there is two metods of the block object called getId() and getTypeId(), but they are deprecated, which means I am not going to use them.
    Is there any way for me to tell if this block is for example birch, dark oak, oak, acacia, jungle or spruce
     
  2. Doodlemeat Even though they are deprecated, it doesn't mean that you shouldn't use it. It has mainly been deprecated due to the fact that new item ID's and block ID's are going to be added, except it's highly unlikely that that will replace, for example, block ID 3 with the new SlimeBlock, so it's pretty much safe to use those deprecated methods. Also, for getting specific types of a block (e.g. wool color/wood type), you can use .getData(); to get the byte data value.
     
  3. Offline

    minoneer

    The original 4 wood types are Material.LOG, the two new ones (dark oak and acacia) are Material.LOG2. You'll get that Material with Block#getType().

    If you want to distinguish between the different wood types, you'll have to use the Block#getData() - which is indeed deprecated but afaik has no alternative.
     
Thread Status:
Not open for further replies.

Share This Page