当前位置: 首页>>代码示例>>Java>>正文


Java ISaveFormat.getSaveList方法代码示例

本文整理汇总了Java中net.minecraft.world.storage.ISaveFormat.getSaveList方法的典型用法代码示例。如果您正苦于以下问题:Java ISaveFormat.getSaveList方法的具体用法?Java ISaveFormat.getSaveList怎么用?Java ISaveFormat.getSaveList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.world.storage.ISaveFormat的用法示例。


在下文中一共展示了ISaveFormat.getSaveList方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: cleanupTemporaryWorlds

import net.minecraft.world.storage.ISaveFormat; //导入方法依赖的package包/类
/**
 * Attempts to delete all Minecraft Worlds with "TEMP_" in front of the name
 * @param currentWorld excludes this world from deletion, can be null
 */
public static void cleanupTemporaryWorlds(String currentWorld){
    List<SaveFormatComparator> saveList;
    ISaveFormat isaveformat = Minecraft.getMinecraft().getSaveLoader();
    isaveformat.flushCache();

    try{
        saveList = isaveformat.getSaveList();
    } catch (AnvilConverterException e){
        e.printStackTrace();
        return;
    }

    String searchString = tempMark + AddressHelper.getMissionControlPort() + "_";

    for (SaveFormatComparator s: saveList){
        String folderName = s.getFileName();
        if (folderName.startsWith(searchString) && !folderName.equals(currentWorld)){
            isaveformat.deleteWorldDirectory(folderName);
        }
    }
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:26,代码来源:MapFileHelper.java

示例2: refreshList

import net.minecraft.world.storage.ISaveFormat; //导入方法依赖的package包/类
public void refreshList()
{
    ISaveFormat isaveformat = this.mc.getSaveLoader();
    List<WorldSummary> list;

    try
    {
        list = isaveformat.getSaveList();
    }
    catch (AnvilConverterException anvilconverterexception)
    {
        LOGGER.error((String)"Couldn\'t load level list", (Throwable)anvilconverterexception);
        this.mc.displayGuiScreen(new GuiErrorScreen(I18n.format("selectWorld.unable_to_load", new Object[0]), anvilconverterexception.getMessage()));
        return;
    }

    Collections.sort(list);

    for (WorldSummary worldsummary : list)
    {
        this.entries.add(new GuiListWorldSelectionEntry(this, worldsummary, this.mc.getSaveLoader()));
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:24,代码来源:GuiListWorldSelection.java

示例3: refreshList

import net.minecraft.world.storage.ISaveFormat; //导入方法依赖的package包/类
public void refreshList()
{
    ISaveFormat isaveformat = this.mc.getSaveLoader();
    List<WorldSummary> list;

    try
    {
        list = isaveformat.getSaveList();
    }
    catch (AnvilConverterException anvilconverterexception)
    {
        LOGGER.error((String)"Couldn\'t load level list", (Throwable)anvilconverterexception);
        this.mc.displayGuiScreen(new GuiErrorScreen("Unable to load worlds", anvilconverterexception.getMessage()));
        return;
    }

    Collections.sort(list);

    for (WorldSummary worldsummary : list)
    {
        this.entries.add(new GuiListWorldSelectionEntry(this, worldsummary, this.mc.getSaveLoader()));
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:24,代码来源:GuiListWorldSelection.java

示例4: cleanupTemporaryWorlds

import net.minecraft.world.storage.ISaveFormat; //导入方法依赖的package包/类
/**
 * Attempts to delete all Minecraft Worlds with "TEMP_" in front of the name
 * @param currentWorld excludes this world from deletion, can be null
 */
public static void cleanupTemporaryWorlds(String currentWorld){
    List<WorldSummary> saveList;
    ISaveFormat isaveformat = Minecraft.getMinecraft().getSaveLoader();
    isaveformat.flushCache();

    try{
        saveList = isaveformat.getSaveList();
    } catch (AnvilConverterException e){
        e.printStackTrace();
        return;
    }

    String searchString = tempMark + AddressHelper.getMissionControlPort() + "_";

    for (WorldSummary s: saveList){
        String folderName = s.getFileName();
        if (folderName.startsWith(searchString) && !folderName.equals(currentWorld)){
            isaveformat.deleteWorldDirectory(folderName);
        }
    }
}
 
开发者ID:Microsoft,项目名称:malmo,代码行数:26,代码来源:MapFileHelper.java

示例5: loadSaveList

import net.minecraft.world.storage.ISaveFormat; //导入方法依赖的package包/类
public void loadSaveList() throws AnvilConverterException, IllegalAccessException {
	ISaveFormat saveFormat = mc.getSaveLoader();
	java.util.List list = saveFormat.getSaveList();
	ArrayList newList = new ArrayList();
	for(Object obj : list) {
		if(obj instanceof SaveFormatComparator) {
			//SaveFormatComparator comparator = (SaveFormatComparator) obj;
			//if(saveFormat.getWorldInfo(comparator.getFileName()).getNBTTagCompound().hasKey("AgeCraft")) {
				newList.add(obj);
			//}
		}
	}
	Collections.sort(newList);
	super_field_146639_s.set(this, newList);
	super_field_146640_r.setInt(this, -1);
}
 
开发者ID:AgeCraft,项目名称:AgeCraft-Old,代码行数:17,代码来源:GuiSelectWorld.java

示例6: func_146627_h

import net.minecraft.world.storage.ISaveFormat; //导入方法依赖的package包/类
private void func_146627_h() throws AnvilConverterException
{
    ISaveFormat isaveformat = this.mc.getSaveLoader();
    this.field_146639_s = isaveformat.getSaveList();
    Collections.sort(this.field_146639_s);
    this.field_146640_r = -1;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:8,代码来源:GuiSelectWorld.java

示例7: func_146627_h

import net.minecraft.world.storage.ISaveFormat; //导入方法依赖的package包/类
private void func_146627_h() throws AnvilConverterException
{
    ISaveFormat var1 = this.mc.getSaveLoader();
    this.field_146639_s = var1.getSaveList();
    Collections.sort(this.field_146639_s);
    this.field_146640_r = -1;
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:8,代码来源:GuiSelectWorld.java

示例8: loadSaves

import net.minecraft.world.storage.ISaveFormat; //导入方法依赖的package包/类
/**
 * loads the saves
 */
private void loadSaves() throws AnvilConverterException
{
    ISaveFormat isaveformat = this.mc.getSaveLoader();
    this.saveList = isaveformat.getSaveList();
    Collections.sort(this.saveList);
    this.selectedWorld = -1;
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:11,代码来源:GuiSelectWorld.java

示例9: createWorld

import net.minecraft.world.storage.ISaveFormat; //导入方法依赖的package包/类
@Override
public boolean createWorld(MissionInit missionInit)
{
    if (this.mapFilename == null || this.mapFilename.length() == 0)
    {
        this.errorDetails = "No basemap URI provided - check your Mission XML.";
        return false;
    }
    File mapSource = new File(this.mapFilename);
    if (!mapSource.exists())
    {
        this.errorDetails = "Basemap file " + this.mapFilename + " was not found - check your Mission XML and ensure the file exists on the Minecraft client machine.";
        return false;
    }
    if (!mapSource.isDirectory())
    {
        this.errorDetails = "Basemap location " + this.mapFilename + " needs to be a folder. Check the path in your Mission XML.";
        return false;
    }
    File mapCopy = MapFileHelper.copyMapFiles(mapSource, this.fwparams.isDestroyAfterUse());
    if (mapCopy == null)
    {
        this.errorDetails = "Unable to copy " + this.mapFilename + " - is the hard drive full?";
        return false;
    }
    if (!Minecraft.getMinecraft().getSaveLoader().canLoadWorld(mapCopy.getName()))
    {
        this.errorDetails = "Minecraft is unable to load " + this.mapFilename + " - is it a valid saved world?";
        return false;
    }

    ISaveFormat isaveformat = Minecraft.getMinecraft().getSaveLoader();
    List<WorldSummary> worldlist;
    try
    {
        worldlist = isaveformat.getSaveList();
    }
    catch (AnvilConverterException anvilconverterexception)
    {
    	this.errorDetails = "Minecraft couldn't rebuild saved world list.";
        return false;
    }

    WorldSummary newWorld = null;
    for (WorldSummary ws : worldlist)
    {
        if (ws.getFileName().equals(mapCopy.getName()))
            newWorld = ws;
    }
    if (newWorld == null)
    {
        this.errorDetails = "Minecraft could not find the copied world.";
        return false;
    }

    net.minecraftforge.fml.client.FMLClientHandler.instance().tryLoadExistingWorld(null, newWorld);
    IntegratedServer server = Minecraft.getMinecraft().getIntegratedServer();
    String worldName = (server != null) ? server.getWorldName() : null;
    if (worldName == null || !worldName.equals(newWorld.getDisplayName()))
    {
        this.errorDetails = "Minecraft could not load " + this.mapFilename + " - is it a valid saved world?";
        return false;
    }
    MapFileHelper.cleanupTemporaryWorlds(mapCopy.getName());    // Now we are safely running a new file, we can attempt to clean up old ones.
    return true;
}
 
开发者ID:Microsoft,项目名称:malmo,代码行数:67,代码来源:FileWorldGeneratorImplementation.java


注:本文中的net.minecraft.world.storage.ISaveFormat.getSaveList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。