package org.inventivetalent.nbt;

public class TagID {

	public static final int TAG_END        = 0;
	public static final int TAG_BYTE       = 1;
	public static final int TAG_SHORT      = 2;
	public static final int TAG_INT        = 3;
	public static final int TAG_LONG       = 4;
	public static final int TAG_FLOAT      = 5;
	public static final int TAG_DOUBLE     = 6;
	public static final int TAG_BYTE_ARRAY = 7;
	public static final int TAG_STRING     = 8;
	public static final int TAG_LIST       = 9;
	public static final int TAG_COMPOUND   = 10;
	public static final int TAG_INT_ARRAY  = 11;

	public static int forClass(Class<? extends NBTTag> clazz) {
		return forName(clazz.getSimpleName());
	}

	public static int forName(String name) {
		switch (name) {
			case "ByteArrayTag":
			case "Tag_Byte_Array":
				return TAG_BYTE_ARRAY;
			case "ByteTag":
			case "Tag_Byte":
				return TAG_BYTE;
			case "CompoundTag":
			case "TAG_Compound":
				return TAG_COMPOUND;
			case "DoubleTag":
			case "TAG_Double":
				return TAG_DOUBLE;
			case "EndTag":
			case "TAG_End":
				return TAG_END;
			case "FloatTag":
			case "TAG_Float":
				return TAG_FLOAT;
			case "IntArrayTag":
			case "TAG_Int_Array":
				return TAG_INT_ARRAY;
			case "IntTag":
			case "TAG_Int":
				return TAG_INT;
			case "ListTag":
			case "TAG_List":
				return TAG_LIST;
			case "LongTag":
			case "TAG_Long":
				return TAG_LONG;
			case "ShortTag":
			case "TAG_Short":
				return TAG_SHORT;
			case "StringTag":
			case "TAG_String":
				return TAG_STRING;
			default:
				throw new IllegalArgumentException("Invalid NBTTag name: " + name);
		}
	}

}

@@ -698,16 +698,761 @@
 ));%0A%09%7D%0A%0A
+%09public static int forValueClass(Class%3C?%3E clazz) %7B%0A%09%09if (byte.class.isAssignableFrom(clazz) %7C%7C boolean.class.isAssignableFrom(clazz)) %7B%0A%09%09%09return TAG_BYTE;%0A%09%09%7D%0A%09%09if (short.class.isAssignableFrom(clazz)) %7B%0A%09%09%09return TAG_SHORT;%0A%09%09%7D%0A%09%09if (int.class.isAssignableFrom(clazz)) %7B%0A%09%09%09return TAG_INT;%0A%09%09%7D%0A%09%09if (long.class.isAssignableFrom(clazz)) %7B%0A%09%09%09return TAG_LONG;%0A%09%09%7D%0A%09%09if (float.class.isAssignableFrom(clazz)) %7B%0A%09%09%09return TAG_FLOAT;%0A%09%09%7D%0A%09%09if (double.class.isAssignableFrom(clazz)) %7B%0A%09%09%09return TAG_DOUBLE;%0A%09%09%7D%0A%09%09if (String.class.isAssignableFrom(clazz)) %7B%0A%09%09%09return TAG_STRING;%0A%09%09%7D%0A%09%09if (byte%5B%5D.class.isAssignableFrom(clazz)) %7B%0A%09%09%09return TAG_BYTE_ARRAY;%0A%09%09%7D%0A%09%09if (int%5B%5D.class.isAssignableFrom(clazz)) %7B%0A%09%09%09return TAG_INT_ARRAY;%0A%09%09%7D%0A%09%09return -1;%0A%09%7D%0A%0A
 %09public 

add #forValueClass