    001    package net.minecraft.src;
    002
    003    import java.util.Collection;
    004    import java.util.Iterator;
    005    import java.util.TreeMap;
    006
    007    public class GameRules
    008    {
    009        private TreeMap field_82771_a = new TreeMap();
    010
    011        public GameRules()
    012        {
    013            this.func_82769_a("doFireTick", "true");
    014            this.func_82769_a("mobGriefing", "true");
    015            this.func_82769_a("keepInventory", "false");
    016            this.func_82769_a("doMobSpawning", "true");
    017            this.func_82769_a("doMobLoot", "true");
    018            this.func_82769_a("doTileDrops", "true");
    019            this.func_82769_a("commandBlockOutput", "true");
    020        }
    021
    022        public void func_82769_a(String par1Str, String par2Str)
    023        {
    024            this.field_82771_a.put(par1Str, new GameRuleValue(par2Str));
    025        }
    026
    027        public void func_82764_b(String par1Str, String par2Str)
    028        {
    029            GameRuleValue var3 = (GameRuleValue)this.field_82771_a.get(par1Str);
    030
    031            if (var3 != null)
    032            {
    033                var3.func_82757_a(par2Str);
    034            }
    035            else
    036            {
    037                this.func_82769_a(par1Str, par2Str);
    038            }
    039        }
    040
    041        public String func_82767_a(String par1Str)
    042        {
    043            GameRuleValue var2 = (GameRuleValue)this.field_82771_a.get(par1Str);
    044            return var2 != null ? var2.func_82756_a() : "";
    045        }
    046
    047        public boolean func_82766_b(String par1Str)
    048        {
    049            GameRuleValue var2 = (GameRuleValue)this.field_82771_a.get(par1Str);
    050            return var2 != null ? var2.func_82758_b() : false;
    051        }
    052
    053        public NBTTagCompound func_82770_a()
    054        {
    055            NBTTagCompound var1 = new NBTTagCompound("GameRules");
    056            Iterator var2 = this.field_82771_a.keySet().iterator();
    057
    058            while (var2.hasNext())
    059            {
    060                String var3 = (String)var2.next();
    061                GameRuleValue var4 = (GameRuleValue)this.field_82771_a.get(var3);
    062                var1.setString(var3, var4.func_82756_a());
    063            }
    064
    065            return var1;
    066        }
    067
    068        public void func_82768_a(NBTTagCompound par1NBTTagCompound)
    069        {
    070            Collection var2 = par1NBTTagCompound.getTags();
    071            Iterator var3 = var2.iterator();
    072
    073            while (var3.hasNext())
    074            {
    075                NBTBase var4 = (NBTBase)var3.next();
    076                String var5 = var4.getName();
    077                String var6 = par1NBTTagCompound.getString(var4.getName());
    078                this.func_82764_b(var5, var6);
    079            }
    080        }
    081
    082        public String[] func_82763_b()
    083        {
    084            return (String[])this.field_82771_a.keySet().toArray(new String[0]);
    085        }
    086
    087        public boolean func_82765_e(String par1Str)
    088        {
    089            return this.field_82771_a.containsKey(par1Str);
    090        }
    091    }