package org.inventivetalent.npclib.skin;

public enum SkinLayer {

	CAPE(0),
	JACKET(1),
	LEFT_SLEEVE(2),
	RIGHT_SLEEVE(3),
	LEFT_PANTS_LEG(4),
	RIGHT_PANTS_LEG(5),
	HAT(6);

	public static final SkinLayer[] ALL = new SkinLayer[] {
			CAPE,
			JACKET,
			LEFT_SLEEVE,
			RIGHT_SLEEVE,
			LEFT_PANTS_LEG,
			RIGHT_PANTS_LEG,
			HAT };

	private final int id;
	private final int shifted;

	SkinLayer(int id) {
		this.id = id;
		this.shifted = 1 << id;
	}

	public int getID() {
		return this.id;
	}

	public int getShifted() {
		return this.shifted;
	}

}

@@ -35,16 +35,97 @@
 .skin;%0A%0A
+import java.util.ArrayList;%0Aimport java.util.Collection;%0Aimport java.util.List;%0A%0A
 public e
@@ -626,10 +626,622 @@
 ed;%0A%09%7D%0A%0A
+%09public boolean isActive(int value) %7B%0A%09%09return (value & getShifted()) == getShifted();%0A%09%7D%0A%0A%09public static int getValue(Iterable%3CSkinLayer%3E active) %7B%0A%09%09int i = 0;%0A%09%09for (SkinLayer layer : active) %7B%0A%09%09%09i %7C= layer.getShifted();%0A%09%09%7D%0A%09%09return i;%0A%09%7D%0A%0A%09public static int getValue(SkinLayer%5B%5D active) %7B%0A%09%09int i = 0;%0A%09%09for (SkinLayer layer : active) %7B%0A%09%09%09i %7C= layer.getShifted();%0A%09%09%7D%0A%09%09return i;%0A%09%7D%0A%0A%09public static Collection%3CSkinLayer%3E getLayers(int value) %7B%0A%09%09List%3CSkinLayer%3E layers = new ArrayList%3C%3E();%0A%09%09for (SkinLayer layer : values()) %7B%0A%09%09%09if (layer.isActive(value)) %7B layers.add(layer); %7D%0A%09%09%7D%0A%09%09return layers;%0A%09%7D%0A%0A
 %7D%0A

add value conversion methods