Exemplo n.º 1
0
  public WorldInfo(NBTTagCompound par1NBTTagCompound) {
    terrainType = WorldType.DEFAULT;
    randomSeed = par1NBTTagCompound.getLong("RandomSeed");

    if (par1NBTTagCompound.hasKey("generatorName")) {
      String s = par1NBTTagCompound.getString("generatorName");
      terrainType = WorldType.parseWorldType(s);

      if (terrainType == null) {
        terrainType = WorldType.DEFAULT;
      } else if (terrainType.isVersioned()) {
        int i = 0;

        if (par1NBTTagCompound.hasKey("generatorVersion")) {
          i = par1NBTTagCompound.getInteger("generatorVersion");
        }

        terrainType = terrainType.getWorldTypeForGeneratorVersion(i);
      }
    }

    theGameType = EnumGameType.getByID(par1NBTTagCompound.getInteger("GameType"));

    if (par1NBTTagCompound.hasKey("MapFeatures")) {
      mapFeaturesEnabled = par1NBTTagCompound.getBoolean("MapFeatures");
    } else {
      mapFeaturesEnabled = true;
    }

    spawnX = par1NBTTagCompound.getInteger("SpawnX");
    spawnY = par1NBTTagCompound.getInteger("SpawnY");
    spawnZ = par1NBTTagCompound.getInteger("SpawnZ");
    worldTime = par1NBTTagCompound.getLong("Time");
    lastTimePlayed = par1NBTTagCompound.getLong("LastPlayed");
    sizeOnDisk = par1NBTTagCompound.getLong("SizeOnDisk");
    levelName = par1NBTTagCompound.getString("LevelName");
    saveVersion = par1NBTTagCompound.getInteger("version");
    rainTime = par1NBTTagCompound.getInteger("rainTime");
    raining = par1NBTTagCompound.getBoolean("raining");
    thunderTime = par1NBTTagCompound.getInteger("thunderTime");
    thundering = par1NBTTagCompound.getBoolean("thundering");
    hardcore = par1NBTTagCompound.getBoolean("hardcore");

    if (par1NBTTagCompound.hasKey("initialized")) {
      initialized = par1NBTTagCompound.getBoolean("initialized");
    } else {
      initialized = true;
    }

    if (par1NBTTagCompound.hasKey("allowCommands")) {
      allowCommands = par1NBTTagCompound.getBoolean("allowCommands");
    } else {
      allowCommands = theGameType == EnumGameType.CREATIVE;
    }

    if (par1NBTTagCompound.hasKey("Player")) {
      playerTag = par1NBTTagCompound.getCompoundTag("Player");
      dimension = playerTag.getInteger("Dimension");
    }
  }
Exemplo n.º 2
0
  private void updateTagCompound(
      NBTTagCompound par1NBTTagCompound, NBTTagCompound par2NBTTagCompound) {
    par1NBTTagCompound.setLong("RandomSeed", randomSeed);
    par1NBTTagCompound.setString("generatorName", terrainType.getWorldTypeName());
    par1NBTTagCompound.setInteger("generatorVersion", terrainType.getGeneratorVersion());
    par1NBTTagCompound.setInteger("GameType", theGameType.getID());
    par1NBTTagCompound.setBoolean("MapFeatures", mapFeaturesEnabled);
    par1NBTTagCompound.setInteger("SpawnX", spawnX);
    par1NBTTagCompound.setInteger("SpawnY", spawnY);
    par1NBTTagCompound.setInteger("SpawnZ", spawnZ);
    par1NBTTagCompound.setLong("Time", worldTime);
    par1NBTTagCompound.setLong("SizeOnDisk", sizeOnDisk);
    par1NBTTagCompound.setLong("LastPlayed", System.currentTimeMillis());
    par1NBTTagCompound.setString("LevelName", levelName);
    par1NBTTagCompound.setInteger("version", saveVersion);
    par1NBTTagCompound.setInteger("rainTime", rainTime);
    par1NBTTagCompound.setBoolean("raining", raining);
    par1NBTTagCompound.setInteger("thunderTime", thunderTime);
    par1NBTTagCompound.setBoolean("thundering", thundering);
    par1NBTTagCompound.setBoolean("hardcore", hardcore);
    par1NBTTagCompound.setBoolean("allowCommands", allowCommands);
    par1NBTTagCompound.setBoolean("initialized", initialized);

    if (par2NBTTagCompound != null) {
      par1NBTTagCompound.setCompoundTag("Player", par2NBTTagCompound);
    }
  }
