public static NBTBase func_130104_b(DataInput p_130104_0_, int p_130104_1_) throws IOException { byte var2 = p_130104_0_.readByte(); if(var2 == 0) { return new NBTTagEnd(); } else { String var3 = p_130104_0_.readUTF(); NBTBase var4 = func_74733_a(var2, var3); try { var4.func_74735_a(p_130104_0_, p_130104_1_); return var4; } catch (IOException var8) { CrashReport var6 = CrashReport.func_85055_a(var8, "Loading NBT data"); CrashReportCategory var7 = var6.func_85058_a("NBT Tag"); var7.func_71507_a("Tag name", var3); var7.func_71507_a("Tag type", Byte.valueOf(var2)); throw new ReportedException(var6); } } }
public static NBTBase newTag(byte type){ switch (type) { case 0: return new NBTTagEnd(); case 1: return new NBTTagByte((byte) 0); case 2: return new NBTTagShort(); case 3: return new NBTTagInt(0); case 4: return new NBTTagLong(0); case 5: return new NBTTagFloat(0); case 6: return new NBTTagDouble(0); case 7: return new NBTTagByteArray(new byte[0]); case 8: return new NBTTagString(""); case 9: return new NBTTagList(); case 10: return new NBTTagCompound(); case 11: return new NBTTagIntArray(new int[0]); default: return null; } }
public static NBTBase func_74733_a(byte p_74733_0_, String p_74733_1_) { switch(p_74733_0_) { case 0: return new NBTTagEnd(); case 1: return new NBTTagByte(p_74733_1_); case 2: return new NBTTagShort(p_74733_1_); case 3: return new NBTTagInt(p_74733_1_); case 4: return new NBTTagLong(p_74733_1_); case 5: return new NBTTagFloat(p_74733_1_); case 6: return new NBTTagDouble(p_74733_1_); case 7: return new NBTTagByteArray(p_74733_1_); case 8: return new NBTTagString(p_74733_1_); case 9: return new NBTTagList(p_74733_1_); case 10: return new NBTTagCompound(p_74733_1_); case 11: return new NBTTagIntArray(p_74733_1_); default: return null; } }
private NBTBase deserializeType(byte type, JsonElement tag, JsonDeserializationContext context){ NBTBase value; //there may be a better way switch(type){ case 0: value= context.deserialize(tag, NBTTagEnd.class); break; case 1: value = context.deserialize(tag, NBTTagByte.class); break; case 2: value = context.deserialize(tag, NBTTagShort.class); break; case 3: value = context.deserialize(tag, NBTTagInt.class); break; case 4: value = context.deserialize(tag, NBTTagLong.class); break; case 5: value = context.deserialize(tag, NBTTagFloat.class); break; case 6: value = context.deserialize(tag, NBTTagDouble.class); break; case 7: value = context.deserialize(tag, NBTTagByteArray.class); break; case 8: value = context.deserialize(tag, NBTTagString.class); break; case 9: value = context.deserialize(tag, NBTTagList.class); break; case 10: value = context.deserialize(tag, NBTTagCompound.class); break; case 11: value = context.deserialize(tag, NBTTagIntArray.class); break; default: value = context.deserialize(tag, NBTBase.class); } return value; }