Java 类net.minecraft.world.MinecraftException 实例源码

项目:DecompiledMinecraft    文件:AnvilChunkLoader.java   
public void saveChunk(World worldIn, Chunk chunkIn) throws MinecraftException, IOException
{
    worldIn.checkSessionLock();

    try
    {
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        NBTTagCompound nbttagcompound1 = new NBTTagCompound();
        nbttagcompound.setTag("Level", nbttagcompound1);
        this.writeChunkToNBT(chunkIn, worldIn, nbttagcompound1);
        this.addChunkToPending(chunkIn.getChunkCoordIntPair(), nbttagcompound);
    }
    catch (Exception exception)
    {
        logger.error((String)"Failed to save chunk", (Throwable)exception);
    }
}
项目:DecompiledMinecraft    文件:ChunkProviderServer.java   
private void saveChunkData(Chunk p_73242_1_)
{
    if (this.chunkLoader != null)
    {
        try
        {
            p_73242_1_.setLastSaveTime(this.worldObj.getTotalWorldTime());
            this.chunkLoader.saveChunk(this.worldObj, p_73242_1_);
        }
        catch (IOException ioexception)
        {
            logger.error((String)"Couldn\'t save chunk", (Throwable)ioexception);
        }
        catch (MinecraftException minecraftexception)
        {
            logger.error((String)"Couldn\'t save chunk; already in use by another instance of Minecraft?", (Throwable)minecraftexception);
        }
    }
}
项目:DecompiledMinecraft    文件:SaveHandler.java   
/**
 * Checks the session lock to prevent save collisions
 */
public void checkSessionLock() throws MinecraftException
{
    try
    {
        File file1 = new File(this.worldDirectory, "session.lock");
        DataInputStream datainputstream = new DataInputStream(new FileInputStream(file1));

        try
        {
            if (datainputstream.readLong() != this.initializationTime)
            {
                throw new MinecraftException("The save is being accessed from another location, aborting");
            }
        }
        finally
        {
            datainputstream.close();
        }
    }
    catch (IOException var7)
    {
        throw new MinecraftException("Failed to check session lock, aborting");
    }
}
项目:DecompiledMinecraft    文件:MinecraftServer.java   
/**
 * par1 indicates if a log message should be output.
 */
protected void saveAllWorlds(boolean dontLog)
{
    if (!this.worldIsBeingDeleted)
    {
        for (WorldServer worldserver : this.worldServers)
        {
            if (worldserver != null)
            {
                if (!dontLog)
                {
                    logger.info("Saving chunks for level \'" + worldserver.getWorldInfo().getWorldName() + "\'/" + worldserver.provider.getDimensionName());
                }

                try
                {
                    worldserver.saveAllChunks(true, (IProgressUpdate)null);
                }
                catch (MinecraftException minecraftexception)
                {
                    logger.warn(minecraftexception.getMessage());
                }
            }
        }
    }
}
项目:DecompiledMinecraft    文件:AnvilChunkLoader.java   
public void saveChunk(World worldIn, Chunk chunkIn) throws MinecraftException, IOException
{
    worldIn.checkSessionLock();

    try
    {
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        NBTTagCompound nbttagcompound1 = new NBTTagCompound();
        nbttagcompound.setTag("Level", nbttagcompound1);
        this.writeChunkToNBT(chunkIn, worldIn, nbttagcompound1);
        this.addChunkToPending(chunkIn.getChunkCoordIntPair(), nbttagcompound);
    }
    catch (Exception exception)
    {
        logger.error((String)"Failed to save chunk", (Throwable)exception);
    }
}
项目:DecompiledMinecraft    文件:ChunkProviderServer.java   
private void saveChunkData(Chunk p_73242_1_)
{
    if (this.chunkLoader != null)
    {
        try
        {
            p_73242_1_.setLastSaveTime(this.worldObj.getTotalWorldTime());
            this.chunkLoader.saveChunk(this.worldObj, p_73242_1_);
        }
        catch (IOException ioexception)
        {
            logger.error((String)"Couldn\'t save chunk", (Throwable)ioexception);
        }
        catch (MinecraftException minecraftexception)
        {
            logger.error((String)"Couldn\'t save chunk; already in use by another instance of Minecraft?", (Throwable)minecraftexception);
        }
    }
}
项目:DecompiledMinecraft    文件:SaveHandler.java   
/**
 * Checks the session lock to prevent save collisions
 */