Exemplo n.º 3
0
 public void a(NBTTagCompound nbttagcompound) {
   super.a(nbttagcompound);
   if (nbttagcompound.b("playerGameType")) {
     // XXX Check this, it was only the last call to this.c.a
     if (MinecraftServer.D().am()) {
       this.c.a(MinecraftServer.D().g());
     } else {
       this.c.a(EnumGameType.a(nbttagcompound.e("playerGameType")));
     }
   }
 }
Exemplo n.º 4
0
  /** (abstract) Protected helper method to read subclass entity data from NBT. */
  public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) {
    super.readEntityFromNBT(par1NBTTagCompound);

    if (par1NBTTagCompound.hasKey("playerGameType")) {
      if (MinecraftServer.getServer().func_104056_am()) {
        this.theItemInWorldManager.setGameType(MinecraftServer.getServer().getGameType());
      } else {
        this.theItemInWorldManager.setGameType(
            EnumGameType.getByID(par1NBTTagCompound.getInteger("playerGameType")));
      }
    }
  }
Exemplo n.º 5
0
  public WorldInfo(NBTTagCompound par1NBTTagCompound) {
    terrainType = WorldType.DEFAULT;
    generatorOptions = "";
    theGameRules = new GameRules();
    randomSeed = par1NBTTagCompound.getLong("RandomSeed");

    if (par1NBTTagCompound.hasKey("generatorName")) {
      String s = par1NBTTagCompound.getString("generatorName");
      terrainType = WorldType.parseWorldType(s);

      if (terrainType == null) {
        terrainType = WorldType.DEFAULT;
      } else if (terrainType.isVersioned()) {
        int i = 0;

        if (par1NBTTagCompound.hasKey("generatorVersion")) {
          i = par1NBTTagCompound.getInteger("generatorVersion");
        }

        terrainType = terrainType.getWorldTypeForGeneratorVersion(i);
      }

      if (par1NBTTagCompound.hasKey("generatorOptions")) {
        generatorOptions = par1NBTTagCompound.getString("generatorOptions");
      }
    }

    theGameType = EnumGameType.getByID(par1NBTTagCompound.getInteger("GameType"));

    if (par1NBTTagCompound.hasKey("MapFeatures")) {
      mapFeaturesEnabled = par1NBTTagCompound.getBoolean("MapFeatures");
    } else {
      if (useNBXlite) {
        mapFeaturesEnabled = ODNBXlite.Generator == ODNBXlite.GEN_NEWBIOMES;
      } else {
        mapFeaturesEnabled = false;
      }
    }

    spawnX = par1NBTTagCompound.getInteger("SpawnX");
    spawnY = par1NBTTagCompound.getInteger("SpawnY");
    spawnZ = par1NBTTagCompound.getInteger("SpawnZ");
    totalTime = par1NBTTagCompound.getLong("Time");

    if (par1NBTTagCompound.hasKey("DayTime")) {
      worldTime = par1NBTTagCompound.getLong("DayTime");
    } else {
      worldTime = totalTime;
    }

    lastTimePlayed = par1NBTTagCompound.getLong("LastPlayed");
    sizeOnDisk = par1NBTTagCompound.getLong("SizeOnDisk");
    levelName = par1NBTTagCompound.getString("LevelName");
    saveVersion = par1NBTTagCompound.getInteger("version");
    rainTime = par1NBTTagCompound.getInteger("rainTime");
    raining = par1NBTTagCompound.getBoolean("raining");
    thunderTime = par1NBTTagCompound.getInteger("thunderTime");
    thundering = par1NBTTagCompound.getBoolean("thundering");
    hardcore = par1NBTTagCompound.getBoolean("hardcore");

    if (par1NBTTagCompound.hasKey("initialized")) {
      initialized = par1NBTTagCompound.getBoolean("initialized");
    } else {
      initialized = true;
    }

    if (par1NBTTagCompound.hasKey("allowCommands")) {
      allowCommands = par1NBTTagCompound.getBoolean("allowCommands");
    } else {
      allowCommands = theGameType == EnumGameType.CREATIVE;
    }
    if (useNBXlite) {
      nbxlite = par1NBTTagCompound.hasKey("NBXlite");
      if (nbxlite) {
        NBTTagCompound nbxliteTag = par1NBTTagCompound.getCompoundTag("NBXlite");
        mapGen = ODNBXlite.getGen(nbxliteTag.getString("Generator"), 0);
        mapGenExtra = ODNBXlite.getGen(nbxliteTag.getString("Generator"), 1);
        snowCovered = ODNBXlite.getGen(nbxliteTag.getString("Generator"), 2) > 0;
        flags = nbxliteTag.getString("Flags");
        if (nbxliteTag.getInteger("Version") < 3) {
          if (nbxliteTag.getString("Generator").endsWith("/jungle")) {
            flags += (flags.length() <= 0) ? "jungle" : ";jungle";
          }
          if (nbxliteTag.getBoolean("NewOres")) {
            flags += (flags.length() <= 0) ? "newores" : ";newores";
          }
        }
        if (nbxliteTag.getInteger("Version") < 4) {
          if (mapGen == ODNBXlite.GEN_NEWBIOMES
              || mapGen == ODNBXlite.GEN_OLDBIOMES
                  && (mapGenExtra == ODNBXlite.FEATURES_BETA15
                      || mapGenExtra == ODNBXlite.FEATURES_BETA173)) {
            flags += (flags.length() <= 0) ? "weather" : ";weather";
          }
        }
        if (nbxliteTag.getInteger("Version") < 5) {
          structures = ODNBXlite.getDefaultStructures(mapFeaturesEnabled, mapGen, mapGenExtra);
        } else {
          structures = new boolean[ODNBXlite.STRUCTURES.length];
          NBTTagCompound structuresTag = nbxliteTag.getCompoundTag("Structures");
          for (int i = 0; i < structures.length; i++) {
            structures[i] = structuresTag.getBoolean(ODNBXlite.STRUCTURES[i]);
          }
        }
        NBTTagCompound themeTag = nbxliteTag.getCompoundTag("Theme");
        if (mapGen == ODNBXlite.GEN_BIOMELESS) {
          mapTheme = themeTag.getInteger("Generation");
          if (nbxliteTag.getInteger("Version") < 2) {
            if (mapTheme == 2) {
              mapTheme = 3;
            } else if (mapTheme == 3) {
              mapTheme = 2;
            }
          }
        } else {
          mapTheme = ODNBXlite.THEME_NORMAL;
        }
        cloudheight = themeTag.getFloat("CloudHeight");
        skybrightness = themeTag.getInteger("SkyBrightness");
        skycolor = themeTag.getInteger("SkyColor");
        fogcolor = themeTag.getInteger("FogColor");
        cloudcolor = themeTag.getInteger("CloudColor");
        if (mapGen == ODNBXlite.GEN_BIOMELESS) {
          if (mapGenExtra == ODNBXlite.FEATURES_INDEV
              || mapGenExtra == ODNBXlite.FEATURES_CLASSIC) {
            NBTTagCompound finiteTag = nbxliteTag.getCompoundTag("Indev");
            indevX = finiteTag.getInteger("X");
            indevY = finiteTag.getInteger("Y");
            indevZ = finiteTag.getInteger("Z");
            surrgroundtype = finiteTag.getInteger("SurroundingGroundType");
            surrwatertype = finiteTag.getInteger("SurroundingWaterType");
            surrgroundheight = finiteTag.getInteger("SurroundingGroundHeight");
            surrwaterheight = finiteTag.getInteger("SurroundingWaterHeight");
            mapType = finiteTag.getInteger("Type");
          }
        }
      }
      if (par1NBTTagCompound.hasKey("snowCovered")) {
        snowCovered = par1NBTTagCompound.getBoolean("snowCovered");
        ODNBXlite.SnowCovered = snowCovered;
      }
      if (par1NBTTagCompound.hasKey("SnowCovered")) {
        snowCovered = par1NBTTagCompound.getBoolean("SnowCovered");
        ODNBXlite.SnowCovered = snowCovered;
      }
    }

    if (par1NBTTagCompound.hasKey("Player")) {
      playerTag = par1NBTTagCompound.getCompoundTag("Player");
      dimension = playerTag.getInteger("Dimension");
    }

    if (par1NBTTagCompound.hasKey("GameRules")) {
      theGameRules.readGameRulesFromNBT(par1NBTTagCompound.getCompoundTag("GameRules"));
    }
  }
