package com.evilco.mc.nbt.tag;

import com.google.common.collect.ImmutableMap;
import java.util.Map;

public enum TagType {
   BYTE(1, TagByte.class),
   BYTE_ARRAY(7, TagByteArray.class),
   COMPOUND(10, TagCompound.class),
   DOUBLE(6, TagDouble.class),
   END(0, (Class)null),
   FLOAT(5, TagFloat.class),
   INTEGER(3, TagInteger.class),
   INTEGER_ARRAY(11, TagIntegerArray.class),
   LIST(9, TagList.class),
   LONG(4, TagLong.class),
   SHORT(2, TagShort.class),
   STRING(8, TagString.class);

   protected static final Map<Byte, TagType> typeMap;
   public final Class<? extends ITag> tagType;
   public final byte typeID;

   private TagType(int typeID, Class<? extends ITag> type) {
      this.typeID = (byte)typeID;
      this.tagType = type;
   }

   public static TagType valueOf(byte typeID) {
      return (TagType)typeMap.get(typeID);
   }

   static {
      ImmutableMap.Builder<Byte, TagType> mapBuilder = new ImmutableMap.Builder();
      TagType[] var1 = values();
      int var2 = var1.length;

      for(int var3 = 0; var3 < var2; ++var3) {
         TagType type = var1[var3];
         mapBuilder.put(type.typeID, type);
      }

      typeMap = mapBuilder.build();
   }
}