public void checkSessionLock() throws MinecraftException
{
    try
    {
        File file1 = new File(this.worldDirectory, "session.lock");
        DataInputStream datainputstream = new DataInputStream(new FileInputStream(file1));

        try
        {
            if (datainputstream.readLong() != this.initializationTime)
            {
                throw new MinecraftException("The save is being accessed from another location, aborting");
            }
        }
        finally
        {
            datainputstream.close();
        }
    }
    catch (IOException var7)
    {
        throw new MinecraftException("Failed to check session lock, aborting");
    }
}
项目:DecompiledMinecraft    文件:MinecraftServer.java   
/**
 * par1 indicates if a log message should be output.
 */
protected void saveAllWorlds(boolean dontLog)
{
    if (!this.worldIsBeingDeleted)
    {
        for (WorldServer worldserver : this.worldServers)
        {
            if (worldserver != null)
            {
                if (!dontLog)
                {
                    logger.info("Saving chunks for level \'" + worldserver.getWorldInfo().getWorldName() + "\'/" + worldserver.provider.getDimensionName());
                }

                try
                {
                    worldserver.saveAllChunks(true, (IProgressUpdate)null);
                }
                catch (MinecraftException minecraftexception)
                {
                    logger.warn(minecraftexception.getMessage());
                }
            }
        }
    }
}
项目:BaseClient    文件:AnvilChunkLoader.java   
public void saveChunk(World worldIn, Chunk chunkIn) throws MinecraftException, IOException
{
    worldIn.checkSessionLock();

    try
    {
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        NBTTagCompound nbttagcompound1 = new NBTTagCompound();
        nbttagcompound.setTag("Level", nbttagcompound1);
        this.writeChunkToNBT(chunkIn, worldIn, nbttagcompound1);
        this.addChunkToPending(chunkIn.getChunkCoordIntPair(), nbttagcompound);
    }
    catch (Exception exception)
    {
        logger.error((String)"Failed to save chunk", (Throwable)exception);
    }
}
项目:BaseClient    文件:ChunkProviderServer.java   
private void saveChunkData(Chunk p_73242_1_)
{
    if (this.chunkLoader != null)
    {
        try
        {
            p_73242_1_.setLastSaveTime(this.worldObj.getTotalWorldTime());
            this.chunkLoader.saveChunk(this.worldObj, p_73242_1_);
        }
        catch (IOException ioexception)
        {
            logger.error((String)"Couldn\'t save chunk", (Throwable)ioexception);
        }
        catch (MinecraftException minecraftexception)
        {
            logger.error((String)"Couldn\'t save chunk; already in use by another instance of Minecraft?", (Throwable)minecraftexception);
        }
    }
}
项目:BaseClient    文件:SaveHandler.java   
/**
 * Checks the session lock to prevent save collisions
 */
public void checkSessionLock() throws MinecraftException
{
    try
    {
        File file1 = new File(this.worldDirectory, "session.lock");
        DataInputStream datainputstream = new DataInputStream(new FileInputStream(file1));

        try
        {
            if (datainputstream.readLong() != this.initializationTime)
            {
                throw new MinecraftException("The save is being accessed from another location, aborting");
            }
        }
        finally
        {
            datainputstream.close();
        }
    }
    catch (IOException var7)
    {
        throw new MinecraftException("Failed to check session lock, aborting");
    }
}
项目:BaseClient    文件:MinecraftServer.java   
/**
 * par1 indicates if a log message should be output.
 */
