Metadata without magic value deprecation

Discussion in 'Plugin Development' started by john01dav, Aug 16, 2014.

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

    john01dav

    Hello Bukkit! I've been working on a plugin that needs to place coloured hardened clay into the world, but there is a lack of a function to do so without utilizing "Magic values" (look it up if you are unaware of it).

    Current code:
    Code:java
    1. Block b = cube.getA().getWorld().getBlockAt(x, y, z);
    2. b.setType(Material.HARD_CLAY);
    3. b.getMaterialData().setColor(HardClay.RED); //this is the line of code that I cannot figure out the correct method calls for


    I've been googling and looking through JavaDocs looking for a solution for about two hours. Thanks in advance for any answers!
     
  2. john01dav Use the deprecated methods, there's currently no replacement.
     
  3. Offline

    DinosParkour

    john01dav I don't think there's an alternative to .setData();
    BTW, I see you set the block to Hardened Clay but I think you what you meant to do is Stained Clay??
     
  4. Offline

    john01dav

    I'll just go with the setData() method, hopefully there will be something better with 1.8 (I'm pretty sure that Mojang is removing the data IDs completely in that version).
     
Thread Status:
Not open for further replies.

Share This Page