MaterialData Help

Discussion in 'Plugin Development' started by flyguy23ndm, Feb 23, 2014.

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

    flyguy23ndm

    I need to set the MaterialData for a material and I'm wondering how I would do this. I found the method getMaterial(final int id)​
    Code:java
    1. 564 @Deprecated
    2. 565 public static Material getMaterial(final int id) {
    3. 566 if (byId.length > id && id >= 0) {
    4. 567 return byId[id];
    5. 568 } else {
    6. 569 return null;
    7. 570 }
    8. 571 }

    source : http://jd.bukkit.org/rb/doxygen/d9/db0/Material_8java_source.html

    I'm wondering if you could take that meta data and set a material's metaData to it?
    Or make a new material from that metaData?

    my idea, not syntactical correct but the idea:
    Code:java
    1. public static Material newMaterial(Material mat, byte type)
    2. {
    3. MaterialData data = mat.getNewData(type);
    4. return new Material(data);
    5. }


    does anyone know how to make that idea work?

    With almost all my coding before the answers have been in these forums so I find them awesome and this is my first question on them. Great job guys.
     
Thread Status:
Not open for further replies.

Share This Page