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"); } }
/** (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"))); } } }
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")); } }
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")); } }