public static String dumpJson(Map<StatBase, TupleIntJsonSerializable> p_150880_0_) { JsonObject jsonobject = new JsonObject(); for (Entry<StatBase, TupleIntJsonSerializable> entry : p_150880_0_.entrySet()) { if (((TupleIntJsonSerializable)entry.getValue()).getJsonSerializableValue() != null) { JsonObject jsonobject1 = new JsonObject(); jsonobject1.addProperty("value", (Number)Integer.valueOf(((TupleIntJsonSerializable)entry.getValue()).getIntegerValue())); try { jsonobject1.add("progress", ((TupleIntJsonSerializable)entry.getValue()).getJsonSerializableValue().getSerializableElement()); } catch (Throwable throwable) { logger.warn("Couldn\'t save statistic " + ((StatBase)entry.getKey()).getStatName() + ": error serializing progress", throwable); } jsonobject.add(((StatBase)entry.getKey()).statId, jsonobject1); } else { jsonobject.addProperty(((StatBase)entry.getKey()).statId, (Number)Integer.valueOf(((TupleIntJsonSerializable)entry.getValue()).getIntegerValue())); } } return jsonobject.toString(); }
public static String dumpJson(Map<StatBase, TupleIntJsonSerializable> p_150880_0_) { JsonObject jsonobject = new JsonObject(); for (Entry<StatBase, TupleIntJsonSerializable> entry : p_150880_0_.entrySet()) { if (((TupleIntJsonSerializable)entry.getValue()).getJsonSerializableValue() != null) { JsonObject jsonobject1 = new JsonObject(); jsonobject1.addProperty("value", (Number)Integer.valueOf(((TupleIntJsonSerializable)entry.getValue()).getIntegerValue())); try { jsonobject1.add("progress", ((TupleIntJsonSerializable)entry.getValue()).getJsonSerializableValue().getSerializableElement()); } catch (Throwable throwable) { LOGGER.warn("Couldn\'t save statistic {}: error serializing progress", new Object[] {((StatBase)entry.getKey()).getStatName(), throwable}); } jsonobject.add(((StatBase)entry.getKey()).statId, jsonobject1); } else { jsonobject.addProperty(((StatBase)entry.getKey()).statId, (Number)Integer.valueOf(((TupleIntJsonSerializable)entry.getValue()).getIntegerValue())); } } return jsonobject.toString(); }
public static String func_150880_a(Map p_150880_0_) { JsonObject var1 = new JsonObject(); Iterator var2 = p_150880_0_.entrySet().iterator(); while (var2.hasNext()) { Entry var3 = (Entry)var2.next(); if (((TupleIntJsonSerializable)var3.getValue()).getJsonSerializableValue() != null) { JsonObject var4 = new JsonObject(); var4.addProperty("value", Integer.valueOf(((TupleIntJsonSerializable)var3.getValue()).getIntegerValue())); try { var4.add("progress", ((TupleIntJsonSerializable)var3.getValue()).getJsonSerializableValue().getSerializableElement()); } catch (Throwable var6) { logger.warn("Couldn\'t save statistic " + ((StatBase)var3.getKey()).func_150951_e() + ": error serializing progress", var6); } var1.add(((StatBase)var3.getKey()).statId, var4); } else { var1.addProperty(((StatBase)var3.getKey()).statId, Integer.valueOf(((TupleIntJsonSerializable)var3.getValue()).getIntegerValue())); } } return var1.toString(); }
public static String func_150880_a(Map p_150880_0_) { JsonObject jsonobject = new JsonObject(); Iterator iterator = p_150880_0_.entrySet().iterator(); while (iterator.hasNext()) { Entry entry = (Entry)iterator.next(); if (((TupleIntJsonSerializable)entry.getValue()).getJsonSerializableValue() != null) { JsonObject jsonobject1 = new JsonObject(); jsonobject1.addProperty("value", Integer.valueOf(((TupleIntJsonSerializable)entry.getValue()).getIntegerValue())); try { jsonobject1.add("progress", ((TupleIntJsonSerializable)entry.getValue()).getJsonSerializableValue().getSerializableElement()); } catch (Throwable throwable) { logger.warn("Couldn\'t save statistic " + ((StatBase)entry.getKey()).func_150951_e() + ": error serializing progress", throwable); } jsonobject.add(((StatBase)entry.getKey()).statId, jsonobject1); } else { jsonobject.addProperty(((StatBase)entry.getKey()).statId, Integer.valueOf(((TupleIntJsonSerializable)entry.getValue()).getIntegerValue())); } } return jsonobject.toString(); }
/** * Reads the given stat and returns its value as an int. */ public int readStat(StatBase stat) { TupleIntJsonSerializable tupleintjsonserializable = (TupleIntJsonSerializable)this.statsData.get(stat); return tupleintjsonserializable == null ? 0 : tupleintjsonserializable.getIntegerValue(); }
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 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 int writeStat(StatBase par1StatBase) { TupleIntJsonSerializable var2 = (TupleIntJsonSerializable)this.field_150875_a.get(par1StatBase); return var2 == null ? 0 : var2.getIntegerValue(); }
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; } }
public int writeStat(StatBase p_77444_1_) { TupleIntJsonSerializable tupleintjsonserializable = (TupleIntJsonSerializable)this.field_150875_a.get(p_77444_1_); return tupleintjsonserializable == null ? 0 : tupleintjsonserializable.getIntegerValue(); }
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; } }