Get material data

Discussion in 'Plugin Development' started by *-Emax-*, Nov 23, 2013.

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

    *-Emax-*

    Hi, i need to get block data
    for example:

    Code:java
    1.  
    2. Block block = chunk.getBlock(x, y, z);
    3.  
    4. if (block.getType() == Material.WOOD) {
    5. if (//IS OAK) {
    6. // CODE
    7. } else if (//IS SPRUCE) {
    8. // CODE
    9. }
    10. }
    11.  


    i know that there is :
    Code:java
    1.  
    2. block.getData();
    3.  

    but is deprecated ç.ç

    Thank you.
     
  2. Offline

    The_Doctor_123

    Not all deprecated methods can't be used. There is currently no other way to do this, so you must use that method and suppress warnings.
     
  3. Offline

    1Rogue


    There is another way to do this, and it isn't deprecated. Also, suppressing warnings is a horrid practice.

    ( I don't have a link to my example atm, don't have my bookmarks )
     
  4. Offline

    The_Doctor_123

    1Rogue
    Last I checked, you would have to use a deprecated method. You have to use magic numbers in order to set the metadata.
     
  5. Offline

    1Rogue


    Not at all, I made a post somewhere about doing this with wool.
     
  6. Offline

    The_Doctor_123

    1Rogue
    Okay.. so how is it done?
     
  7. Offline

    1Rogue

  8. Offline

    The_Doctor_123

    1Rogue
    I don't think there's anything that would apply to wood.
     
Thread Status:
Not open for further replies.

Share This Page