本文整理汇总了Java中net.minecraft.world.MinecraftException类的典型用法代码示例。如果您正苦于以下问题:Java MinecraftException类的具体用法?Java MinecraftException怎么用?Java MinecraftException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MinecraftException类属于net.minecraft.world包,在下文中一共展示了MinecraftException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: saveChunk
import net.minecraft.world.MinecraftException; //导入依赖的package包/类
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);
}
}
示例2: saveChunkData
import net.minecraft.world.MinecraftException; //导入依赖的package包/类
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);
}
}
}
示例3: checkSessionLock
import net.minecraft.world.MinecraftException; //导入依赖的package包/类
/**
* 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");
}
}
示例4: saveAllWorlds
import net.minecraft.world.MinecraftException; //导入依赖的package包/类
/**
* 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());
}
}
}
}
}
示例5: saveChunk
import net.minecraft.world.MinecraftException; //导入依赖的package包/类
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);
}
}
示例6: saveChunkData
import net.minecraft.world.MinecraftException; //导入依赖的package包/类
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);
}
}
示例7: saveAllWorlds
import net.minecraft.world.MinecraftException; //导入依赖的package包/类
/**
* 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());
}
}
}
}
示例8: saveChunk
import net.minecraft.world.MinecraftException; //导入依赖的package包/类
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);
}
}
示例9: checkSessionLock
import net.minecraft.world.MinecraftException; //导入依赖的package包/类
/**
* 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");
}
}
示例10: saveChunkData
import net.minecraft.world.MinecraftException; //导入依赖的package包/类
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);
}
}
示例11: saveAllChunks
import net.minecraft.world.MinecraftException; //导入依赖的package包/类
/**
* 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);
}
}
}
}
示例12: saveChunk
import net.minecraft.world.MinecraftException; //导入依赖的package包/类
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();
}
}
示例13: saveChunk
import net.minecraft.world.MinecraftException; //导入依赖的package包/类
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();
}
}
示例14: safeSaveChunk
import net.minecraft.world.MinecraftException; //导入依赖的package包/类
/**
* 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);
}
}
}
示例15: checkSessionLock
import net.minecraft.world.MinecraftException; //导入依赖的package包/类
/**
* 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");
}
}