Solved How do you set a material's metadata?

Discussion in 'Plugin Development' started by Gerov, Aug 11, 2014.

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

    Gerov

    Like if I wanted normal sand instead of red sand, I thought you did something like this:

    Code:java
    1. Material m = (Material.SAND, (byte) 2);


    Can someone tell me the right way?
     
  2. Offline

    russjr08

    Well, you can't construct a new Material if I remember correctly, you'll have to use the ItemStack class. So try something like this:

    Code:
    ItemStack redSand = new ItemStack(Material.SAND, 64, 2)
     
    Gerov likes this.
  3. Offline

    Gerov

    russjr08 likes this.
  4. Offline

    AronTheGamer

    Dat does nod wurk

    ItemStack redSand = new ItemStack( Material.SAND, (short) 1, (byte) 1 );
     
  5. Offline

    Gerov



    Ah, okay.
     
Thread Status:
Not open for further replies.

Share This Page