public void setResourcePackFromWorld(String worldNameIn, ISaveHandler saveHandlerIn) { File file1 = new File(saveHandlerIn.getWorldDirectory(), "resources.zip"); if (file1.isFile()) { try { this.setResourcePack("level://" + URLEncoder.encode(worldNameIn, Charsets.UTF_8.toString()) + "/" + "resources.zip", ""); } catch (UnsupportedEncodingException var5) { LOG.warn("Something went wrong url encoding {}", new Object[] {worldNameIn}); } } }
public WorldServer(MinecraftServer server, ISaveHandler saveHandlerIn, WorldInfo info, int dimensionId, Profiler profilerIn) { super(saveHandlerIn, info, net.minecraftforge.common.DimensionManager.createProviderFor(dimensionId), profilerIn, false); this.mcServer = server; this.theEntityTracker = new EntityTracker(this); this.thePlayerManager = new PlayerChunkMap(this); // Guarantee the dimension ID was not reset by the provider int providerDim = this.provider.getDimension(); this.provider.registerWorld(this); this.provider.setDimension(providerDim); this.chunkProvider = this.createChunkProvider(); perWorldStorage = new MapStorage(new net.minecraftforge.common.WorldSpecificSaveHandler((WorldServer)this, saveHandlerIn)); this.worldTeleporter = new Teleporter(this); this.calculateInitialSkylight(); this.calculateInitialWeather(); this.getWorldBorder().setSize(server.getMaxWorldSize()); net.minecraftforge.common.DimensionManager.setWorld(dimensionId, this, mcServer); }
protected World(ISaveHandler saveHandlerIn, WorldInfo info, WorldProvider providerIn, Profiler profilerIn, boolean client) { this.eventListeners = Lists.newArrayList(new IWorldEventListener[] {this.pathListener}); this.theCalendar = Calendar.getInstance(); this.worldScoreboard = new Scoreboard(); this.spawnHostileMobs = true; this.spawnPeacefulMobs = true; this.lightUpdateBlockList = new int[32768]; this.saveHandler = saveHandlerIn; this.theProfiler = profilerIn; this.worldInfo = info; this.provider = providerIn; this.isRemote = client; this.worldBorder = providerIn.createWorldBorder(); perWorldStorage = new MapStorage((ISaveHandler)null); }
@Override public OfflinePlayer getOfflinePlayer(UUID uuid) { final ISaveHandler saveHandler = MinecraftServer.getServer().getEntityWorld().getSaveHandler(); if (saveHandler instanceof SaveHandler) { final NBTTagCompound tagCompound = ((IMixinSaveHandler) saveHandler).readPlayerData(uuid); if (tagCompound != null) { final GameProfile profile = getPlayerProfileCache().getProfileByUUID(uuid); if (profile != null) { return new NeptuneOfflinePlayer(profile.getName(), uuid, tagCompound); } else { return new NeptuneOfflinePlayer("PLAYER_NAME_UNKNOWN", uuid, tagCompound); } } return null; } else { throw new RuntimeException("ISaveHandler is not of type SaveHandler! Failing to load playerdata"); } }
public File getSaveFile(ISaveHandler saveHandler, World world, String name, boolean backup) { File worldDir = new File(saveHandler.getWorldDirectoryName()); IChunkLoader loader = saveHandler.getChunkLoader(world.provider); if((loader instanceof AnvilChunkLoader)) { worldDir = ((AnvilChunkLoader) loader).chunkSaveLocation; } File file = new File(worldDir, name + (backup ? ".bak" : "")); if(!file.exists()) { try { file.createNewFile(); } catch(Exception e) { e.printStackTrace(); } } return file; }
@SideOnly(Side.CLIENT) public World(ISaveHandler p_i45368_1_, String p_i45368_2_, WorldProvider p_i45368_3_, WorldSettings p_i45368_4_, Profiler p_i45368_5_) { this.ambientTickCountdown = this.rand.nextInt(12000); this.spawnHostileMobs = true; this.spawnPeacefulMobs = true; this.collidingBoundingBoxes = new ArrayList(); this.lightUpdateBlockList = new int[32768]; this.saveHandler = p_i45368_1_; this.theProfiler = p_i45368_5_; this.worldInfo = new WorldInfo(p_i45368_4_, p_i45368_2_); this.provider = p_i45368_3_; perWorldStorage = new MapStorage((ISaveHandler)null); // Cauldron start this.world = null; this.timings = null; this.spigotConfig = null; this.activeChunkSet_CB = null; this.chunkTickRadius = 0; // Cauldron end }
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(); }
@SideOnly(Side.CLIENT) public World(ISaveHandler p_i1953_1_, String p_i1953_2_, WorldProvider p_i1953_3_, WorldSettings p_i1953_4_, Profiler p_i1953_5_, ILogAgent p_i1953_6_) { this.field_72990_M = this.field_73012_v.nextInt(12000); this.field_72994_J = new int['\u8000']; this.field_73019_z = p_i1953_1_; this.field_72984_F = p_i1953_5_; this.field_72986_A = new WorldInfo(p_i1953_4_, p_i1953_2_); this.field_73011_w = p_i1953_3_; this.field_72988_C = new MapStorage(p_i1953_1_); this.field_98181_L = p_i1953_6_; VillageCollection var7 = (VillageCollection)this.field_72988_C.func_75742_a(VillageCollection.class, "villages"); if(var7 == null) { this.field_72982_D = new VillageCollection(this); this.field_72988_C.func_75745_a("villages", this.field_72982_D); } else { this.field_72982_D = var7; this.field_72982_D.func_82566_a(this); } p_i1953_3_.func_76558_a(this); this.field_73020_y = this.func_72970_h(); this.func_72966_v(); this.func_72947_a(); }
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(); }
@Override protected void actionPerformed(GuiButton button) { if(button.id == 3) { mc.displayGuiScreen(new GuiCreateWorld(this)); } else if(button.id == 7) { try { GuiCreateWorld gui = new GuiCreateWorld(this); ISaveHandler saveHandler = mc.getSaveLoader().getSaveLoader(func_146621_a(super_field_146640_r.getInt(this)), false); WorldInfo worldInfo = saveHandler.loadWorldInfo(); saveHandler.flush(); gui.func_146318_a(worldInfo); mc.displayGuiScreen(gui); } catch(Exception e) { e.printStackTrace(); } } else { super.actionPerformed(button); } }
public WorldServer(MinecraftServer server, ISaveHandler saveHandlerIn, WorldInfo info, int dimensionId, Profiler profilerIn) { super(saveHandlerIn, info, WorldProvider.getProviderForDimension(dimensionId), profilerIn, false); this.mcServer = server; this.theEntityTracker = new EntityTracker(this); this.thePlayerManager = new PlayerManager(this); this.provider.registerWorld(this); this.chunkProvider = this.createChunkProvider(); this.worldTeleporter = new Teleporter(this); this.calculateInitialSkylight(); this.calculateInitialWeather(); this.getWorldBorder().setSize(server.getMaxWorldSize()); }
protected World(ISaveHandler saveHandlerIn, WorldInfo info, WorldProvider providerIn, Profiler profilerIn, boolean client) { this.ambientTickCountdown = this.rand.nextInt(12000); this.spawnHostileMobs = true; this.spawnPeacefulMobs = true; this.lightUpdateBlockList = new int[32768]; this.saveHandler = saveHandlerIn; this.theProfiler = profilerIn; this.worldInfo = info; this.provider = providerIn; this.isRemote = client; this.worldBorder = providerIn.getWorldBorder(); }
protected void setResourcePackFromWorld(String worldNameIn, ISaveHandler saveHandlerIn) { File file1 = new File(saveHandlerIn.getWorldDirectory(), "resources.zip"); if (file1.isFile()) { this.setResourcePack("level://" + worldNameIn + "/" + file1.getName(), ""); } }
@Override public ISaveHandler getSaveHandler() { if (m_proxyWorld != null && Util.isPrefixInCallStack(m_modPrefix)) { return m_proxyWorld.getSaveHandler(); } else if (m_realWorld != null) { return m_realWorld.getSaveHandler(); } else { return super.getSaveHandler(); } }
public WorldServer(MinecraftServer server, ISaveHandler saveHandlerIn, WorldInfo info, int dimensionId, Profiler profilerIn) { super(saveHandlerIn, info, DimensionType.getById(dimensionId).createDimension(), profilerIn, false); this.mcServer = server; this.theEntityTracker = new EntityTracker(this); this.thePlayerManager = new PlayerChunkMap(this); this.provider.registerWorld(this); this.chunkProvider = this.createChunkProvider(); this.worldTeleporter = new Teleporter(this); this.calculateInitialSkylight(); this.calculateInitialWeather(); this.getWorldBorder().setSize(server.getMaxWorldSize()); }
protected World(ISaveHandler saveHandlerIn, WorldInfo info, WorldProvider providerIn, Profiler profilerIn, boolean client) { this.eventListeners = Lists.newArrayList(new IWorldEventListener[] {this.pathListener}); this.theCalendar = Calendar.getInstance(); this.worldScoreboard = new Scoreboard(); this.spawnHostileMobs = true; this.spawnPeacefulMobs = true; this.lightUpdateBlockList = new int[32768]; this.saveHandler = saveHandlerIn; this.theProfiler = profilerIn; this.worldInfo = info; this.provider = providerIn; this.isRemote = client; this.worldBorder = providerIn.createWorldBorder(); }
public void recreateWorld() { this.client.displayGuiScreen(new GuiScreenWorking()); GuiCreateWorld guicreateworld = new GuiCreateWorld(this.worldSelScreen); ISaveHandler isavehandler = this.client.getSaveLoader().getSaveLoader(this.worldSummary.getFileName(), false); WorldInfo worldinfo = isavehandler.loadWorldInfo(); isavehandler.flush(); if (worldinfo != null) { guicreateworld.recreateFromExistingWorld(worldinfo); this.client.displayGuiScreen(guicreateworld); } }
@Inject(method = "<init>", at = @At("RETURN")) public void onConstruct(MinecraftServer server, ISaveHandler saveHandlerIn, WorldInfo info, int dimensionId, Profiler profilerIn, CallbackInfo callbackInfo) { this.dimensionId = dimensionId; BlockChain chain = new BlockChain(worldInfo.getWorldName() + "," + dimensionId); chain.load(); BlockCraft.instance.blockChains.put(worldInfo.getWorldName() + "," + dimensionId, chain); }
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 : (WorldServer)(new WorldServerMulti(mcServer, savehandler, dim, overworld, mcServer.theProfiler).init())); world.addEventListener(new ServerWorldEventHandler(mcServer, world)); MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(world)); if (!mcServer.isSinglePlayer()) { world.getWorldInfo().setGameType(mcServer.getGameType()); } mcServer.setDifficultyForAllWorlds(mcServer.getDifficulty()); }
public void recreateWorld() { this.client.displayGuiScreen(new GuiScreenWorking()); GuiCreateWorld guicreateworld = new GuiCreateWorld(this.worldSelScreen); ISaveHandler isavehandler = this.client.getSaveLoader().getSaveLoader(this.worldSummary.getFileName(), false); WorldInfo worldinfo = isavehandler.loadWorldInfo(); isavehandler.flush(); guicreateworld.recreateFromExistingWorld(worldinfo); this.client.displayGuiScreen(guicreateworld); }
public void setResourcePackFromWorld(String worldNameIn, ISaveHandler saveHandlerIn) { File file1 = new File(saveHandlerIn.getWorldDirectory(), "resources.zip"); if (file1.isFile()) { this.setResourcePack("level://" + worldNameIn + "/" + "resources.zip", ""); } }
private void loadDimension(int dimensionID, WorldInfo worldInfo) { WorldServer overworld = (WorldServer) FMLCommonHandler.instance().getMinecraftServerInstance().getEntityWorld(); if (overworld == null) { throw new RuntimeException("Cannot Hotload Dim: Overworld is not Loaded!"); } try { DimensionManager.getProviderType(dimensionID); } catch (Exception e) { System.err.println("Cannot Hotload Dim: " + e.getMessage()); return; } MinecraftServer mcServer = overworld.getMinecraftServer(); ISaveHandler savehandler = overworld.getSaveHandler(); EnumDifficulty difficulty = mcServer.getEntityWorld().getDifficulty(); WorldServer world = (WorldServer) (new WorldCustom(worldInfo, mcServer, savehandler, dimensionID, overworld, mcServer.profiler).init()); world.addEventListener(new ServerWorldEventHandler(mcServer, world)); MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(world)); if (!mcServer.isSinglePlayer()) { world.getWorldInfo().setGameType(mcServer.getGameType()); } mcServer.setDifficultyForAllWorlds(difficulty); }
public WorldSpecificSaveHandler(WorldServer world, ISaveHandler parent) { this.world = world; this.parent = parent; dataDir = new File(world.getChunkSaveLocation(), "data"); dataDir.mkdirs(); }
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 void loadData(String saveName, Savee<Type> worldsaveddata, World world, Maker<Type> maker){ final ISaveHandler saveHandler = saveHandlerAccess.get(world.getMapStorage()); final MapStorage mapStorage = world.getMapStorage(); if (saveHandler != null){ try { File file1 = saveHandler.getMapFileFromName(saveName); if (file1 != null && file1.exists()) { FileInputStream fileinputstream = new FileInputStream(file1); NBTTagCompound nbttagcompound = CompressedStreamTools.readCompressed(fileinputstream); fileinputstream.close(); worldsaveddata.readFromNBT(nbttagcompound.getCompoundTag("data")); } } catch (Exception exception1){ exception1.printStackTrace(); } } if (worldsaveddata.data() == null) { worldsaveddata.data = maker.item(); worldsaveddata.data.informOnChange(toSelf); } if (worldsaveddata != null) { mapStorage.setData(mapName, worldsaveddata); worldsaveddata.setDirty(true); mapStorage.saveAllData(); } }
public FakeWorld(MinecraftServer server, World parent) { //super(null, parent.getWorldInfo(), new WorldProviderSurface(), null, false); //super(new FakeServer(Minecraft.getMinecraft(), "fake", "fake", new WorldSettings(parent.getWorldInfo()), null, null, null, null), // null, parent.getWorldInfo(), 1, parent.theProfiler); super(server, server.getActiveAnvilConverter().getSaveLoader("pp_fake", false), parent.getWorldInfo(), PlacementPreview.dimId, parent.profiler); this.parent = parent; this.chunk = new FakeChunk(this); this.chunkProvider = this.createChunkProvider(); this.provider.setWorld(this); this.provider.setDimension(PlacementPreview.dimId); this.mapStorage = new MapStorage(this.saveHandler); this.perWorldStorage = new MapStorage((ISaveHandler) null); }
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()); }
public WorldServerMulti(MinecraftServer p_i45283_1_, ISaveHandler p_i45283_2_, String p_i45283_3_, int p_i45283_4_, WorldSettings p_i45283_5_, WorldServer p_i45283_6_, Profiler p_i45283_7_) { super(p_i45283_1_, p_i45283_2_, p_i45283_3_, p_i45283_4_, p_i45283_5_, p_i45283_7_); this.mapStorage = p_i45283_6_.mapStorage; this.worldScoreboard = p_i45283_6_.getScoreboard(); this.worldInfo = new DerivedWorldInfo(p_i45283_6_.getWorldInfo()); }