Material.DYE

Discussion in 'Spigot Plugin Development' started by maxim_Vla., Jul 12, 2019 at 11:18 AM.

Thread Status:
Not open for further replies.
  1. I cannot access dye through the Itemstack(Material.DYE)

    Also how do you set the data value, like for light blue dye is 12.
     
  2. The site has barely any information on how to use it, it is just a list, I try to use
    Code (Java):
    ItemStack item = new ItemStack(Material.INK_SACK)
    item.setData(12);
    and it sends me an error
     
  3. You are supposed to set the durability to 12, not data.
     
    • Like Like x 1
    • Agree Agree x 1
  4. You can set it after you've created the itemstack or, if you feel that what i'll write here is more cleaner for your code, you can simply set the durability from the ItemStack's constructor like this:

    Code (Java):
    ItemStack item = new ItemStack(Material.INK_SACK, 1, durability here)

    //First argument is the Material
    //Second argument is the amount
    //Third argument is the durability
     
  5. It says I need to do:
    Code (Java):
    ItemStack item = new ItemStack(Material.INK_SACK, 1, (short) 12);
    Is that correct?
     
  6. It tells me the data value must be a short, is that the correct way to put it.
     
    #9 maxim_Vla., Jul 12, 2019 at 12:29 PM
    Last edited: Jul 12, 2019 at 1:49 PM
  7. This statement confirms that you have no clue about basic programming.
     
    • Agree Agree x 1
  8. I have a clue, like a know some stuff, but need to learn a lot. I mean if that bothers you...
     
  9. Plus I have a course on java and Minecraft spigot plugin development which is brand new, so I'll probably stop asking, and start helping if I understand it...
     
  10. Well the main thing on spigot plugin development is not to Spoon Feed (Means that a user that knows java and can help you, should not give the code in order to just copy paste)
     
  11. Yes, learn java before creating plugins and don't dobble post: use the edit button
     
Thread Status:
Not open for further replies.