public void setOrCreateGameRule(String key, String ruleValue) { GameRules.Value var3 = (GameRules.Value) this.theGameRules.get(key); if (var3 != null) { var3.setValue(ruleValue); } else { this.addGameRule(key, ruleValue, GameRules.ValueType.ANY_VALUE); } }
/** Return the defined game rules as NBT. */ public NBTTagCompound writeGameRulesToNBT() { NBTTagCompound var1 = new NBTTagCompound(); Iterator var2 = this.theGameRules.keySet().iterator(); while (var2.hasNext()) { String var3 = (String) var2.next(); GameRules.Value var4 = (GameRules.Value) this.theGameRules.get(var3); var1.setString(var3, var4.getGameRuleStringValue()); } return var1; }
public boolean areSameType(String key, GameRules.ValueType otherValue) { GameRules.Value var3 = (GameRules.Value) this.theGameRules.get(key); return var3 != null && (var3.getType() == otherValue || otherValue == GameRules.ValueType.ANY_VALUE); }
public int getInt(String name) { GameRules.Value var2 = (GameRules.Value) this.theGameRules.get(name); return var2 != null ? var2.getInt() : 0; }
/** Gets the boolean Game Rule value. */ public boolean getGameRuleBooleanValue(String name) { GameRules.Value var2 = (GameRules.Value) this.theGameRules.get(name); return var2 != null ? var2.getGameRuleBooleanValue() : false; }
/** Gets the string Game Rule value. */ public String getGameRuleStringValue(String name) { GameRules.Value var2 = (GameRules.Value) this.theGameRules.get(name); return var2 != null ? var2.getGameRuleStringValue() : ""; }