protected void saveAllWorlds(boolean dontLog)
{
    if (!this.worldIsBeingDeleted)
    {
        for (WorldServer worldserver : this.worldServers)
        {
            if (worldserver != null)
            {
                if (!dontLog)
                {
                    logger.info("Saving chunks for level \'" + worldserver.getWorldInfo().getWorldName() + "\'/" + worldserver.provider.getDimensionName());
                }

                try
                {
                    worldserver.saveAllChunks(true, (IProgressUpdate)null);
                }
                catch (MinecraftException minecraftexception)
                {
                    logger.warn(minecraftexception.getMessage());
                }
            }
        }
    }
}
项目:BaseClient    文件:AnvilChunkLoader.java   
public void saveChunk(World worldIn, Chunk chunkIn) throws MinecraftException, IOException
{
    worldIn.checkSessionLock();

    try
    {
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        NBTTagCompound nbttagcompound1 = new NBTTagCompound();
        nbttagcompound.setTag("Level", nbttagcompound1);
        this.writeChunkToNBT(chunkIn, worldIn, nbttagcompound1);
        this.addChunkToPending(chunkIn.getChunkCoordIntPair(), nbttagcompound);
    }
    catch (Exception exception)
    {
        logger.error((String)"Failed to save chunk", (Throwable)exception);
    }
}
项目:BaseClient    文件:ChunkProviderServer.java   
private void saveChunkData(Chunk p_73242_1_)
{
    if (this.chunkLoader != null)
    {
        try
        {
            p_73242_1_.setLastSaveTime(this.worldObj.getTotalWorldTime());
            this.chunkLoader.saveChunk(this.worldObj, p_73242_1_);
        }
        catch (IOException ioexception)
        {
            logger.error((String)"Couldn\'t save chunk", (Throwable)ioexception);
        }
        catch (MinecraftException minecraftexception)
        {
            logger.error((String)"Couldn\'t save chunk; already in use by another instance of Minecraft?", (Throwable)minecraftexception);
        }
    }
}
项目:BaseClient    文件:SaveHandler.java   
/**
 * Checks the session lock to prevent save collisions
 */
public void checkSessionLock() throws MinecraftException
{
    try
    {
        File file1 = new File(this.worldDirectory, "session.lock");
        DataInputStream datainputstream = new DataInputStream(new FileInputStream(file1));

        try
        {
            if (datainputstream.readLong() != this.initializationTime)
            {
                throw new MinecraftException("The save is being accessed from another location, aborting");
            }
        }
        finally
        {
            datainputstream.close();
        }
    }
    catch (IOException var7)
    {
        throw new MinecraftException("Failed to check session lock, aborting");
    }
}
项目:BaseClient    文件:MinecraftServer.java   
/**
 * par1 indicates if a log message should be output.
 */
protected void saveAllWorlds(boolean dontLog)
{
    if (!this.worldIsBeingDeleted)
    {
        for (WorldServer worldserver : this.worldServers)
        {
            if (worldserver != null)
            {
                if (!dontLog)
                {
                    logger.info("Saving chunks for level \'" + worldserver.getWorldInfo().getWorldName() + "\'/" + worldserver.provider.getDimensionName());
                }

                try
                {
                    worldserver.saveAllChunks(true, (IProgressUpdate)null);
                }
                catch (MinecraftException minecraftexception)
                {
                    logger.warn(minecraftexception.getMessage());
                }
            }
        }
    }
}
项目:Backmemed    文件:AnvilChunkLoader.java   
public void saveChunk(World worldIn, Chunk chunkIn) throws MinecraftException, IOException
{
    worldIn.checkSessionLock();

    try
    {
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        NBTTagCompound nbttagcompound1 = new NBTTagCompound();
        nbttagcompound.setTag("Level", nbttagcompound1);
        nbttagcompound.setInteger("DataVersion", 922);
        this.writeChunkToNBT(chunkIn, worldIn, nbttagcompound1);
        this.addChunkToPending(chunkIn.getChunkCoordIntPair(), nbttagcompound);
    }
    catch (Exception exception)
    {
        LOGGER.error((String)"Failed to save chunk", (Throwable)exception);
    }
}
项目:Backmemed    文件:ChunkProviderServer.java   
private void saveChunkData(Chunk chunkIn)
{
    try
    {
        chunkIn.setLastSaveTime(this.worldObj.getTotalWorldTime());
        this.chunkLoader.saveChunk(this.worldObj, chunkIn);
    }
    catch (IOException ioexception)
    {
        LOGGER.error((String)"Couldn\'t save chunk", (Throwable)ioexception);
    }
    catch (MinecraftException minecraftexception)
    {
        LOGGER.error((String)"Couldn\'t save chunk; already in use by another instance of Minecraft?", (Throwable)minecraftexception);
    }
}
项目:Backmemed    文件:SaveHandler.java   
/**
 * Checks the session lock to prevent save collisions
 */
