Fix AnimalColor getting not working properly
This commit is contained in:
		| @@ -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( |     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); |             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 int value; | ||||||
|  |  | ||||||
|     private AnimalColor(int newValue) { |     private AnimalColor(int newValue) { | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ public class SheepWatcher extends AgeableWatcher { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     public AnimalColor getColor() { |     public AnimalColor getColor() { | ||||||
|         return AnimalColor.values()[(Byte) getValue(16, (byte) 0) & 15]; |         return AnimalColor.getColor((Byte) getValue(16, (byte) 0) & 15); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public boolean isSheared() { |     public boolean isSheared() { | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ public class WolfWatcher extends TameableWatcher { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     public AnimalColor getCollarColor() { |     public AnimalColor getCollarColor() { | ||||||
|         return AnimalColor.values()[(Byte) getValue(20, (byte) 14)]; |         return AnimalColor.getColor((Byte) getValue(20, (byte) 14)); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public boolean isAngry() { |     public boolean isAngry() { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user