Get all possible types from a Material

Discussion in 'Plugin Development' started by Machine Maker, Feb 1, 2018.

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

    Machine Maker

    Given a material such as Material.WOOD, is there a way I can get how many different variations on that material. In WOOD's case, it would be 0, 1, 2, 3, 4, 5 for the 6 variations of the planks. I realize I could just check if its WOOD and then I would know there were 6 types but I'd rather not have to do that for wood, wool, carpet, and all the other items that have more than one variation.

    I tried using getMaxDurability() on the Material but that just returns 0 for Material.WOOD.

    Code:
    System.out.println(Material.WOOD.getMaxDurability());
    //prints "0"
     
  2. Offline

    Caderape2

    @X1machinemaker1X This is not the most efficient way, but you can loop 1 to 15, then create the itemstack and check if it's null or not.
     
  3. Offline

    Machine Maker

    you mean 0 to 15 but yeah I get the idea. Might be the best option if theres no method for it
     
Thread Status:
Not open for further replies.

Share This Page