public void checkSessionLock() throws MinecraftException
{
    try
    {
        File file1 = new File(this.worldDirectory, "session.lock");
        DataInputStream datainputstream = new DataInputStream(new FileInputStream(file1));

        try
        {
            if (datainputstream.readLong() != this.initializationTime)
            {
                throw new MinecraftException("The save is being accessed from another location, aborting");
            }
        }
        finally
        {
            datainputstream.close();
        }
    }
    catch (IOException var7)
    {
        throw new MinecraftException("Failed to check session lock, aborting");
    }
}
项目:Backmemed    文件:MinecraftServer.java   
/**
 * par1 indicates if a log message should be output.
 */
public void saveAllWorlds(boolean isSilent)
{
    for (WorldServer worldserver : this.worldServers)
    {
        if (worldserver != null)
        {
            if (!isSilent)
            {
                LOG.info("Saving chunks for level \'{}\'/{}", new Object[] {worldserver.getWorldInfo().getWorldName(), worldserver.provider.getDimensionType().getName()});
            }

            try
            {
                worldserver.saveAllChunks(true, (IProgressUpdate)null);
            }
            catch (MinecraftException minecraftexception)
            {
                LOG.warn(minecraftexception.getMessage());
            }
        }
    }
}
项目:CustomWorldGen    文件:AnvilChunkLoader.java   
public void saveChunk(World worldIn, Chunk chunkIn) throws MinecraftException, IOException
{
    worldIn.checkSessionLock();

    try
    {
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        NBTTagCompound nbttagcompound1 = new NBTTagCompound();
        nbttagcompound.setTag("Level", nbttagcompound1);
        nbttagcompound.setInteger("DataVersion", 512);
        this.writeChunkToNBT(chunkIn, worldIn, nbttagcompound1);
        net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkDataEvent.Save(chunkIn, nbttagcompound));
        this.addChunkToPending(chunkIn.getChunkCoordIntPair(), nbttagcompound);
    }
    catch (Exception exception)
    {
        LOGGER.error((String)"Failed to save chunk", (Throwable)exception);
    }
}
项目:CustomWorldGen    文件:ChunkProviderServer.java   
private void saveChunkData(Chunk chunkIn)
{
    try
    {
        chunkIn.setLastSaveTime(this.worldObj.getTotalWorldTime());
        this.chunkLoader.saveChunk(this.worldObj, chunkIn);
    }
    catch (IOException ioexception)
    {
        LOGGER.error((String)"Couldn\'t save chunk", (Throwable)ioexception);
    }
    catch (MinecraftException minecraftexception)
    {
        LOGGER.error((String)"Couldn\'t save chunk; already in use by another instance of Minecraft?", (Throwable)minecraftexception);
    }
}
项目:CustomWorldGen    文件:SaveHandler.java   
/**
 * Checks the session lock to prevent save collisions
 */
public void checkSessionLock() throws MinecraftException
{
    try
    {
        File file1 = new File(this.worldDirectory, "session.lock");
        DataInputStream datainputstream = new DataInputStream(new FileInputStream(file1));

        try
        {
            if (datainputstream.readLong() != this.initializationTime)
            {
                throw new MinecraftException("The save is being accessed from another location, aborting");
            }
        }
        finally
        {
            datainputstream.close();
        }
    }
    catch (IOException var7)
    {
        throw new MinecraftException("Failed to check session lock, aborting");
    }
}
项目:CustomWorldGen    文件:MinecraftServer.java   
/**
 * par1 indicates if a log message should be output.
 */
