public <T extends IJsonSerializable> T func_150870_b(StatBase p_150870_1_) { TupleIntJsonSerializable tupleintjsonserializable = (TupleIntJsonSerializable)this.statsData.get(p_150870_1_); return (T)(tupleintjsonserializable != null ? tupleintjsonserializable.getJsonSerializableValue() : null); }
public Map<StatBase, TupleIntJsonSerializable> parseJson(String p_150881_1_) { JsonElement jsonelement = (new JsonParser()).parse(p_150881_1_); if (!jsonelement.isJsonObject()) { return Maps.<StatBase, TupleIntJsonSerializable>newHashMap(); } else { JsonObject jsonobject = jsonelement.getAsJsonObject(); Map<StatBase, TupleIntJsonSerializable> map = Maps.<StatBase, TupleIntJsonSerializable>newHashMap(); for (Entry<String, JsonElement> entry : jsonobject.entrySet()) { StatBase statbase = StatList.getOneShotStat((String)entry.getKey()); if (statbase != null) { TupleIntJsonSerializable tupleintjsonserializable = new TupleIntJsonSerializable(); if (((JsonElement)entry.getValue()).isJsonPrimitive() && ((JsonElement)entry.getValue()).getAsJsonPrimitive().isNumber()) { tupleintjsonserializable.setIntegerValue(((JsonElement)entry.getValue()).getAsInt()); } else if (((JsonElement)entry.getValue()).isJsonObject()) { JsonObject jsonobject1 = ((JsonElement)entry.getValue()).getAsJsonObject(); if (jsonobject1.has("value") && jsonobject1.get("value").isJsonPrimitive() && jsonobject1.get("value").getAsJsonPrimitive().isNumber()) { tupleintjsonserializable.setIntegerValue(jsonobject1.getAsJsonPrimitive("value").getAsInt()); } if (jsonobject1.has("progress") && statbase.func_150954_l() != null) { try { Constructor <? extends IJsonSerializable > constructor = statbase.func_150954_l().getConstructor(new Class[0]); IJsonSerializable ijsonserializable = (IJsonSerializable)constructor.newInstance(new Object[0]); ijsonserializable.fromJson(jsonobject1.get("progress")); tupleintjsonserializable.setJsonSerializableValue(ijsonserializable); } catch (Throwable throwable) { logger.warn("Invalid statistic progress in " + this.statsFile, throwable); } } } map.put(statbase, tupleintjsonserializable); } else { logger.warn("Invalid statistic in " + this.statsFile + ": Don\'t know what " + (String)entry.getKey() + " is"); } } return map; } }
public Class <? extends IJsonSerializable > func_150954_l() { return this.field_150956_d; }
public StatBase func_150953_b(Class <? extends IJsonSerializable > p_150953_1_) { this.field_150956_d = p_150953_1_; return this; }
public Achievement func_150953_b(Class <? extends IJsonSerializable > p_150953_1_) { return (Achievement)super.func_150953_b(p_150953_1_); }
public Class <? extends IJsonSerializable > getSerializableClazz() { return this.serializableClazz; }
public StatBase setSerializableClazz(Class <? extends IJsonSerializable > clazz) { this.serializableClazz = clazz; return this; }
public Achievement setSerializableClazz(Class <? extends IJsonSerializable > clazz) { return (Achievement)super.setSerializableClazz(clazz); }
public Map<StatBase, TupleIntJsonSerializable> parseJson(String p_150881_1_) { JsonElement jsonelement = (new JsonParser()).parse(p_150881_1_); if (!jsonelement.isJsonObject()) { return Maps.<StatBase, TupleIntJsonSerializable>newHashMap(); } else { JsonObject jsonobject = jsonelement.getAsJsonObject(); Map<StatBase, TupleIntJsonSerializable> map = Maps.<StatBase, TupleIntJsonSerializable>newHashMap(); for (Entry<String, JsonElement> entry : jsonobject.entrySet()) { StatBase statbase = StatList.getOneShotStat((String)entry.getKey()); if (statbase != null) { TupleIntJsonSerializable tupleintjsonserializable = new TupleIntJsonSerializable(); if (((JsonElement)entry.getValue()).isJsonPrimitive() && ((JsonElement)entry.getValue()).getAsJsonPrimitive().isNumber()) { tupleintjsonserializable.setIntegerValue(((JsonElement)entry.getValue()).getAsInt()); } else if (((JsonElement)entry.getValue()).isJsonObject()) { JsonObject jsonobject1 = ((JsonElement)entry.getValue()).getAsJsonObject(); if (jsonobject1.has("value") && jsonobject1.get("value").isJsonPrimitive() && jsonobject1.get("value").getAsJsonPrimitive().isNumber()) { tupleintjsonserializable.setIntegerValue(jsonobject1.getAsJsonPrimitive("value").getAsInt()); } if (jsonobject1.has("progress") && statbase.getSerializableClazz() != null) { try { Constructor <? extends IJsonSerializable > constructor = statbase.getSerializableClazz().getConstructor(new Class[0]); IJsonSerializable ijsonserializable = (IJsonSerializable)constructor.newInstance(new Object[0]); ijsonserializable.fromJson(jsonobject1.get("progress")); tupleintjsonserializable.setJsonSerializableValue(ijsonserializable); } catch (Throwable throwable) { LOGGER.warn("Invalid statistic progress in {}", new Object[] {this.statsFile, throwable}); } } } map.put(statbase, tupleintjsonserializable); } else { LOGGER.warn("Invalid statistic in {}: Don\'t know what {} is", new Object[] {this.statsFile, entry.getKey()}); } } return map; } }
public <T extends IJsonSerializable> T getProgress(StatBase p_150870_1_) { TupleIntJsonSerializable tupleintjsonserializable = (TupleIntJsonSerializable)this.statsData.get(p_150870_1_); return (T)(tupleintjsonserializable != null ? tupleintjsonserializable.getJsonSerializableValue() : null); }
public IJsonSerializable func_150870_b(StatBase p_150870_1_) { TupleIntJsonSerializable var2 = (TupleIntJsonSerializable)this.field_150875_a.get(p_150870_1_); return var2 != null ? var2.getJsonSerializableValue() : null; }
public Map func_150881_a(String p_150881_1_) { JsonElement var2 = (new JsonParser()).parse(p_150881_1_); if (!var2.isJsonObject()) { return Maps.newHashMap(); } else { JsonObject var3 = var2.getAsJsonObject(); HashMap var4 = Maps.newHashMap(); Iterator var5 = var3.entrySet().iterator(); while (var5.hasNext()) { Entry var6 = (Entry)var5.next(); StatBase var7 = StatList.func_151177_a((String)var6.getKey()); if (var7 != null) { TupleIntJsonSerializable var8 = new TupleIntJsonSerializable(); if (((JsonElement)var6.getValue()).isJsonPrimitive() && ((JsonElement)var6.getValue()).getAsJsonPrimitive().isNumber()) { var8.setIntegerValue(((JsonElement)var6.getValue()).getAsInt()); } else if (((JsonElement)var6.getValue()).isJsonObject()) { JsonObject var9 = ((JsonElement)var6.getValue()).getAsJsonObject(); if (var9.has("value") && var9.get("value").isJsonPrimitive() && var9.get("value").getAsJsonPrimitive().isNumber()) { var8.setIntegerValue(var9.getAsJsonPrimitive("value").getAsInt()); } if (var9.has("progress") && var7.func_150954_l() != null) { try { Constructor var10 = var7.func_150954_l().getConstructor(new Class[0]); IJsonSerializable var11 = (IJsonSerializable)var10.newInstance(new Object[0]); var8.setJsonSerializableValue(var11); } catch (Throwable var12) { logger.warn("Invalid statistic progress in " + this.field_150887_d, var12); } } } var4.put(var7, var8); } else { logger.warn("Invalid statistic in " + this.field_150887_d + ": Don\'t know what " + (String)var6.getKey() + " is"); } } return var4; } }
@Override public IJsonSerializable func_150870_b(StatBase p_150870_1_) { return new JsonSerializableSet(); }
@Override public IJsonSerializable func_150872_a(StatBase p_150872_1_, IJsonSerializable p_150872_2_) { return new JsonSerializableSet(); }
public IJsonSerializable func_150870_b(StatBase p_150870_1_) { TupleIntJsonSerializable tupleintjsonserializable = (TupleIntJsonSerializable)this.field_150875_a.get(p_150870_1_); return tupleintjsonserializable != null ? tupleintjsonserializable.getJsonSerializableValue() : null; }
public Map func_150881_a(String p_150881_1_) { JsonElement jsonelement = (new JsonParser()).parse(p_150881_1_); if (!jsonelement.isJsonObject()) { return Maps.newHashMap(); } else { JsonObject jsonobject = jsonelement.getAsJsonObject(); HashMap hashmap = Maps.newHashMap(); Iterator iterator = jsonobject.entrySet().iterator(); while (iterator.hasNext()) { Entry entry = (Entry)iterator.next(); StatBase statbase = StatList.func_151177_a((String)entry.getKey()); if (statbase != null) { TupleIntJsonSerializable tupleintjsonserializable = new TupleIntJsonSerializable(); if (((JsonElement)entry.getValue()).isJsonPrimitive() && ((JsonElement)entry.getValue()).getAsJsonPrimitive().isNumber()) { tupleintjsonserializable.setIntegerValue(((JsonElement)entry.getValue()).getAsInt()); } else if (((JsonElement)entry.getValue()).isJsonObject()) { JsonObject jsonobject1 = ((JsonElement)entry.getValue()).getAsJsonObject(); if (jsonobject1.has("value") && jsonobject1.get("value").isJsonPrimitive() && jsonobject1.get("value").getAsJsonPrimitive().isNumber()) { tupleintjsonserializable.setIntegerValue(jsonobject1.getAsJsonPrimitive("value").getAsInt()); } if (jsonobject1.has("progress") && statbase.func_150954_l() != null) { try { Constructor constructor = statbase.func_150954_l().getConstructor(new Class[0]); IJsonSerializable ijsonserializable = (IJsonSerializable)constructor.newInstance(new Object[0]); ijsonserializable.func_152753_a(jsonobject1.get("progress")); tupleintjsonserializable.setJsonSerializableValue(ijsonserializable); } catch (Throwable throwable) { logger.warn("Invalid statistic progress in " + this.field_150887_d, throwable); } } } hashmap.put(statbase, tupleintjsonserializable); } else { logger.warn("Invalid statistic in " + this.field_150887_d + ": Don\'t know what " + (String)entry.getKey() + " is"); } } return hashmap; } }