Exemplo n.º 6
0
 private void updateTagCompound(
     NBTTagCompound par1NBTTagCompound, NBTTagCompound par2NBTTagCompound) {
   par1NBTTagCompound.setLong("RandomSeed", randomSeed);
   par1NBTTagCompound.setString("generatorName", terrainType.getWorldTypeName());
   par1NBTTagCompound.setInteger("generatorVersion", terrainType.getGeneratorVersion());
   par1NBTTagCompound.setString("generatorOptions", generatorOptions);
   par1NBTTagCompound.setInteger("GameType", theGameType.getID());
   par1NBTTagCompound.setBoolean("MapFeatures", mapFeaturesEnabled);
   par1NBTTagCompound.setInteger("SpawnX", spawnX);
   par1NBTTagCompound.setInteger("SpawnY", spawnY);
   par1NBTTagCompound.setInteger("SpawnZ", spawnZ);
   par1NBTTagCompound.setLong("Time", totalTime);
   par1NBTTagCompound.setLong("DayTime", worldTime);
   par1NBTTagCompound.setLong("SizeOnDisk", sizeOnDisk);
   par1NBTTagCompound.setLong("LastPlayed", MinecraftServer.func_130071_aq());
   par1NBTTagCompound.setString("LevelName", levelName);
   par1NBTTagCompound.setInteger("version", saveVersion);
   par1NBTTagCompound.setInteger("rainTime", rainTime);
   par1NBTTagCompound.setBoolean("raining", raining);
   par1NBTTagCompound.setInteger("thunderTime", thunderTime);
   par1NBTTagCompound.setBoolean("thundering", thundering);
   par1NBTTagCompound.setBoolean("hardcore", hardcore);
   par1NBTTagCompound.setBoolean("allowCommands", allowCommands);
   par1NBTTagCompound.setBoolean("initialized", initialized);
   par1NBTTagCompound.setCompoundTag("GameRules", theGameRules.writeGameRulesToNBT());
   if (nbxlite && useNBXlite) {
     NBTTagCompound nbxliteTag = new NBTTagCompound();
     nbxliteTag.setInteger("Version", NBXLITE_INFO_VERSION);
     nbxliteTag.setString("Generator", ODNBXlite.getGenName(mapGen, mapGenExtra, snowCovered));
     nbxliteTag.setString("Flags", flags);
     NBTTagCompound structuresTag = new NBTTagCompound();
     for (int i = 0; i < structures.length; i++) {
       structuresTag.setBoolean(ODNBXlite.STRUCTURES[i], structures[i]);
     }
     nbxliteTag.setCompoundTag("Structures", structuresTag);
     NBTTagCompound themeTag = new NBTTagCompound();
     themeTag.setInteger("Generation", mapTheme);
     themeTag.setFloat("CloudHeight", cloudheight);
     themeTag.setInteger("SkyColor", skycolor);
     themeTag.setInteger("FogColor", fogcolor);
     themeTag.setInteger("CloudColor", cloudcolor);
     themeTag.setInteger("SkyBrightness", skybrightness);
     nbxliteTag.setCompoundTag("Theme", themeTag);
     if (mapGen == ODNBXlite.GEN_BIOMELESS
         && (mapGenExtra == ODNBXlite.FEATURES_INDEV
             || mapGenExtra == ODNBXlite.FEATURES_CLASSIC)) {
       NBTTagCompound finiteTag = new NBTTagCompound();
       finiteTag.setInteger("X", indevX);
       finiteTag.setInteger("Y", indevY);
       finiteTag.setInteger("Z", indevZ);
       finiteTag.setInteger("Type", mapType);
       finiteTag.setInteger("SurroundingGroundType", ODNBXlite.SurrGroundType);
       finiteTag.setInteger("SurroundingWaterType", ODNBXlite.SurrWaterType);
       finiteTag.setInteger("SurroundingGroundHeight", ODNBXlite.SurrGroundHeight);
       finiteTag.setInteger("SurroundingWaterHeight", ODNBXlite.SurrWaterHeight);
       nbxliteTag.setCompoundTag("Indev", finiteTag);
     }
     par1NBTTagCompound.setCompoundTag("NBXlite", nbxliteTag);
   }
   if (par2NBTTagCompound != null) {
     par1NBTTagCompound.setCompoundTag("Player", par2NBTTagCompound);
   }
 }
