Solved The Material ID of "tree" wood and how to specify which kind it is.

Discussion in 'Spigot Plugin Development' started by PurpleWumbat, May 29, 2017.

  1. Hey guys, as I'm sure you've inferred by the nature of this question, I'm fairly new to plugin coding. For the life of me I can't figure out the material for "tree" wood. Obviously I tried "material.WOOD" but those specify for wooden planks. Additionally how do I then specify from the selection of woods? I try to find answers on my own but sometimes it eludes me. Thank you for taking the time to answer my tedious questions! You guys are awesome!
     
  2. I did some digging and found it's "material.LOG" but how exactly to specify the types, I don't know. Would it look something like this?
    Code (Text):
    block.setType(material.LOG, 1, 3);
     
  3. block.setType(Material.LOG);
    block.setData(3);
     
    • Agree Agree x 1
  4. Code (Text):
    ItemStack wood = new ItemStack(Material.LOG)
    wood.setDurability((short) x) //x = number after the ID:
     
  5. Irrelevant. The Block#setType(...) parameters takes a Material, and not an ItemStack. There is no Block#setType(Material, short durability). Therefor you must use setData to manipulate the block further.

    However, this method is deprecated and I don't know if there is any setDurability.
     
  6. This is from memory so I may be wrong, but something like this may work:
    Code (Text):
    ItemStack itemStack = new ItemStack(Material.LOG, 1, (short) data)

    Sent from my iPhone using Tapatalk
     
  7. I think you have a problem reading, no where does the OP state that its relevant to a block, for all we know it could be either a block or an itemstack that he is referring to. Don't jump to conclusions
     
  8. If it is an itemstack, it's pretty weird that they are explicitly using block in their relevant code. Don't you think? If they meant ItemStack, i also believe they wouldn't use the setType method, and rather just use the constructor.
     
    • Like Like x 1
  9. My apologies, I'm the one that can't read evidently...
    I didn't not that the 2nd message was also from the OP

    Apologies once again
     
    • Friendly Friendly x 1
  10. That should work and should give you a jungle wood log.


    ID: Data Name (Material)

    17 Oak Wood (Material: log)
    17:1 Spruce Wood (Material: log)
    17:2 Birch Wood (Material: log)
    17:3 Jungle Wood (Material: log)
    162 Acacia Wood (Material: log2)
    162:1 Dark Oak Wood (Material: log2)


    For the future: save this link
     
    • Informative Informative x 1
  11. Thanks guys! This stuff really helped!