diff --git a/src/me/libraryaddict/disguise/disguisetypes/AnimalColor.java b/src/me/libraryaddict/disguise/disguisetypes/AnimalColor.java index 08a1fa5a..bf208a70 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/AnimalColor.java +++ b/src/me/libraryaddict/disguise/disguisetypes/AnimalColor.java @@ -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) { diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/SheepWatcher.java b/src/me/libraryaddict/disguise/disguisetypes/watchers/SheepWatcher.java index fb57481f..8452e321 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/watchers/SheepWatcher.java +++ b/src/me/libraryaddict/disguise/disguisetypes/watchers/SheepWatcher.java @@ -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() { diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/WolfWatcher.java b/src/me/libraryaddict/disguise/disguisetypes/watchers/WolfWatcher.java index a579e51d..8f77f553 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/watchers/WolfWatcher.java +++ b/src/me/libraryaddict/disguise/disguisetypes/watchers/WolfWatcher.java @@ -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() {