Java 类net.minecraft.world.storage.WorldSummary 实例源码

项目:Backmemed    文件:GuiListWorldSelectionEntry.java   
public GuiListWorldSelectionEntry(GuiListWorldSelection listWorldSelIn, WorldSummary p_i46591_2_, ISaveFormat p_i46591_3_)
{
    this.containingListSel = listWorldSelIn;
    this.worldSelScreen = listWorldSelIn.getGuiWorldSelection();
    this.worldSummary = p_i46591_2_;
    this.client = Minecraft.getMinecraft();
    this.iconLocation = new ResourceLocation("worlds/" + p_i46591_2_.getFileName() + "/icon");
    this.iconFile = p_i46591_3_.getFile(p_i46591_2_.getFileName(), "icon.png");

    if (!this.iconFile.isFile())
    {
        this.iconFile = null;
    }

    this.loadServerIcon();
}
项目:Backmemed    文件:GuiListWorldSelection.java   
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()));
    }
}
项目:CustomWorldGen    文件:GuiListWorldSelectionEntry.java   
public GuiListWorldSelectionEntry(GuiListWorldSelection listWorldSelIn, WorldSummary p_i46591_2_, ISaveFormat p_i46591_3_)
{
    this.containingListSel = listWorldSelIn;
    this.worldSelScreen = listWorldSelIn.getGuiWorldSelection();
    this.worldSummary = p_i46591_2_;
    this.client = Minecraft.getMinecraft();
    this.iconLocation = new ResourceLocation("worlds/" + p_i46591_2_.getFileName() + "/icon");
    this.iconFile = p_i46591_3_.getFile(p_i46591_2_.getFileName(), "icon.png");

    if (!this.iconFile.isFile())
    {
        this.iconFile = null;
    }

    this.loadServerIcon();
}
项目:CustomWorldGen    文件:GuiListWorldSelection.java   
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()));
    }
}
项目:malmo    文件:MapFileHelper.java   
/**
 * 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);
        }
    }
}
项目:ExpandedRailsMod    文件:GuiListWorldSelectionEntry.java   
public GuiListWorldSelectionEntry(GuiListWorldSelection listWorldSelIn, WorldSummary p_i46591_2_, ISaveFormat p_i46591_3_)
{
    this.containingListSel = listWorldSelIn;
    this.worldSelScreen = listWorldSelIn.getGuiWorldSelection();
    this.worldSummary = p_i46591_2_;
    this.client = Minecraft.getMinecraft();
    this.iconLocation = new ResourceLocation("worlds/" + p_i46591_2_.getFileName() + "/icon");
    this.iconFile = p_i46591_3_.getFile(p_i46591_2_.getFileName(), "icon.png");

    if (!this.iconFile.isFile())
    {
        this.iconFile = null;
    }

    this.loadServerIcon();
}
项目:ExpandedRailsMod    文件:GuiListWorldSelection.java   
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()));
    }
}
项目:Backmemed    文件:AnvilSaveConverter.java   
public List<WorldSummary> getSaveList() throws AnvilConverterException
{
    if (this.savesDirectory != null && this.savesDirectory.exists() && this.savesDirectory.isDirectory())
    {
        List<WorldSummary> list = Lists.<WorldSummary>newArrayList();
        File[] afile = this.savesDirectory.listFiles();

        for (File file1 : afile)
        {
            if (file1.isDirectory())
            {
                String s = file1.getName();
                WorldInfo worldinfo = this.getWorldInfo(s);

                if (worldinfo != null && (worldinfo.getSaveVersion() == 19132 || worldinfo.getSaveVersion() == 19133))
                {
                    boolean flag = worldinfo.getSaveVersion() != this.getSaveVersion();
                    String s1 = worldinfo.getWorldName();

                    if (StringUtils.isEmpty(s1))
                    {
                        s1 = s;
                    }

                    long i = 0L;
                    list.add(new WorldSummary(worldinfo, s, s1, 0L, flag));
                }
            }
        }

        return list;
    }
    else
    {
        throw new AnvilConverterException(I18n.translateToLocal("selectWorld.load_folder_access"));
    }
}
项目:Backmemed    文件:RealmsAnvilLevelStorageSource.java   
public List<RealmsLevelSummary> getLevelList() throws AnvilConverterException
{
    List<RealmsLevelSummary> list = Lists.<RealmsLevelSummary>newArrayList();

    for (WorldSummary worldsummary : this.levelStorageSource.getSaveList())
    {
        list.add(new RealmsLevelSummary(worldsummary));
    }

    return list;
}
项目:CustomWorldGen    文件:AnvilSaveConverter.java   
@SideOnly(Side.CLIENT)
public List<WorldSummary> getSaveList() throws AnvilConverterException
{
    if (this.savesDirectory != null && this.savesDirectory.exists() && this.savesDirectory.isDirectory())
    {
        List<WorldSummary> list = Lists.<WorldSummary>newArrayList();
        File[] afile = this.savesDirectory.listFiles();

        for (File file1 : afile)
        {
            if (file1.isDirectory())
            {
                String s = file1.getName();
                WorldInfo worldinfo = this.getWorldInfo(s);

                if (worldinfo != null && (worldinfo.getSaveVersion() == 19132 || worldinfo.getSaveVersion() == 19133))
                {
                    boolean flag = worldinfo.getSaveVersion() != this.getSaveVersion();
                    String s1 = worldinfo.getWorldName();

                    if (StringUtils.isEmpty(s1))
                    {
                        s1 = s;
                    }

                    long i = 0L;
                    list.add(new WorldSummary(worldinfo, s, s1, 0L, flag));
                }
            }
        }

        return list;
    }
    else
    {
        throw new AnvilConverterException("Unable to read or access folder where game worlds are saved!");
    }
}
项目:CustomWorldGen    文件:RealmsAnvilLevelStorageSource.java   
public List<RealmsLevelSummary> getLevelList() throws AnvilConverterException
{
    List<RealmsLevelSummary> list = Lists.<RealmsLevelSummary>newArrayList();

    for (WorldSummary worldsummary : this.levelStorageSource.getSaveList())
    {
        list.add(new RealmsLevelSummary(worldsummary));
    }

    return list;
}
项目:Backmemed    文件:RealmsLevelSummary.java   
public RealmsLevelSummary(WorldSummary levelSummaryIn)
{
    this.levelSummary = levelSummaryIn;
}
项目:Backmemed    文件:RealmsLevelSummary.java   
public int compareTo(WorldSummary p_compareTo_1_)
{
    return this.levelSummary.compareTo(p_compareTo_1_);
}
项目:CustomWorldGen    文件:RealmsLevelSummary.java   
public RealmsLevelSummary(WorldSummary levelSummaryIn)
{
    this.levelSummary = levelSummaryIn;
}
项目:CustomWorldGen    文件:RealmsLevelSummary.java   
public int compareTo(WorldSummary p_compareTo_1_)
{
    return this.levelSummary.compareTo(p_compareTo_1_);
}
项目:malmo    文件:FileWorldGeneratorImplementation.java   
@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;
}