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; }
/** * Creates the chunk provider for this world. Called in the constructor. Retrieves provider from worldProvider? */ protected IChunkProvider createChunkProvider() { IChunkLoader ichunkloader = this.saveHandler.getChunkLoader(this.provider); this.theChunkProviderServer = new ChunkProviderServer(this, ichunkloader, this.provider.createChunkGenerator()); return this.theChunkProviderServer; }
public ChunkProviderServer(WorldServer p_i1520_1_, IChunkLoader p_i1520_2_, IChunkProvider p_i1520_3_) { this.dummyChunk = new EmptyChunk(p_i1520_1_, 0, 0); this.worldObj = p_i1520_1_; this.chunkLoader = p_i1520_2_; this.serverChunkGenerator = p_i1520_3_; }
@Nullable public static File getWorldDirectory(World world) { IChunkProvider chunkProvider = world.getChunkProvider(); if (chunkProvider instanceof ChunkProviderServer) { ChunkProviderServer chunkProviderServer = (ChunkProviderServer) chunkProvider; IChunkLoader chunkLoader = chunkProviderServer.chunkLoader; if (chunkLoader instanceof AnvilChunkLoader) { return ((AnvilChunkLoader) chunkLoader).chunkSaveLocation; } return null; } // If this method gets called before ChunkProviderServer has been set yet, // then we mimic the vanilla code in AnvilSaveHandler#getChunkLoader() to get the directory. else { File mainWorldDir = world.getSaveHandler().getWorldDirectory(); String dimensionDir = world.provider.getSaveFolder(); if (dimensionDir != null) { mainWorldDir = new File(mainWorldDir, dimensionDir); mainWorldDir.mkdirs(); } return mainWorldDir; } }
public ChunkProviderServer(World world, IChunkLoader loader, IChunkProvider provider) { this.defaultEmptyChunk = new EmptyChunk(world, 0, 0); this.worldObj = world; this.currentChunkLoader = loader; this.currentChunkProvider = provider; // TODO: Do a static calc to speed things up if possible. Need // to find out if this assumption is safe. this.worryAboutSpawn = this.worldObj.provider.canRespawnHere() && DimensionManager.shouldLoadSpawn(this.worldObj.provider.dimensionId); }
/** * Creates the chunk provider for this world. Called in the constructor. Retrieves provider from worldProvider? */ protected IChunkProvider createChunkProvider() { IChunkLoader var1 = this.saveHandler.getChunkLoader(this.provider); this.theChunkProviderServer = new ChunkProviderServer(this, var1, this.provider.createChunkGenerator()); return this.theChunkProviderServer; }
public ChunkProviderServer(WorldServer par1WorldServer, IChunkLoader par2IChunkLoader, IChunkProvider par3IChunkProvider) { this.defaultEmptyChunk = new EmptyChunk(par1WorldServer, 0, 0); this.worldObj = par1WorldServer; this.currentChunkLoader = par2IChunkLoader; this.currentChunkProvider = par3IChunkProvider; }
/** * @author jamierocks - 30th October 2016 * @reason Use the Canary directory structure */ @Overwrite public IChunkLoader getChunkLoader(WorldProvider provider) { if (provider instanceof WorldProviderHell) { return new AnvilChunkLoader(new File(this.getWorldDirectory(), this.getWorldDirectoryName() + "_" + DimensionType.NETHER.getName())); } else if (provider instanceof WorldProviderEnd) { return new AnvilChunkLoader(new File(this.getWorldDirectory(), this.getWorldDirectoryName() + "_" + DimensionType.END.getName())); } else { return new AnvilChunkLoader(new File(this.getWorldDirectory(), this.getWorldDirectoryName() + "_" + DimensionType.NORMAL.getName())); } }
protected IChunkProvider createChunkProvider() { IChunkLoader ichunkloader = this.saveHandler.getChunkLoader(this.provider); // Cauldron start - if provider is vanilla, proceed to create a bukkit compatible chunk generator if (this.provider.getClass().toString().length() <= 3 || this.provider.getClass().toString().contains("net.minecraft")) { // CraftBukkit start org.bukkit.craftbukkit.generator.InternalChunkGenerator gen; if (this.generator != null) { gen = new org.bukkit.craftbukkit.generator.CustomChunkGenerator(this, this.getSeed(), this.generator); } else if (this.provider instanceof WorldProviderHell) { gen = new org.bukkit.craftbukkit.generator.NetherChunkGenerator(this, this.getSeed()); } else if (this.provider instanceof WorldProviderEnd) { gen = new org.bukkit.craftbukkit.generator.SkyLandsChunkGenerator(this, this.getSeed()); } else { gen = new org.bukkit.craftbukkit.generator.NormalChunkGenerator(this, this.getSeed()); } this.theChunkProviderServer = new ChunkProviderServer(this, ichunkloader, gen); // CraftBukkit end } else // custom provider, load normally for forge compatibility { this.theChunkProviderServer = new ChunkProviderServer(this, ichunkloader, this.provider.createChunkGenerator()); } // Cauldron end return this.theChunkProviderServer; }
public ChunkProviderServer(WorldServer p_i1520_1_, IChunkLoader p_i1520_2_, IChunkProvider p_i1520_3_) { this.initialTick = MinecraftServer.currentTick; // Cauldron keep track of when the loader was created this.defaultEmptyChunk = new EmptyChunk(p_i1520_1_, 0, 0); this.worldObj = p_i1520_1_; this.currentChunkLoader = p_i1520_2_; this.currentChunkProvider = p_i1520_3_; }
public ChunkProviderServer(WorldServer p_i1520_1_, IChunkLoader p_i1520_2_, IChunkProvider p_i1520_3_) { this.defaultEmptyChunk = new EmptyChunk(p_i1520_1_, 0, 0); this.worldObj = p_i1520_1_; this.currentChunkLoader = p_i1520_2_; this.currentChunkProvider = p_i1520_3_; }
public IChunkLoader func_75763_a(WorldProvider p_75763_1_) { File var2 = this.func_75765_b(); File var3; if(p_75763_1_ instanceof WorldProviderHell) { var3 = new File(var2, "DIM-1"); var3.mkdirs(); return new AnvilChunkLoader(var3); } else if(p_75763_1_ instanceof WorldProviderEnd) { var3 = new File(var2, "DIM1"); var3.mkdirs(); return new AnvilChunkLoader(var3); } else { return new AnvilChunkLoader(var2); } }
private static boolean chunkIsSaved(World world, int chunkX, int chunkZ) { if (world.getChunkProvider() instanceof ChunkProviderServer) { IChunkLoader loader = ((ChunkProviderServer)world.getChunkProvider()).chunkLoader; if (loader instanceof AnvilChunkLoader) { //if (((AnvilChunkLoader) loader).chunkExists(world, chunkX, chunkZ)) // CustomOreGenBase.log.info("[" + chunkX + "," + chunkZ + "]: saved on disk"); return ((AnvilChunkLoader) loader).chunkExists(world, chunkX, chunkZ); } } return false; }
/** * initializes and returns the chunk loader for the specified world provider */ public IChunkLoader getChunkLoader(WorldProvider provider) { throw new RuntimeException("Old Chunk Storage is no longer supported."); }
/** * initializes and returns the chunk loader for the specified world provider */ public IChunkLoader getChunkLoader(WorldProvider provider) { return null; }
/** * Creates the chunk provider for this world. Called in the constructor. Retrieves provider from worldProvider? */ protected IChunkProvider createChunkProvider() { IChunkLoader ichunkloader = this.saveHandler.getChunkLoader(this.provider); return new ChunkProviderServer(this, ichunkloader, this.provider.createChunkGenerator()); }
public ChunkProviderServer(WorldServer worldObjIn, IChunkLoader chunkLoaderIn, IChunkGenerator chunkGeneratorIn) { this.worldObj = worldObjIn; this.chunkLoader = chunkLoaderIn; this.chunkGenerator = chunkGeneratorIn; }
public IChunkLoader getChunkLoader(final WorldProvider var1) { return null; }
@Override public IChunkLoader getChunkLoader(WorldProvider provider) { return null; }