Solved Having unkown issue with comparing 2 materials!

Discussion in 'Plugin Development' started by Paxination, Jan 5, 2014.

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

    Paxination

    http://pastebin.com/B5LjmzKK

    Notice that I submit a list of materials to the method. These are supposed to be ignored. When it gets to the for(Material) loop, its suppose to ignore if its the same. I have it supply an array as I have mutliple calls to this method with different materials. ATM im only looking for Material.AIR and Material.FIRE in one instance of this, at the same time. I dont want it to store those blocks which are air or fire. I tried comparing the toString() version of the materials and no go. No errors in console at all!
     
  2. Offline

    Paxination

  3. Your logic is wrong. You have to check if it does not equal any of the materials, but currently you just check if it's not one of the materials.
    The easiest thing would be to make a separate method which checks if the block is one of the materials:
    Code:
    [pseudo]
    for(Material mat : materials)
    {
      if block.isMaterial(mat)
          return true
    }
    return false
    Then you can check if that method returns false and if that's the case, add the block.
     
  4. Offline

    Paxination

    Thanks!
     
Thread Status:
Not open for further replies.

Share This Page