public void saveAllWorlds(boolean isSilent)
{
    for (WorldServer worldserver : this.worldServers)
    {
        if (worldserver != null)
        {
            if (!isSilent)
            {
                LOG.info("Saving chunks for level \'{}\'/{}", new Object[] {worldserver.getWorldInfo().getWorldName(), worldserver.provider.getDimensionType().getName()});
            }

            try
            {
                worldserver.saveAllChunks(true, (IProgressUpdate)null);
            }
            catch (MinecraftException minecraftexception)
            {
                LOG.warn(minecraftexception.getMessage());
            }
        }
    }
}
项目:PopularMMOS-EpicProportions-Mod    文件:SaveHandler.java   
/**
 * Checks the session lock to prevent save collisions
 */
public void checkSessionLock() throws MinecraftException
{
    try
    {
        File file1 = new File(this.worldDirectory, "session.lock");
        DataInputStream datainputstream = new DataInputStream(new FileInputStream(file1));

        try
        {
            if (datainputstream.readLong() != this.initializationTime)
            {
                throw new MinecraftException("The save is being accessed from another location, aborting");
            }
        }
        finally
        {
            datainputstream.close();
        }
    }
    catch (IOException ioexception)
    {
        throw new MinecraftException("Failed to check session lock, aborting");
    }
}
项目:GriefPrevention    文件:BlockUtils.java   
private static void saveChunkData(ChunkProviderServer chunkProviderServer, Chunk chunkIn)
{
    try
    {
        chunkIn.setLastSaveTime(chunkIn.getWorld().getTotalWorldTime());
        chunkProviderServer.chunkLoader.saveChunk(chunkIn.getWorld(), chunkIn);
    }
    catch (IOException ioexception)
    {
        //LOGGER.error((String)"Couldn\'t save chunk", (Throwable)ioexception);
    }
    catch (MinecraftException minecraftexception)
    {
        //LOGGER.error((String)"Couldn\'t save chunk; already in use by another instance of Minecraft?", (Throwable)minecraftexception);
    }
    try
    {
        chunkProviderServer.chunkLoader.saveExtraChunkData(chunkIn.getWorld(), chunkIn);
    }
    catch (Exception exception)
    {
        //LOGGER.error((String)"Couldn\'t save entities", (Throwable)exception);
    }
}
项目:Jiffy    文件:WorldServer.java   
/**
 * Saves all chunks to disk while updating progress bar.
 */
public void saveAllChunks(final boolean saveAll, final IProgressUpdate progress) throws MinecraftException {
    if (this.chunkProvider.canSave()) {
        if (progress != null) {
            progress.displayProgressMessage("Saving level");
        }

        this.saveLevel();

        if (progress != null) {
            progress.resetProgresAndWorkingMessage("Saving chunks");
        }

        this.chunkProvider.saveChunks(saveAll, progress);
        MinecraftForge.EVENT_BUS.post(new WorldEvent.Save(this));

        for (final Chunk chunk : this.theChunkProviderServer.func_152380_a()) {
            if (chunk != null && !this.thePlayerManager.func_152621_a(chunk.xPosition, chunk.zPosition)) {
                this.theChunkProviderServer.unloadChunksIfNotNearSpawn(chunk.xPosition, chunk.zPosition);
            }
        }
    }
}
项目:Jiffy    文件:AnvilChunkLoader.java   
public void saveChunk(final World world, final Chunk chunk) throws MinecraftException, IOException {
    try {
        final NBTTagCompound nbt1 = new NBTTagCompound();
        final NBTTagCompound nbt2 = new NBTTagCompound();
        nbt1.setTag("Level", nbt2);

        // This will generate the chunk into an NBTTagCompound. Compression
        // doesn't occur until IO.
        writeChunkToNBT(chunk, world, nbt2);

        MinecraftForge.EVENT_BUS.post(new ChunkDataEvent.Save(chunk, nbt1));

        // Put the write onto the pending list and queue
        // up an IO request.
        final ChunkCoordIntPair coords = chunk.getChunkCoordIntPair();
        pendingIO.put(coords, nbt1);
        ThreadedFileIOBase.getThreadedIOInstance().queue(new WriteChunkStream(coords));
    } catch (final Exception exception) {
        exception.printStackTrace();
    }
}
项目:Resilience-Client-Source    文件:AnvilChunkLoader.java   
public void saveChunk(World par1World, Chunk par2Chunk) throws MinecraftException, IOException
{
    par1World.checkSessionLock();

    try
    {
        NBTTagCompound var3 = new NBTTagCompound();
        NBTTagCompound var4 = new NBTTagCompound();
        var3.setTag("Level", var4);
        this.writeChunkToNBT(par2Chunk, par1World, var4);
        this.addChunkToPending(par2Chunk.getChunkCoordIntPair(), var3);
    }
    catch (Exception var5)
    {
        var5.printStackTrace();
    }
}
项目:Resilience-Client-Source    文件:ChunkProviderServer.java   
/**
 * used by saveChunks, but catches any exceptions if the save fails.
 */
