本文整理汇总了Java中net.minecraft.world.MinecraftException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java MinecraftException.printStackTrace方法的具体用法?Java MinecraftException.printStackTrace怎么用?Java MinecraftException.printStackTrace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.world.MinecraftException
的用法示例。
在下文中一共展示了MinecraftException.printStackTrace方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stopIntegratedServer
import net.minecraft.world.MinecraftException; //导入方法依赖的package包/类
public static void stopIntegratedServer()
{
if (theMinecraft != null)
{
IntegratedServer integratedserver = theMinecraft.getIntegratedServer();
if (integratedserver != null)
{
try
{
integratedserver.stopServer();
}
catch (MinecraftException e)
{
e.printStackTrace();
}
}
}
}
示例2: 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 ioexception)
{
ioexception.printStackTrace();
}
catch (MinecraftException minecraftexception)
{
minecraftexception.printStackTrace();
}
}
}
示例3: run
import net.minecraft.world.MinecraftException; //导入方法依赖的package包/类
@Override
public void run() {
try {
server.stopServer();
} catch (MinecraftException ex) {
ex.printStackTrace();
} finally {
try {
server.reader.getTerminal().restore();
} catch (Exception e) {
}
}
}
示例4: saveWorld
import net.minecraft.world.MinecraftException; //导入方法依赖的package包/类
/** Safely saves a given world to disk */
public static void saveWorld(WorldServer world)
{
try
{
Boolean saveFlag = world.disableLevelSaving;
world.disableLevelSaving = true;
world.saveAllChunks(true, null);
world.disableLevelSaving = saveFlag;
}
catch (MinecraftException e)
{
e.printStackTrace();
}
}
示例5: unloadWorlds
import net.minecraft.world.MinecraftException; //导入方法依赖的package包/类
public static void unloadWorlds(Hashtable<Integer, long[]> worldTickTimes) {
for (int id : unloadQueue) {
WorldServer w = worlds.get(id);
try {
if (w != null)
{
w.saveAllChunks(true, null);
}
else
{
FMLLog.warning("Unexpected world unload - world %d is already unloaded", id);
}
} catch (MinecraftException e) {
e.printStackTrace();
}
finally
{
if (w != null)
{
MinecraftForge.EVENT_BUS.post(new WorldEvent.Unload(w));
w.flush();
setWorld(id, null, w.getMinecraftServer());
}
}
}
unloadQueue.clear();
}
示例6: unloadWorlds
import net.minecraft.world.MinecraftException; //导入方法依赖的package包/类
public static void unloadWorlds(Hashtable<Integer, long[]> worldTickTimes) {
for (int id : unloadQueue) {
WorldServer w = worlds.get(id);
try {
if (w != null)
{
w.func_73044_a(true, null);
}
else
{
FMLLog.warning("Unexpected world unload - world %d is already unloaded", id);
}
} catch (MinecraftException e) {
e.printStackTrace();
}
finally
{
if (w != null)
{
MinecraftForge.EVENT_BUS.post(new WorldEvent.Unload(w));
w.func_73041_k();
setWorld(id, null);
}
}
}
unloadQueue.clear();
}
示例7: saveWorld
import net.minecraft.world.MinecraftException; //导入方法依赖的package包/类
/** Safely saves a given world to disk */
public static void saveWorld(WorldServer world)
{
try
{
Boolean saveFlag = world.levelSaving;
world.levelSaving = false;
world.saveAllChunks(true, null);
world.levelSaving = saveFlag;
}
catch (MinecraftException e)
{
e.printStackTrace();
}
}
示例8: unloadWorlds
import net.minecraft.world.MinecraftException; //导入方法依赖的package包/类
public static void unloadWorlds(Hashtable<Integer, long[]> worldTickTimes) {
for (int id : unloadQueue) {
WorldServer w = worlds.get(id);
try {
if (w != null)
{
w.saveAllChunks(true, null);
}
else
{
FMLLog.warning("Unexpected world unload - world %d is already unloaded", id);
}
} catch (MinecraftException e) {
e.printStackTrace();
}
finally
{
if (w != null)
{
MinecraftForge.EVENT_BUS.post(new WorldEvent.Unload(w));
w.flush();
setWorld(id, null);
}
}
}
unloadQueue.clear();
}
示例9: disableWorldSaving
import net.minecraft.world.MinecraftException; //导入方法依赖的package包/类
public static void disableWorldSaving()
{
LogHelper.info("Saving worlds and turning world auto-save off");
MinecraftServer server = MinecraftServer.getServer();
ServerConfigurationManager server_config_manager = MinecraftServer.getServer().getConfigurationManager();
int server_count = server.worldServers.length;
saveFlags = new HashMap<>();
server_config_manager.saveAllPlayerData();
LogHelper.info("Player data saved");
for (int i = 0; i < server_count; i++)
{
WorldServer world_server = server.worldServers[i];
saveFlags.put(world_server, world_server.levelSaving);
world_server.levelSaving = false;
try
{
world_server.saveAllChunks(true, null);
world_server.saveChunkData();
LogHelper.debug("Saved world %s", world_server.toString());
}
catch (MinecraftException ex)
{
LogHelper.error("Error saving world %s: %s", world_server.toString(), ex.getMessage());
ex.printStackTrace();
}
}
LogHelper.info("Worlds saved");
LogHelper.info("World auto-save turned off");
ChatHelper.sendLocalizedServerChatMsg("yabm2.backup.general.autosave_off");
}
示例10: saveChunk
import net.minecraft.world.MinecraftException; //导入方法依赖的package包/类
public void saveChunk(World p_75816_1_, Chunk p_75816_2_) throws MinecraftException, IOException
{
// CraftBukkit start - "handle" exception
try
{
p_75816_1_.checkSessionLock();
}
catch (MinecraftException ex)
{
ex.printStackTrace();
}
// CraftBukkit end
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();
}
}
示例11: tick
import net.minecraft.world.MinecraftException; //导入方法依赖的package包/类
public void tick()
{
boolean flag = this.isGamePaused;
this.isGamePaused = Minecraft.getMinecraft().getNetHandler() != null && Minecraft.getMinecraft().isGamePaused();
if (!flag && this.isGamePaused)
{
logger.info("Saving and pausing game...");
this.getConfigurationManager().saveAllPlayerData();
try
{
this.saveAllWorlds(false);
}
catch (MinecraftException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if (!this.isGamePaused)
{
super.tick();
if (this.mc.gameSettings.renderDistanceChunks != this.getConfigurationManager().getViewDistance())
{
logger.info("Changing view distance to {}, from {}", new Object[] {Integer.valueOf(this.mc.gameSettings.renderDistanceChunks), Integer.valueOf(this.getConfigurationManager().getViewDistance())});
this.getConfigurationManager().func_152611_a(this.mc.gameSettings.renderDistanceChunks);
}
}
}
示例12: func_73242_b
import net.minecraft.world.MinecraftException; //导入方法依赖的package包/类
private void func_73242_b(Chunk p_73242_1_) {
if(this.field_73247_e != null) {
try {
p_73242_1_.field_76641_n = this.field_73251_h.func_82737_E();
this.field_73247_e.func_75816_a(this.field_73251_h, p_73242_1_);
} catch (IOException var3) {
var3.printStackTrace();
} catch (MinecraftException var4) {
var4.printStackTrace();
}
}
}
示例13: readNBTDataArray
import net.minecraft.world.MinecraftException; //导入方法依赖的package包/类
public List<Integer> readNBTDataArray(int x, int y, int z, String key)
{
try
{
ModLoader.getMinecraftInstance().theWorld.checkSessionLock();
}
catch (MinecraftException e)
{
e.printStackTrace();
}
try
{
File file = new File(ModLoader.getMinecraftInstance().mcDataDir + "/saves/brewingdata/", "cauldron." + x + "." + y + "." + z + ".data.dat");
if (!file.exists())
{
return new ArrayList<Integer>();
}
FileInputStream fileinputstream = new FileInputStream(file.getCanonicalFile());
NBTTagCompound nbt = CompressedStreamTools.readCompressed(fileinputstream);
if (nbt.hasKey(key))
{
List<Integer> l = new ArrayList<Integer>();
for (int i : nbt.getIntArray(key))
{
l.add(i);
}
return l;
}
fileinputstream.close();
}
catch (Exception exception)
{
exception.printStackTrace();
}
return new ArrayList<Integer>();
}
示例14: readNBTData
import net.minecraft.world.MinecraftException; //导入方法依赖的package包/类
public int readNBTData(int x, int y, int z, String key)
{
try
{
ModLoader.getMinecraftInstance().theWorld.checkSessionLock();
}
catch (MinecraftException e)
{
e.printStackTrace();
}
try
{
File file = new File(ModLoader.getMinecraftInstance().mcDataDir + "/saves/brewingdata/", "cauldron." + x + "." + y + "." + z + ".data.dat");
if (!file.exists())
{
return 0;
}
FileInputStream fileinputstream = new FileInputStream(file.getCanonicalFile());
NBTTagCompound nbt = CompressedStreamTools.readCompressed(fileinputstream);
if (nbt.hasKey(key))
{
return nbt.getInteger(key);
}
fileinputstream.close();
}
catch (Exception exception)
{
exception.printStackTrace();
}
return 0;
}
示例15: stopServer
import net.minecraft.world.MinecraftException; //导入方法依赖的package包/类
public void stopServer() throws MinecraftException // CraftBukkit - added throws
{
if (!this.worldIsBeingDeleted && Loader.instance().hasReachedState(LoaderState.SERVER_STARTED) && !serverStopped) // make sure the save is valid and we don't save twice
{
logger.info("Stopping server");
// CraftBukkit start
if (this.server != null)
{
this.server.disablePlugins();
}
// CraftBukkit end
if (this.func_147137_ag() != null)
{
this.func_147137_ag().terminateEndpoints();
}
if (this.serverConfigManager != null)
{
logger.info("Saving players");
this.serverConfigManager.saveAllPlayerData();
this.serverConfigManager.removeAllPlayers();
}
if (this.worldServers != null)
{
logger.info("Saving worlds");
try
{
this.saveAllWorlds(false);
}
catch (MinecraftException e)
{
e.printStackTrace();
}
for (int i = 0; i < this.worldServers.length; ++i)
{
WorldServer worldserver = this.worldServers[i];
MinecraftForge.EVENT_BUS.post(new WorldEvent.Unload(worldserver));
worldserver.flush();
}
WorldServer[] tmp = worldServers;
for (WorldServer world : tmp)
{
DimensionManager.setWorld(world.provider.dimensionId, null);
}
}
if (this.usageSnooper.isSnooperRunning())
{
this.usageSnooper.stopSnooper();
}
}
}