public WorldInfo(WorldSettings par1WorldSettings, String par2Str) { terrainType = WorldType.DEFAULT; generatorOptions = ""; theGameRules = new GameRules(); randomSeed = par1WorldSettings.getSeed(); theGameType = par1WorldSettings.getGameType(); mapFeaturesEnabled = par1WorldSettings.isMapFeaturesEnabled(); levelName = par2Str; hardcore = par1WorldSettings.getHardcoreEnabled(); terrainType = par1WorldSettings.getTerrainType(); generatorOptions = par1WorldSettings.func_82749_j(); allowCommands = par1WorldSettings.areCommandsAllowed(); initialized = false; if (useNBXlite) { snowCovered = ODNBXlite.SnowCovered; mapTheme = ODNBXlite.MapTheme; mapGen = ODNBXlite.Generator; mapGenExtra = ODNBXlite.MapFeatures; mapType = ODNBXlite.IndevMapType; indevX = ODNBXlite.IndevWidthX; indevY = ODNBXlite.IndevHeight; indevZ = ODNBXlite.IndevWidthZ; flags = ODNBXlite.getFlags(); structures = ODNBXlite.Structures; surrgroundheight = ODNBXlite.SurrGroundHeight; surrgroundtype = ODNBXlite.SurrGroundType; surrwaterheight = ODNBXlite.SurrWaterHeight; surrwatertype = ODNBXlite.SurrWaterType; cloudheight = ODNBXlite.CloudHeight; skybrightness = ODNBXlite.SkyBrightness; skycolor = ODNBXlite.SkyColor; fogcolor = ODNBXlite.FogColor; cloudcolor = ODNBXlite.CloudColor; nbxlite = true; } }
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")); } }
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); } }
@Override public void populate(IChunkProvider ichunkprovider, int x, int z) { rand.setSeed((long) x * 0x12f88dd3L + (long) z * 0x36d41eecL); int x1 = x << 4; int z1 = z << 4; if (mapFeaturesEnabled) { if (ODNBXlite.Structures[2]) { strongholdGenerator.generateStructuresInChunk(worldObj, rand, x, z); } if (ODNBXlite.Structures[1]) { villageGenerator.generateStructuresInChunk(worldObj, rand, x, z); } if (ODNBXlite.Structures[3]) { mineshaftGenerator.generateStructuresInChunk(worldObj, rand, x, z); } } for (int i = 0; i < 20; i++) { int x2 = x1 + rand.nextInt(16); int y2 = rand.nextInt(128); int z2 = z1 + rand.nextInt(16); (new SuperOldWorldGenMinable(Block.oreCoal.blockID)) .generate_infdev(worldObj, rand, x2, y2, z2); } for (int i = 0; i < 10; i++) { int x2 = x1 + rand.nextInt(16); int y2 = rand.nextInt(64); int z2 = z1 + rand.nextInt(16); (new SuperOldWorldGenMinable(Block.oreIron.blockID)) .generate_infdev(worldObj, rand, x2, y2, z2); } if (rand.nextInt(2) == 0) { int x2 = x1 + rand.nextInt(16); int y2 = rand.nextInt(32); int z2 = z1 + rand.nextInt(16); (new SuperOldWorldGenMinable(Block.oreGold.blockID)) .generate_infdev(worldObj, rand, x2, y2, z2); } if (rand.nextInt(8) == 0) { int x2 = x1 + rand.nextInt(16); int y2 = rand.nextInt(16); int z2 = z1 + rand.nextInt(16); (new SuperOldWorldGenMinable(Block.oreDiamond.blockID)) .generate_infdev(worldObj, rand, x2, y2, z2); } if (ODNBXlite.getFlag("newores")) { for (int i = 0; i < 8; i++) { int x2 = x1 + rand.nextInt(16); int y2 = rand.nextInt(16); int z2 = z1 + rand.nextInt(16); (new SuperOldWorldGenMinable(Block.oreRedstone.blockID)) .generate_infdev(worldObj, rand, x2, y2, z2); } for (int i = 0; i < 1; i++) { int x2 = x1 + rand.nextInt(16); int y2 = rand.nextInt(16) + rand.nextInt(16); int z2 = z1 + rand.nextInt(16); (new SuperOldWorldGenMinable(Block.oreLapis.blockID)) .generate_infdev(worldObj, rand, x2, y2, z2); } int max = 0; detection: for (int i = x1; i < x1 + 16; i++) { for (int j = z1; j < z1 + 16; j++) { int h = worldObj.getPrecipitationHeight(i, j); if (max < h) { max = h; } if (max > 108) { break detection; } } } if (max > 108) { for (int i = 0; i < 3 + rand.nextInt(6); i++) { int x2 = x1 + rand.nextInt(16); int y2 = rand.nextInt(28) + 4; int z2 = z1 + rand.nextInt(16); int id = worldObj.getBlockId(x2, y2, z2); if (id == Block.stone.blockID) { worldObj.setBlock(x2, y2, z2, Block.oreEmerald.blockID); } } } } int trees = (int) (treeGen.func_806_a( (double) x1 * 0.050000000000000003D, (double) z1 * 0.050000000000000003D) - rand.nextDouble()); if (trees < 0) { trees = 0; } WorldGenerator treegen = ODNBXlite.MapFeatures == ODNBXlite.FEATURES_INFDEV0608 ? new OldWorldGenTrees(false) : new OldWorldGenBigTree(); if (rand.nextInt(100) == 0) { trees++; } if (ODNBXlite.MapTheme == ODNBXlite.THEME_WOODS) { trees += 20; } for (int i = 0; i < trees; i++) { int x2 = x1 + rand.nextInt(16) + 8; int z2 = z1 + rand.nextInt(16) + 8; treegen.setScale(1.0D, 1.0D, 1.0D); treegen.generate(worldObj, rand, x2, worldObj.getHeightValue(x2, z2), z2); } spawnAnimals(x * 16, z * 16); }