MineLittlePony/src/main/java/com/minelittlepony/pony/data/ITriggerPixelMapped.java
2018-04-25 13:00:18 +02:00

14 lines
465 B
Java

package com.minelittlepony.pony.data;
public interface ITriggerPixelMapped<T extends Enum<T> & ITriggerPixelMapped<T>> {
int getTriggerPixel();
@SuppressWarnings("unchecked")
public static <T extends Enum<T> & ITriggerPixelMapped<T>> T getByTriggerPixel(T type, int pixelValue) {
for (T i : (T[])type.getClass().getEnumConstants()) {
if (i.getTriggerPixel() == pixelValue) return i;
}
return type;
}
}