Fix AnimalColor getting not working properly

This commit is contained in:
libraryaddict 2014-06-02 08:56:18 +12:00
parent d7010c6389
commit 4b55a24444
3 changed files with 11 additions and 2 deletions

View File

@ -4,6 +4,15 @@ public enum AnimalColor {
BLACK(15), BLUE(11), BROWN(12), CYAN(9), GRAY(7), GREEN(13), LIGHT_BLUE(3), LIME(5), MAGENTA(2), ORANGE(1), PINK(6), PURPLE(
10), RED(14), SILVER(8), WHITE(0), YELLOW(4);
public static AnimalColor getColor(int nmsId) {
for (AnimalColor color : values()) {
if (color.getId() == nmsId) {
return color;
}
}
return null;
}
private int value;
private AnimalColor(int newValue) {

View File

@ -11,7 +11,7 @@ public class SheepWatcher extends AgeableWatcher {
}
public AnimalColor getColor() {
return AnimalColor.values()[(Byte) getValue(16, (byte) 0) & 15];
return AnimalColor.getColor((Byte) getValue(16, (byte) 0) & 15);
}
public boolean isSheared() {

View File

@ -10,7 +10,7 @@ public class WolfWatcher extends TameableWatcher {
}
public AnimalColor getCollarColor() {
return AnimalColor.values()[(Byte) getValue(20, (byte) 14)];
return AnimalColor.getColor((Byte) getValue(20, (byte) 14));
}
public boolean isAngry() {