protected void loadAllWorlds(String p_71247_1_, String p_71247_2_, long p_71247_3_, WorldType p_71247_5_, String p_71247_6_) { this.convertMapIfNeeded(p_71247_1_); ISaveHandler isavehandler = this.getActiveAnvilConverter().getSaveLoader(p_71247_1_, true); WorldServer overWorld = (isDemo() ? new DemoWorldServer(this, isavehandler, p_71247_2_, 0, theProfiler) : new WorldServer(this, isavehandler, p_71247_2_, 0, theWorldSettings, theProfiler)); for (int dim : DimensionManager.getStaticDimensionIDs()) { WorldServer world = (dim == 0 ? overWorld : new WorldServerMulti(this, isavehandler, p_71247_2_, dim, theWorldSettings, overWorld, theProfiler)); world.addWorldAccess(new WorldManager(this, world)); if (!this.isSinglePlayer()) { world.getWorldInfo().setGameType(getGameType()); } MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(world)); } this.getConfigurationManager().setPlayerManager(new WorldServer[]{ overWorld }); this.func_147139_a(this.func_147135_j()); this.initialWorldChunkLoad(); }
protected void loadAllWorlds(String par1Str, String par2Str, long par3, WorldType par5WorldType, String par6Str) { this.convertMapIfNeeded(par1Str); ISaveHandler isavehandler = this.getActiveAnvilConverter().getSaveLoader(par1Str, true); WorldServer overWorld = (isDemo() ? new DemoWorldServer(this, isavehandler, par2Str, 0, theProfiler, getLogAgent()) : new WorldServer(this, isavehandler, par2Str, 0, theWorldSettings, theProfiler, getLogAgent())); for (int dim : DimensionManager.getStaticDimensionIDs()) { WorldServer world = (dim == 0 ? overWorld : new WorldServerMulti(this, isavehandler, par2Str, dim, theWorldSettings, overWorld, theProfiler, getLogAgent())); world.addWorldAccess(new WorldManager(this, world)); if (!this.isSinglePlayer()) { world.getWorldInfo().setGameType(this.getGameType()); } MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(world)); } this.getConfigurationManager().setPlayerManager(new WorldServer[]{ overWorld }); this.setDifficultyForAllWorlds(this.getDifficulty()); this.initialWorldChunkLoad(); }
public static void initDimension(int dim) { WorldServer overworld = getWorld(0); if (overworld == null) { throw new RuntimeException("Cannot Hotload Dim: Overworld is not Loaded!"); } try { DimensionManager.getProviderType(dim); } catch (Exception e) { System.err.println("Cannot Hotload Dim: " + e.getMessage()); return; // If a provider hasn't been registered then we can't hotload the dim } MinecraftServer mcServer = overworld.func_73046_m(); ISaveHandler savehandler = overworld.func_72860_G(); WorldSettings worldSettings = new WorldSettings(overworld.func_72912_H()); WorldServer world = (dim == 0 ? overworld : new WorldServerMulti(mcServer, savehandler, overworld.func_72912_H().func_76065_j(), dim, worldSettings, overworld, mcServer.field_71304_b)); world.func_72954_a(new WorldManager(mcServer, world)); MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(world)); if (!mcServer.func_71264_H()) { world.func_72912_H().func_76060_a(mcServer.func_71265_f()); } mcServer.func_147139_a(mcServer.func_147135_j()); }
public static void initDimension(int dim) { WorldServer overworld = getWorld(0); if (overworld == null) { throw new RuntimeException("Cannot Hotload Dim: Overworld is not Loaded!"); } try { DimensionManager.getProviderType(dim); } catch (Exception e) { System.err.println("Cannot Hotload Dim: " + e.getMessage()); return; // If a provider hasn't been registered then we can't hotload the dim } MinecraftServer mcServer = overworld.func_73046_m(); ISaveHandler savehandler = overworld.getSaveHandler(); WorldSettings worldSettings = new WorldSettings(overworld.getWorldInfo()); WorldServer world = (dim == 0 ? overworld : new WorldServerMulti(mcServer, savehandler, overworld.getWorldInfo().getWorldName(), dim, worldSettings, overworld, mcServer.theProfiler)); world.addWorldAccess(new WorldManager(mcServer, world)); MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(world)); if (!mcServer.isSinglePlayer()) { world.getWorldInfo().setGameType(mcServer.getGameType()); } mcServer.func_147139_a(mcServer.func_147135_j()); }
protected void func_71247_a(String p_71247_1_, String p_71247_2_, long p_71247_3_, WorldType p_71247_5_, String p_71247_6_) { this.func_71237_c(p_71247_1_); this.field_71305_c = new WorldServer[3]; this.field_71312_k = new long[this.field_71305_c.length][100]; ISaveHandler var7 = this.func_71254_M().func_75804_a(p_71247_1_, true); for(int var8 = 0; var8 < this.field_71305_c.length; ++var8) { byte var9 = 0; if(var8 == 1) { var9 = -1; } if(var8 == 2) { var9 = 1; } if(var8 == 0) { if(this.func_71242_L()) { this.field_71305_c[var8] = new DemoWorldServer(this, var7, p_71247_2_, var9, this.field_71304_b, this.func_98033_al()); } else { this.field_71305_c[var8] = new WorldServer(this, var7, p_71247_2_, var9, this.field_71350_m, this.field_71304_b, this.func_98033_al()); } } else { this.field_71305_c[var8] = new WorldServerMulti(this, var7, p_71247_2_, var9, this.field_71350_m, this.field_71305_c[0], this.field_71304_b, this.func_98033_al()); } this.field_71305_c[var8].func_72954_a(new WorldManager(this, this.field_71305_c[var8])); this.func_71203_ab().func_72364_a(this.field_71305_c); } this.func_71226_c(this.func_71232_g()); this.func_71222_d(); }
public static void initDimension(int dim) { WorldServer overworld = getWorld(0); if (overworld == null) { throw new RuntimeException("Cannot Hotload Dim: Overworld is not Loaded!"); } try { DimensionManager.getProviderType(dim); } catch (Exception e) { System.err.println("Cannot Hotload Dim: " + e.getMessage()); return; // If a provider hasn't been registered then we can't hotload the dim } MinecraftServer mcServer = overworld.getMinecraftServer(); ISaveHandler savehandler = overworld.getSaveHandler(); WorldSettings worldSettings = new WorldSettings(overworld.getWorldInfo()); WorldServer world = (dim == 0 ? overworld : new WorldServerMulti(mcServer, savehandler, overworld.getWorldInfo().getWorldName(), dim, worldSettings, overworld, mcServer.theProfiler, overworld.getWorldLogAgent())); world.addWorldAccess(new WorldManager(mcServer, world)); MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(world)); if (!mcServer.isSinglePlayer()) { world.getWorldInfo().setGameType(mcServer.getGameType()); } mcServer.setDifficultyForAllWorlds(mcServer.getDifficulty()); }
protected void loadAllWorlds(String par1Str, String par2Str, long par3, WorldType par5WorldType, String par6Str) { this.convertMapIfNeeded(par1Str); ISaveHandler var7 = this.getActiveAnvilConverter().getSaveLoader(par1Str, true); if (Reflector.DimensionManager.exists()) { Object var8 = this.isDemo() ? new DemoWorldServer(this, var7, par2Str, 0, this.theProfiler) : new WorldServerOF(this, var7, par2Str, 0, this.theWorldSettings, this.theProfiler); Integer[] var9 = (Integer[])((Integer[])Reflector.call(Reflector.DimensionManager_getStaticDimensionIDs, new Object[0])); Integer[] arr$ = var9; int len$ = var9.length; for (int i$ = 0; i$ < len$; ++i$) { int dim = arr$[i$].intValue(); Object world = dim == 0 ? var8 : new WorldServerMultiOF(this, var7, par2Str, dim, this.theWorldSettings, (WorldServer)var8, this.theProfiler); ((WorldServer)world).addWorldAccess(new WorldManager(this, (WorldServer)world)); if (!this.isSinglePlayer()) { ((WorldServer)world).getWorldInfo().setGameType(this.getGameType()); } if (Reflector.EventBus.exists()) { Reflector.postForgeBusEvent(Reflector.WorldEvent_Load_Constructor, new Object[] {world}); } } this.getConfigurationManager().setPlayerManager(new WorldServer[] {(WorldServer)var8}); } else { this.worldServers = new WorldServer[3]; this.timeOfLastDimensionTick = new long[this.worldServers.length][100]; for (int var15 = 0; var15 < this.worldServers.length; ++var15) { byte var16 = 0; if (var15 == 1) { var16 = -1; } if (var15 == 2) { var16 = 1; } if (var15 == 0) { if (this.isDemo()) { this.worldServers[var15] = new DemoWorldServer(this, var7, par2Str, var16, this.theProfiler); } else { this.worldServers[var15] = new WorldServerOF(this, var7, par2Str, var16, this.theWorldSettings, this.theProfiler); } } else { this.worldServers[var15] = new WorldServerMultiOF(this, var7, par2Str, var16, this.theWorldSettings, this.worldServers[0], this.theProfiler); } this.worldServers[var15].addWorldAccess(new WorldManager(this, this.worldServers[var15])); this.getConfigurationManager().setPlayerManager(this.worldServers); } } this.func_147139_a(this.func_147135_j()); this.initialWorldChunkLoad(); }
protected void loadAllWorlds(String par1Str, String par2Str, long par3, WorldType par5WorldType, String par6Str) { this.convertMapIfNeeded(par1Str); this.setUserMessage("menu.loadingLevel"); this.worldServers = new WorldServer[3]; this.timeOfLastDimensionTick = new long[this.worldServers.length][100]; ISaveHandler var7 = this.anvilConverterForAnvilFile.getSaveLoader(par1Str, true); WorldInfo var9 = var7.loadWorldInfo(); WorldSettings var8; if (var9 == null) { var8 = new WorldSettings(par3, this.getGameType(), this.canStructuresSpawn(), this.isHardcore(), par5WorldType); var8.func_82750_a(par6Str); } else { var8 = new WorldSettings(var9); } if (this.enableBonusChest) { var8.enableBonusChest(); } for (int var10 = 0; var10 < this.worldServers.length; ++var10) { byte var11 = 0; if (var10 == 1) { var11 = -1; } if (var10 == 2) { var11 = 1; } if (var10 == 0) { if (this.isDemo()) { this.worldServers[var10] = new DemoWorldServer(this, var7, par2Str, var11, this.theProfiler); } else { this.worldServers[var10] = new WorldServer(this, var7, par2Str, var11, var8, this.theProfiler); } } else { this.worldServers[var10] = new WorldServerMulti(this, var7, par2Str, var11, var8, this.worldServers[0], this.theProfiler); } this.worldServers[var10].addWorldAccess(new WorldManager(this, this.worldServers[var10])); if (!this.isSinglePlayer()) { this.worldServers[var10].getWorldInfo().setGameType(this.getGameType()); } this.serverConfigManager.setPlayerManager(this.worldServers); } this.func_147139_a(this.func_147135_j()); this.initialWorldChunkLoad(); }
public static void initDimension(int dim) { if (dim == 0) return; // Cauldron - overworld WorldServer overworld = getWorld(0); if (overworld == null) { throw new RuntimeException("Cannot Hotload Dim: Overworld is not Loaded!"); } try { // Cauldron start - Fixes MultiVerse issue when mods such as Twilight Forest try to hotload their dimension when using its WorldProvider if(net.minecraftforge.cauldron.CauldronHooks.craftWorldLoading) { return; } // Cauldron end DimensionManager.getProviderType(dim); } catch (Exception e) { System.err.println("Cannot Hotload Dim: " + e.getMessage()); return; // If a provider hasn't been registered then we can't hotload the dim } MinecraftServer mcServer = overworld.func_73046_m(); ISaveHandler savehandler = overworld.getSaveHandler(); WorldSettings worldSettings = new WorldSettings(overworld.getWorldInfo()); // Cauldron start - handles hotloading dimensions String worldType; String name; String oldName = ""; Environment env = Environment.getEnvironment(getProviderType(dim)); if (dim >= -1 && dim <= 1) { if ((dim == -1 && !mcServer.getAllowNether()) || (dim == 1 && !mcServer.server.getAllowEnd())) return; worldType = env.toString().toLowerCase(); name = "DIM" + dim; } else { WorldProvider provider = WorldProvider.getProviderForDimension(dim); worldType = provider.getClass().getSimpleName().toLowerCase(); worldType = worldType.replace("worldprovider", ""); oldName = "world_" + worldType; worldType = worldType.replace("provider", ""); if (Environment.getEnvironment(DimensionManager.getProviderType(dim)) == null) env = DimensionManager.registerBukkitEnvironment(DimensionManager.getProviderType(provider.getClass()), worldType); name = provider.getSaveFolder(); if (name == null) name = "DIM0"; } // add ability to disable dimensions if (!MinecraftServer.getServer().cauldronConfig.getBoolean("world-environment-settings." + worldType + ".enabled", true)) return; CauldronUtils.migrateWorlds(worldType, oldName, overworld.getWorldInfo().getWorldName(), name); // Cauldron ChunkGenerator gen = mcServer.server.getGenerator(name); if (mcServer instanceof DedicatedServer) { worldSettings.func_82750_a(((DedicatedServer) mcServer).getStringProperty("generator-settings", "")); } WorldServer world = new WorldServerMulti(mcServer, new AnvilSaveHandler(mcServer.server.getWorldContainer(), name, true), name, dim, worldSettings, overworld, mcServer.theProfiler, env, gen); if (gen != null) { world.getWorld().getPopulators().addAll(gen.getDefaultPopulators(world.getWorld())); } mcServer.getConfigurationManager().setPlayerManager(mcServer.worlds.toArray(new WorldServer[mcServer.worlds.size()])); world.addWorldAccess(new WorldManager(mcServer, world)); MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(world)); mcServer.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldLoadEvent(world.getWorld())); // Cauldron end if (!mcServer.isSinglePlayer()) { world.getWorldInfo().setGameType(mcServer.getGameType()); } mcServer.func_147139_a(mcServer.func_147135_j()); }
public static WorldServer initDimension(WorldCreator creator, WorldSettings worldSettings) { WorldServer overworld = getWorld(0); if (overworld == null) { throw new RuntimeException("Cannot Hotload Dim: Overworld is not Loaded!"); } MinecraftServer mcServer = overworld.func_73046_m(); String worldType; String name; int providerId = 0; if (creator.environment() != null) providerId = creator.environment().getId(); try { providerId = getProviderType(providerId); } catch (IllegalArgumentException e) { // do nothing } Environment env = creator.environment(); worldType = env.name().toLowerCase(); name = creator.name(); int dim = 0; // Use saved dimension from level.dat if it exists. This guarantees that after a world is created, the same dimension will be used. Fixes issues with MultiVerse AnvilSaveHandler saveHandler = new AnvilSaveHandler(mcServer.server.getWorldContainer(), name, true); if (saveHandler.loadWorldInfo() != null) { int savedDim = saveHandler.loadWorldInfo().getDimension(); if (savedDim != 0 && savedDim != -1 && savedDim != 1) { dim = savedDim; } } if (dim == 0) { dim = getNextFreeDimId(); } if (!isDimensionRegistered(dim)) // handle reloads properly { registerDimension(dim, providerId); addBukkitDimension(dim); } ChunkGenerator gen = creator.generator(); if (mcServer instanceof DedicatedServer) { worldSettings.func_82750_a(((DedicatedServer) mcServer).getStringProperty("generator-settings", "")); } WorldServer world = new WorldServerMulti(mcServer, saveHandler, name, dim, worldSettings, overworld, mcServer.theProfiler, env, gen); if (gen != null) { world.getWorld().getPopulators().addAll(gen.getDefaultPopulators(world.getWorld())); } world.provider.dimensionId = dim; // Fix for TerrainControl injecting their own WorldProvider mcServer.getConfigurationManager().setPlayerManager(mcServer.worlds.toArray(new WorldServer[mcServer.worlds.size()])); world.addWorldAccess(new WorldManager(mcServer, world)); MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(world)); if (!mcServer.isSinglePlayer()) { world.getWorldInfo().setGameType(mcServer.getGameType()); } mcServer.func_147139_a(mcServer.func_147135_j()); return world; }
protected void loadAllWorlds(String p_71247_1_, String p_71247_2_, long p_71247_3_, WorldType p_71247_5_, String p_71247_6_) { this.convertMapIfNeeded(p_71247_1_); this.setUserMessage("menu.loadingLevel"); ISaveHandler isavehandler = this.anvilConverterForAnvilFile.getSaveLoader(p_71247_1_, true); WorldInfo worldinfo = isavehandler.loadWorldInfo(); WorldSettings worldsettings; if (worldinfo == null) { worldsettings = new WorldSettings(p_71247_3_, this.getGameType(), this.canStructuresSpawn(), this.isHardcore(), p_71247_5_); worldsettings.func_82750_a(p_71247_6_); } else { worldsettings = new WorldSettings(worldinfo); } if (this.enableBonusChest) { worldsettings.enableBonusChest(); } WorldServer overWorld = (isDemo() ? new DemoWorldServer(this, isavehandler, p_71247_2_, 0, theProfiler) : new WorldServer(this, isavehandler, p_71247_2_, 0, worldsettings, theProfiler)); for (int dim : DimensionManager.getStaticDimensionIDs()) { WorldServer world = (dim == 0 ? overWorld : new WorldServerMulti(this, isavehandler, p_71247_2_, dim, worldsettings, overWorld, theProfiler)); world.addWorldAccess(new WorldManager(this, world)); if (!this.isSinglePlayer()) { world.getWorldInfo().setGameType(this.getGameType()); } MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(world)); } this.serverConfigManager.setPlayerManager(new WorldServer[]{ overWorld }); this.func_147139_a(this.func_147135_j()); this.initialWorldChunkLoad(); }
protected void func_71247_a(String p_71247_1_, String p_71247_2_, long p_71247_3_, WorldType p_71247_5_, String p_71247_6_) { this.func_71237_c(p_71247_1_); this.func_71192_d("menu.loadingLevel"); this.field_71305_c = new WorldServer[3]; this.field_71312_k = new long[this.field_71305_c.length][100]; ISaveHandler var7 = this.field_71310_m.func_75804_a(p_71247_1_, true); WorldInfo var9 = var7.func_75757_d(); WorldSettings var8; if(var9 == null) { var8 = new WorldSettings(p_71247_3_, this.func_71265_f(), this.func_71225_e(), this.func_71199_h(), p_71247_5_); var8.func_82750_a(p_71247_6_); } else { var8 = new WorldSettings(var9); } if(this.field_71289_N) { var8.func_77159_a(); } for(int var10 = 0; var10 < this.field_71305_c.length; ++var10) { byte var11 = 0; if(var10 == 1) { var11 = -1; } if(var10 == 2) { var11 = 1; } if(var10 == 0) { if(this.func_71242_L()) { this.field_71305_c[var10] = new DemoWorldServer(this, var7, p_71247_2_, var11, this.field_71304_b, this.func_98033_al()); } else { this.field_71305_c[var10] = new WorldServer(this, var7, p_71247_2_, var11, var8, this.field_71304_b, this.func_98033_al()); } } else { this.field_71305_c[var10] = new WorldServerMulti(this, var7, p_71247_2_, var11, var8, this.field_71305_c[0], this.field_71304_b, this.func_98033_al()); } this.field_71305_c[var10].func_72954_a(new WorldManager(this, this.field_71305_c[var10])); if(!this.func_71264_H()) { this.field_71305_c[var10].func_72912_H().func_76060_a(this.func_71265_f()); } this.field_71318_t.func_72364_a(this.field_71305_c); } this.func_71226_c(this.func_71232_g()); this.func_71222_d(); }
protected void loadAllWorlds(String par1Str, String par2Str, long par3, WorldType par5WorldType, String par6Str) { this.convertMapIfNeeded(par1Str); this.setUserMessage("menu.loadingLevel"); ISaveHandler isavehandler = this.anvilConverterForAnvilFile.getSaveLoader(par1Str, true); WorldInfo worldinfo = isavehandler.loadWorldInfo(); WorldSettings worldsettings; if (worldinfo == null) { worldsettings = new WorldSettings(par3, this.getGameType(), this.canStructuresSpawn(), this.isHardcore(), par5WorldType); worldsettings.func_82750_a(par6Str); } else { worldsettings = new WorldSettings(worldinfo); } if (this.enableBonusChest) { worldsettings.enableBonusChest(); } WorldServer overWorld = (isDemo() ? new DemoWorldServer(this, isavehandler, par2Str, 0, theProfiler, getLogAgent()) : new WorldServer(this, isavehandler, par2Str, 0, worldsettings, theProfiler, getLogAgent())); for (int dim : DimensionManager.getStaticDimensionIDs()) { WorldServer world = (dim == 0 ? overWorld : new WorldServerMulti(this, isavehandler, par2Str, dim, worldsettings, overWorld, theProfiler, getLogAgent())); world.addWorldAccess(new WorldManager(this, world)); if (!this.isSinglePlayer()) { world.getWorldInfo().setGameType(this.getGameType()); } this.serverConfigManager.setPlayerManager(this.worldServers); MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(world)); } this.serverConfigManager.setPlayerManager(new WorldServer[]{ overWorld }); this.setDifficultyForAllWorlds(this.getDifficulty()); this.initialWorldChunkLoad(); }