    001package net.minecraft.world.chunk.storage;
    002
    003import java.io.File;
    004import net.minecraft.nbt.NBTTagCompound;
    005import net.minecraft.world.WorldProvider;
    006import net.minecraft.world.WorldProviderEnd;
    007import net.minecraft.world.WorldProviderHell;
    008import net.minecraft.world.storage.SaveHandler;
    009import net.minecraft.world.storage.ThreadedFileIOBase;
    010import net.minecraft.world.storage.WorldInfo;
    011
    012public class AnvilSaveHandler extends SaveHandler
    013{
    014    public AnvilSaveHandler(File par1File, String par2Str, boolean par3)
    015    {
    016        super(par1File, par2Str, par3);
    017    }
    018
    019    /**
    020     * Returns the chunk loader with the provided world provider
    021     */
    022    public IChunkLoader getChunkLoader(WorldProvider par1WorldProvider)
    023    {
    024        File file1 = this.getSaveDirectory();
    025        File file2;
    026
    027        if (par1WorldProvider.getSaveFolder() != null)
    028        {
    029            file2 = new File(file1, par1WorldProvider.getSaveFolder());
    030            file2.mkdirs();
    031            return new AnvilChunkLoader(file2);
    032        }
    033        else
    034        {
    035            return new AnvilChunkLoader(file1);
    036        }
    037    }
    038
    039    /**
    040     * Saves the given World Info with the given NBTTagCompound as the Player.
    041     */
    042    public void saveWorldInfoWithPlayer(WorldInfo par1WorldInfo, NBTTagCompound par2NBTTagCompound)
    043    {
    044        par1WorldInfo.setSaveVersion(19133);
    045        super.saveWorldInfoWithPlayer(par1WorldInfo, par2NBTTagCompound);
    046    }
    047
    048    /**
    049     * Called to flush all changes to disk, waiting for them to complete.
    050     */
    051    public void flush()
    052    {
    053        try
    054        {
    055            ThreadedFileIOBase.threadedIOInstance.waitForFinish();
    056        }
    057        catch (InterruptedException interruptedexception)
    058        {
    059            interruptedexception.printStackTrace();
    060        }
    061
    062        RegionFileCache.clearRegionFileReferences();
    063    }
    064}