Are Materials hashable?

Discussion in 'Plugin Development' started by NathanWolf, Feb 20, 2011.

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


    Anybody know?

    Since they're enums, you can't override the Cloneable interface... but I'm suspecting that hashing a Material will not differentiate by data type (material variants)- anybody tried this?
  2. Offline


    You could call the .hashCode() and .equals() method on them and see what happens.
  3. Offline


    Of course they are
  4. Offline


    Maybe I wasn't entirely clear what I was after.

    I know that Material, as an enum, is hashable- it just uses the data value.

    However, in this case the data value is not a suitable hash, because a Material can also have extra data associated with it, which changes it fundamentally (e.g. wool color).

    Anyway, this is fairly irrelevant now, I created a hashable wrapper class. I really just wanted to chime back in so as not to look like a total idiot. :p
Thread Status:
Not open for further replies.

Share This Page