private void safeSaveChunk(Chunk par1Chunk)
{
    if (this.currentChunkLoader != null)
    {
        try
        {
            par1Chunk.lastSaveTime = this.worldObj.getTotalWorldTime();
            this.currentChunkLoader.saveChunk(this.worldObj, par1Chunk);
        }
        catch (IOException var3)
        {
            logger.error("Couldn\'t save chunk", var3);
        }
        catch (MinecraftException var4)
        {
            logger.error("Couldn\'t save chunk; already in use by another instance of Minecraft?", var4);
        }
    }
}
项目:Resilience-Client-Source    文件:SaveHandler.java   
/**
 * Checks the session lock to prevent save collisions
 */
public void checkSessionLock() throws MinecraftException
{
    try
    {
        File var1 = new File(this.worldDirectory, "session.lock");
        DataInputStream var2 = new DataInputStream(new FileInputStream(var1));

        try
        {
            if (var2.readLong() != this.initializationTime)
            {
                throw new MinecraftException("The save is being accessed from another location, aborting");
            }
        }
        finally
        {
            var2.close();
        }
    }
    catch (IOException var7)
    {
        throw new MinecraftException("Failed to check session lock, aborting");
    }
}
项目:NeptuneMod    文件:MixinWorldServer_Performance.java   
/**
 * @author jamierocks - 25th October 2016
 * @reason Disable vanilla ChunkGC
 */
