Get Material with custom MaterialData form Config

Discussion in 'Spigot Plugin Development' started by WAS, Apr 13, 2017.

  1. WAS


    How does one go about creating a Material with a applied MaterialData from a config.

    For example you have something set like
    Code (YAML):
    material: STONE
    : 1
    Where the data would be 1 for Granite. Not sure if really this sick or just being dumb.

    Or even simpler config
    Code (YAML):
    item: 1:1
  2. NathanWolf


    There isn't a non-deprecated way to do it, but the deprecated methods work just fine. You can use either of the MaterialData constructors that take a byte, for instance:, byte)

    For items, you'd set the "damage" field in the ItemStack constructor:, int, short)

    For Blocks, there is a deprecated setData method:
  3. WAS


    Hmm. So in general there is a whole lot of bs custom checking to make sure you have the right material to get or set the right data?

    Again what is with all the deprecation without standardization. If nothing exists to replace it, you don't mark it deprecated. x.x