Exemplo n.º 7
0
 public void setGameType(EnumGameType par1EnumGameType) {
   this.gameType = par1EnumGameType;
   par1EnumGameType.configurePlayerCapabilities(this.thisPlayerMP.capabilities);
   this.thisPlayerMP.sendPlayerAbilities();
 }
Exemplo n.º 8
0
 public void a(EnumGameType enumgametype) {
   this.c.a(enumgametype);
   this.a.b(new Packet70GameEvent(3, enumgametype.a()));
 }
Exemplo n.º 9
0
  public WorldInfo(NBTTagCompound par1NBTTagCompound) {
    this.terrainType = WorldType.DEFAULT;
    this.generatorOptions = "";
    this.theGameRules = new GameRules();
    this.randomSeed = par1NBTTagCompound.getLong("RandomSeed");

    if (par1NBTTagCompound.hasKey("generatorName")) {
      String var2 = par1NBTTagCompound.getString("generatorName");
      this.terrainType = WorldType.parseWorldType(var2);

      if (this.terrainType == null) {
        this.terrainType = WorldType.DEFAULT;
      } else if (this.terrainType.isVersioned()) {
        int var3 = 0;

        if (par1NBTTagCompound.hasKey("generatorVersion")) {
          var3 = par1NBTTagCompound.getInteger("generatorVersion");
        }

        this.terrainType = this.terrainType.getWorldTypeForGeneratorVersion(var3);
      }

      if (par1NBTTagCompound.hasKey("generatorOptions")) {
        this.generatorOptions = par1NBTTagCompound.getString("generatorOptions");
      }
    }

    this.theGameType = EnumGameType.getByID(par1NBTTagCompound.getInteger("GameType"));

    if (par1NBTTagCompound.hasKey("MapFeatures")) {
      this.mapFeaturesEnabled = par1NBTTagCompound.getBoolean("MapFeatures");
    } else {
      this.mapFeaturesEnabled = true;
    }

    this.spawnX = par1NBTTagCompound.getInteger("SpawnX");
    this.spawnY = par1NBTTagCompound.getInteger("SpawnY");
    this.spawnZ = par1NBTTagCompound.getInteger("SpawnZ");
    this.totalTime = par1NBTTagCompound.getLong("Time");

    if (par1NBTTagCompound.hasKey("DayTime")) {
      this.worldTime = par1NBTTagCompound.getLong("DayTime");
    } else {
      this.worldTime = this.totalTime;
    }

    this.lastTimePlayed = par1NBTTagCompound.getLong("LastPlayed");
    this.sizeOnDisk = par1NBTTagCompound.getLong("SizeOnDisk");
    this.levelName = par1NBTTagCompound.getString("LevelName");
    this.saveVersion = par1NBTTagCompound.getInteger("version");
    this.rainTime = par1NBTTagCompound.getInteger("rainTime");
    this.raining = par1NBTTagCompound.getBoolean("raining");
    this.thunderTime = par1NBTTagCompound.getInteger("thunderTime");
    this.thundering = par1NBTTagCompound.getBoolean("thundering");
    this.hardcore = par1NBTTagCompound.getBoolean("hardcore");

    if (par1NBTTagCompound.hasKey("initialized")) {
      this.initialized = par1NBTTagCompound.getBoolean("initialized");
    } else {
      this.initialized = true;
    }

    if (par1NBTTagCompound.hasKey("allowCommands")) {
      this.allowCommands = par1NBTTagCompound.getBoolean("allowCommands");
    } else {
      this.allowCommands = this.theGameType == EnumGameType.CREATIVE;
    }

    if (par1NBTTagCompound.hasKey("Player")) {
      this.playerTag = par1NBTTagCompound.getCompoundTag("Player");
      this.dimension = this.playerTag.getInteger("Dimension");
    }

    if (par1NBTTagCompound.hasKey("GameRules")) {
      this.theGameRules.readGameRulesFromNBT(par1NBTTagCompound.getCompoundTag("GameRules"));
    }
  }
Exemplo n.º 10
0
 /** Sets the player's game mode and sends it to them. */
 public void setGameType(EnumGameType par1EnumGameType) {
   this.theItemInWorldManager.setGameType(par1EnumGameType);
   this.playerNetServerHandler.sendPacketToPlayer(
       new Packet70GameEvent(3, par1EnumGameType.getID()));
 }