@Overwrite
public void saveAllChunks(boolean p_73044_1_, IProgressUpdate progressCallback) throws MinecraftException {
    if (this.chunkProvider.canSave()) {
        if (progressCallback != null) {
            progressCallback.displaySavingString("Saving level");
        }

        this.saveLevel();

        if (progressCallback != null) {
            progressCallback.displayLoadingString("Saving chunks");
        }

        this.chunkProvider.saveChunks(p_73044_1_, progressCallback);

        // Neptune - Disable vanilla ChunkGC
        // for (net.minecraft.world.chunk.Chunk chunk : Lists.newArrayList(this.theChunkProviderServer.func_152380_a())) {
        //     if (chunk != null && !this.thePlayerManager.hasPlayerInstance(chunk.xPosition, chunk.zPosition)) {
        //         this.theChunkProviderServer.dropChunk(chunk.xPosition, chunk.zPosition);
        //     }
        // }
        // Neptune - end
    }
}
项目:Cauldron    文件:Minecraft.java   
public static void stopIntegratedServer()
{
    if (theMinecraft != null)
    {
        IntegratedServer integratedserver = theMinecraft.getIntegratedServer();

        if (integratedserver != null)
        {
            try
            {
                integratedserver.stopServer();
            }
            catch (MinecraftException e)
            {
                e.printStackTrace();
            }
        }
    }
}
项目:Cauldron    文件:AnvilChunkLoader.java   
public void saveChunk(World p_75816_1_, Chunk p_75816_2_) throws MinecraftException, IOException
{
    p_75816_1_.checkSessionLock();

    try
    {
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        NBTTagCompound nbttagcompound1 = new NBTTagCompound();
        nbttagcompound.setTag("Level", nbttagcompound1);
        this.writeChunkToNBT(p_75816_2_, p_75816_1_, nbttagcompound1);
        MinecraftForge.EVENT_BUS.post(new ChunkDataEvent.Save(p_75816_2_, nbttagcompound));
        this.addChunkToPending(p_75816_2_.getChunkCoordIntPair(), nbttagcompound);
    }
    catch (Exception exception)
    {
        exception.printStackTrace();
    }
}
项目:Cauldron    文件:ChunkProviderServer.java   
private void safeSaveChunk(Chunk p_73242_1_)
{
    if (this.currentChunkLoader != null)
    {
        try
        {
            p_73242_1_.lastSaveTime = this.worldObj.getTotalWorldTime();
            this.currentChunkLoader.saveChunk(this.worldObj, p_73242_1_);
        }
        catch (IOException ioexception)
        {
            logger.error("Couldn\'t save chunk", ioexception);
        }
        catch (MinecraftException minecraftexception)
        {
            logger.error("Couldn\'t save chunk; already in use by another instance of Minecraft?", minecraftexception);
        }
    }
}
项目:Cauldron    文件:SaveHandler.java   
public void checkSessionLock() throws MinecraftException
{
    try
    {
        File file1 = new File(this.worldDirectory, "session.lock");
        DataInputStream datainputstream = new DataInputStream(new FileInputStream(file1));

        try
        {
            if (datainputstream.readLong() != this.initializationTime)
            {
                throw new MinecraftException("The save is being accessed from another location, aborting");
            }
        }
        finally
        {
            datainputstream.close();
        }
    }
    catch (IOException ioexception)
    {
        throw new MinecraftException("Failed to check session lock, aborting");
    }
}
项目:RuneCraftery    文件:SaveHandler.java   
public void func_75762_c() throws MinecraftException {
   try {
      File var1 = new File(this.field_75770_b, "session.lock");
      DataInputStream var2 = new DataInputStream(new FileInputStream(var1));

      try {
         if(var2.readLong() != this.field_75769_e) {
            throw new MinecraftException("The save is being accessed from another location, aborting");
         }
      } finally {
         var2.close();
      }

   } catch (IOException var7) {
      throw new MinecraftException("Failed to check session lock, aborting");
   }
}
项目:RuneCraftery    文件:MinecraftServer.java   
protected void func_71267_a(boolean p_71267_1_) {
   if(!this.field_71290_O) {
      WorldServer[] var2 = this.field_71305_c;
      int var3 = var2.length;

      for(int var4 = 0; var4 < var3; ++var4) {
         WorldServer var5 = var2[var4];
         if(var5 != null) {
            if(!p_71267_1_) {
               this.func_98033_al().func_98233_a("Saving chunks for level \'" + var5.func_72912_H().func_76065_j() + "\'/" + var5.field_73011_w.func_80007_l());
            }

            try {
               var5.func_73044_a(true, (IProgressUpdate)null);
            } catch (MinecraftException var7) {
               this.func_98033_al().func_98236_b(var7.getMessage());
            }
         }
      }

   }
}
项目:RuneCraftery    文件:AnvilChunkLoader.java   
public void saveChunk(World par1World, Chunk par2Chunk) throws MinecraftException, IOException
{
    par1World.checkSessionLock();

    try
    {
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        NBTTagCompound nbttagcompound1 = new NBTTagCompound();
        nbttagcompound.setTag("Level", nbttagcompound1);
        this.writeChunkToNBT(par2Chunk, par1World, nbttagcompound1);
        MinecraftForge.EVENT_BUS.post(new ChunkDataEvent.Save(par2Chunk, nbttagcompound));
        this.addChunkToPending(par2Chunk.getChunkCoordIntPair(), nbttagcompound);
    }
    catch (Exception exception)
    {
        exception.printStackTrace();
    }
}
项目:RuneCraftery    文件:ChunkProviderServer.java   
/**
 * used by saveChunks, but catches any exceptions if the save fails.
 */
private void safeSaveChunk(Chunk par1Chunk)
{
    if (this.currentChunkLoader != null)
    {
        try
        {
            par1Chunk.lastSaveTime = this.worldObj.getTotalWorldTime();
            this.currentChunkLoader.saveChunk(this.worldObj, par1Chunk);
        }
        catch (IOException ioexception)
        {
            ioexception.printStackTrace();
        }
        catch (MinecraftException minecraftexception)
        {
            minecraftexception.printStackTrace();
        }
    }
}