Solved How to give acacia logs?

Discussion in 'Spigot Plugin Development' started by JacobUNIQUE, Jul 21, 2018.

  1. I am trying to give out ITEMSTACKS of acacia logs. I tried looking online, but nothing seemed to work. I just kept getting the missing texture texture, and it place an oak log. So how do you specify what log type?


    (I know how to give out itemstacks, i just don't know how to give out certain logs as itemstacks)
     
  2. I'm pretty sure it is just player.getInventory().addItem(new ItemStack(Material.ACACIA_LOG)); in 1.13. So simple. I think 1.12.2 used MaterialData to specify log types without using magic numbers?
     
    • Like Like x 1
  3. could u be more specific on the 1.12.2 side of things ;)
     
  4. Material.ACACIA_LOG is the same. I just looked on the Spigot docs for 1.12 Material class enum and it said so, then again I am on my phone so double check :D
     
    • Friendly Friendly x 1
  5. That isn't for 1.12.2, i think that is for 1.13 because in the same thing i found acacia_pressure_plate
     
  6. Code (Java):
    e.getPlayer().getInventory().addItem(new ItemStack(Material.LOG_2, 64));
    Tested it my own on 1.12.2.
    Please rate me, you will find it below my reply.
     
    • Like Like x 1
  7. For 1.12 it should be new ItemStack(Material.LOG_2)

    (Edit, oh looks I was too slow, but TKUIYEAGER1 is right as well)
     
  8. How do you control what log type with that?
     
  9. Acacia: new ItemStack(Material.LOG_2, amount, (short)0)
    Dark Oak: new ItemStack(Material.LOG_2, amount, (short)1)
     
    • Like Like x 1
    • Winner Winner x 1
  10. How do you control what log type you get?
     
  11. Oak: new ItemStack(Material.LOG, amount, (short)0)
    Spruce: new ItemStack(Material.LOG, amount, (short)1)
    Birch: new ItemStack(Material.LOG, amount, (short)2)
    Jungle: new ItemStack(Material.LOG, amount, (short)3)
    Acacia: new ItemStack(Material.LOG_2, amount, (short)0)
    Dark Oak: new ItemStack(Material.LOG_2, amount, (short)1)
     
    • Informative Informative x 1
  12. The ‘durability’ parameter (i think that’s what they call it) is a short, which is a (primitive) datatype like an int (sort of, not going to explain it here) it’s the ID you see on items. The durability for 159:14 is 14. To write a short in java you MUST cast it, like this: (short) 14.

    It’s the third parameter of ItemStack’s constructor. new ItemStack(type, amount, (short) 14);

    Edit: if you want no durability, either leave it out of set it to (short) 0
     
  13. THIS IS WHAT I REALLY WANTED ALONG WITH THE OTHER STUFF THANK YOU SO MUCH
     
  14. No rating for me I guess
     
    • Like Like x 1
  15. sorry, i forgot, i gave u one
     
  16. Thanks