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"); } }
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")); } }
/** Initialises the server and starts it. */ protected boolean startServer() throws IOException { DedicatedServerCommandThread var1 = new DedicatedServerCommandThread(this); var1.setDaemon(true); var1.start(); this.getLogAgent().func_98233_a("Starting minecraft server version 1.6.2"); if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) { this.getLogAgent() .func_98236_b( "To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); } this.getLogAgent().func_98233_a("Loading properties"); this.settings = new PropertyManager(new File("server.properties"), this.getLogAgent()); if (this.isSinglePlayer()) { this.setHostname("127.0.0.1"); } else { this.setOnlineMode(this.settings.getBooleanProperty("online-mode", true)); this.setHostname(this.settings.getStringProperty("server-ip", "")); } this.setCanSpawnAnimals(this.settings.getBooleanProperty("spawn-animals", true)); this.setCanSpawnNPCs(this.settings.getBooleanProperty("spawn-npcs", true)); this.setAllowPvp(this.settings.getBooleanProperty("pvp", true)); this.setAllowFlight(this.settings.getBooleanProperty("allow-flight", false)); this.setTexturePack(this.settings.getStringProperty("texture-pack", "")); this.setMOTD(this.settings.getStringProperty("motd", "A Minecraft Server")); this.func_104055_i(this.settings.getBooleanProperty("force-gamemode", false)); if (this.settings.getIntProperty("difficulty", 1) < 0) { this.settings.setProperty("difficulty", Integer.valueOf(0)); } else if (this.settings.getIntProperty("difficulty", 1) > 3) { this.settings.setProperty("difficulty", Integer.valueOf(3)); } this.canSpawnStructures = this.settings.getBooleanProperty("generate-structures", true); int var2 = this.settings.getIntProperty("gamemode", EnumGameType.SURVIVAL.getID()); this.gameType = WorldSettings.getGameTypeById(var2); this.getLogAgent().func_98233_a("Default game type: " + this.gameType); InetAddress var3 = null; if (this.getServerHostname().length() > 0) { var3 = InetAddress.getByName(this.getServerHostname()); } if (this.getServerPort() < 0) { this.setServerPort(this.settings.getIntProperty("server-port", 25565)); } this.getLogAgent().func_98233_a("Generating keypair"); this.setKeyPair(CryptManager.generateKeyPair()); this.getLogAgent() .func_98233_a( "Starting Minecraft server on " + (this.getServerHostname().length() == 0 ? "*" : this.getServerHostname()) + ":" + this.getServerPort()); try { this.networkThread = new DedicatedServerListenThread(this, var3, this.getServerPort()); } catch (IOException var16) { this.getLogAgent().func_98236_b("**** FAILED TO BIND TO PORT!"); this.getLogAgent() .logWarningFormatted("The exception was: {0}", new Object[] {var16.toString()}); this.getLogAgent().func_98236_b("Perhaps a server is already running on that port?"); return false; } if (!this.isServerInOnlineMode()) { this.getLogAgent().func_98236_b("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!"); this.getLogAgent() .func_98236_b("The server will make no attempt to authenticate usernames. Beware."); this.getLogAgent() .func_98236_b( "While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose."); this.getLogAgent() .func_98236_b( "To change this, set \"online-mode\" to \"true\" in the server.properties file."); } this.setConfigurationManager(new DedicatedPlayerList(this)); long var4 = System.nanoTime(); if (this.getFolderName() == null) { this.setFolderName(this.settings.getStringProperty("level-name", "world")); } String var6 = this.settings.getStringProperty("level-seed", ""); String var7 = this.settings.getStringProperty("level-type", "DEFAULT"); String var8 = this.settings.getStringProperty("generator-settings", ""); long var9 = (new Random()).nextLong(); if (var6.length() > 0) { try { long var11 = Long.parseLong(var6); if (var11 != 0L) { var9 = var11; } } catch (NumberFormatException var15) { var9 = (long) var6.hashCode(); } } WorldType var17 = WorldType.parseWorldType(var7); if (var17 == null) { var17 = WorldType.DEFAULT; } this.setBuildLimit(this.settings.getIntProperty("max-build-height", 256)); this.setBuildLimit((this.getBuildLimit() + 8) / 16 * 16); this.setBuildLimit(MathHelper.clamp_int(this.getBuildLimit(), 64, 256)); this.settings.setProperty("max-build-height", Integer.valueOf(this.getBuildLimit())); this.getLogAgent().func_98233_a("Preparing level \"" + this.getFolderName() + "\""); this.loadAllWorlds(this.getFolderName(), this.getFolderName(), var9, var17, var8); long var12 = System.nanoTime() - var4; String var14 = String.format("%.3fs", new Object[] {Double.valueOf((double) var12 / 1.0E9D)}); this.getLogAgent().func_98233_a("Done (" + var14 + ")! For help, type \"help\" or \"?\""); if (this.settings.getBooleanProperty("enable-query", false)) { this.getLogAgent().func_98233_a("Starting GS4 status listener"); this.theRConThreadQuery = new RConThreadQuery(this); this.theRConThreadQuery.startThread(); } if (this.settings.getBooleanProperty("enable-rcon", false)) { this.getLogAgent().func_98233_a("Starting remote control listener"); this.theRConThreadMain = new RConThreadMain(this); this.theRConThreadMain.startThread(); } // TODO: Hakkit Start. HakkitServer hakkitServer = new HakkitServer(); hakkitServer.setMinecraftServer(this); Hakkit.setServer(hakkitServer); // TODO: Hakkit End return true; }