Solved Defining metadata of a material

Discussion in 'Spigot Plugin Development' started by OwnedGG, May 29, 2018.

  1. How do i define the Metadata of a Material? I did it like this before when i created a new recipe:

    Code (Text):
    test.setIngredient('*', Material.SAPLING.getNewData((byte) 2));
    but this is not working when i try to define a block with this mthod:

    Code (Text):
    loc.getBlock().setType(Material.SAPLING);

    So please help me to spawn a damn birch sapling @ my defined location :ROFLMAO::ROFLMAO:
     
  2. Block#setData

    Sent from my SM-G903F using Tapatalk
     
  3. thx for reply. do you have an example how you use it.
     
  4. The same way as Block#setType which you were using earlier. The # just means to use it on an instance of a block (technically it doesn't but its commonly used to do that)

    Sent from my SM-G903F using Tapatalk
     
  5. nvm, got it. tought there is a one line solution. ty
     
  6. There basically is (well two lines)
    you did loc.getBlock().setType...
    Also do loc.getBlock().setData...

    At least I think so?

    Sent from my SM-G903F using Tapatalk