本文整理汇总了Java中net.minecraft.world.storage.ISaveFormat类的典型用法代码示例。如果您正苦于以下问题:Java ISaveFormat类的具体用法?Java ISaveFormat怎么用?Java ISaveFormat使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ISaveFormat类属于net.minecraft.world.storage包,在下文中一共展示了ISaveFormat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: func_146317_a
import net.minecraft.world.storage.ISaveFormat; //导入依赖的package包/类
public static String func_146317_a(ISaveFormat p_146317_0_, String p_146317_1_)
{
p_146317_1_ = p_146317_1_.replaceAll("[\\./\"]", "_");
for (String s : disallowedFilenames)
{
if (p_146317_1_.equalsIgnoreCase(s))
{
p_146317_1_ = "_" + p_146317_1_ + "_";
}
}
while (p_146317_0_.getWorldInfo(p_146317_1_) != null)
{
p_146317_1_ = p_146317_1_ + "-";
}
return p_146317_1_;
}
示例2: confirmClicked
import net.minecraft.world.storage.ISaveFormat; //导入依赖的package包/类
public void confirmClicked(boolean result, int id)
{
if (this.field_146643_x)
{
this.field_146643_x = false;
if (result)
{
ISaveFormat isaveformat = this.mc.getSaveLoader();
isaveformat.flushCache();
isaveformat.deleteWorldDirectory(this.func_146621_a(id));
try
{
this.func_146627_h();
}
catch (AnvilConverterException anvilconverterexception)
{
logger.error((String)"Couldn\'t load level list", (Throwable)anvilconverterexception);
}
}
this.mc.displayGuiScreen(this);
}
}
示例3: actionPerformed
import net.minecraft.world.storage.ISaveFormat; //导入依赖的package包/类
/**
* Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
*/
protected void actionPerformed(GuiButton button) throws IOException
{
if (button.enabled)
{
if (button.id == 1)
{
this.mc.displayGuiScreen(this.parentScreen);
}
else if (button.id == 0)
{
ISaveFormat isaveformat = this.mc.getSaveLoader();
isaveformat.renameWorld(this.saveName, this.field_146583_f.getText().trim());
this.mc.displayGuiScreen(this.parentScreen);
}
}
}
示例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<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);
}
}
}
示例5: GuiListWorldSelectionEntry
import net.minecraft.world.storage.ISaveFormat; //导入依赖的package包/类
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();
}
示例6: deleteWorld
import net.minecraft.world.storage.ISaveFormat; //导入依赖的package包/类
public void deleteWorld()
{
this.client.displayGuiScreen(new GuiYesNo(new GuiYesNoCallback()
{
public void confirmClicked(boolean result, int id)
{
if (result)
{
GuiListWorldSelectionEntry.this.client.displayGuiScreen(new GuiScreenWorking());
ISaveFormat isaveformat = GuiListWorldSelectionEntry.this.client.getSaveLoader();
isaveformat.flushCache();
isaveformat.deleteWorldDirectory(GuiListWorldSelectionEntry.this.worldSummary.getFileName());
GuiListWorldSelectionEntry.this.containingListSel.refreshList();
}
GuiListWorldSelectionEntry.this.client.displayGuiScreen(GuiListWorldSelectionEntry.this.worldSelScreen);
}
}, I18n.format("selectWorld.deleteQuestion", new Object[0]), "\'" + this.worldSummary.getDisplayName() + "\' " + I18n.format("selectWorld.deleteWarning", new Object[0]), I18n.format("selectWorld.deleteButton", new Object[0]), I18n.format("gui.cancel", new Object[0]), 0));
}
示例7: getUncollidingSaveDirName
import net.minecraft.world.storage.ISaveFormat; //导入依赖的package包/类
/**
* Ensures that a proposed directory name doesn't collide with existing names.
* Returns the name, possibly modified to avoid collisions.
*/
public static String getUncollidingSaveDirName(ISaveFormat saveLoader, String name)
{
name = name.replaceAll("[\\./\"]", "_");
for (String s : DISALLOWED_FILENAMES)
{
if (name.equalsIgnoreCase(s))
{
name = "_" + name + "_";
}
}
while (saveLoader.getWorldInfo(name) != null)
{
name = name + "-";
}
return name;
}
示例8: 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()));
}
}
示例9: initGui
import net.minecraft.world.storage.ISaveFormat; //导入依赖的package包/类
/**
* Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
* window resizes, the buttonList is cleared beforehand.
*/
public void initGui()
{
Keyboard.enableRepeatEvents(true);
this.buttonList.clear();
GuiButton guibutton = this.addButton(new GuiButton(3, this.width / 2 - 100, this.height / 4 + 24 + 12, I18n.format("selectWorld.edit.resetIcon", new Object[0])));
this.buttonList.add(new GuiButton(4, this.width / 2 - 100, this.height / 4 + 48 + 12, I18n.format("selectWorld.edit.openFolder", new Object[0])));
this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + 12, I18n.format("selectWorld.edit.save", new Object[0])));
this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + 12, I18n.format("gui.cancel", new Object[0])));
guibutton.enabled = this.mc.getSaveLoader().getFile(this.worldId, "icon.png").isFile();
ISaveFormat isaveformat = this.mc.getSaveLoader();
WorldInfo worldinfo = isaveformat.getWorldInfo(this.worldId);
String s = worldinfo == null ? "" : worldinfo.getWorldName();
this.nameEdit = new GuiTextField(2, this.fontRendererObj, this.width / 2 - 100, 60, 200, 20);
this.nameEdit.setFocused(true);
this.nameEdit.setText(s);
}
示例10: confirmClicked
import net.minecraft.world.storage.ISaveFormat; //导入依赖的package包/类
public void confirmClicked(boolean result, int id) {
if (result && id == 12) {
ISaveFormat isaveformat = this.mc.getSaveLoader();
isaveformat.flushCache();
isaveformat.deleteWorldDirectory("Demo_World");
this.mc.displayGuiScreen(this);
} else if (id == 12) {
this.mc.displayGuiScreen(this);
} else if (id == 13) {
if (result) {
try {
Class<?> oclass = Class.forName("java.awt.Desktop");
Object object = oclass.getMethod("getDesktop", new Class[0]).invoke((Object) null, new Object[0]);
oclass.getMethod("browse", new Class[] { URI.class }).invoke(object,
new Object[] { new URI(this.openGLWarningLink) });
} catch (Throwable throwable) {
LOGGER.error("Couldn\'t open link", throwable);
}
}
this.mc.displayGuiScreen(this);
}
}
示例11: 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()));
}
}
示例12: initGui
import net.minecraft.world.storage.ISaveFormat; //导入依赖的package包/类
/**
* Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
* window resizes, the buttonList is cleared beforehand.
*/
public void initGui()
{
Keyboard.enableRepeatEvents(true);
this.buttonList.clear();
GuiButton guibutton = this.addButton(new GuiButton(3, this.width / 2 - 100, this.height / 4 + 24 + 12, I18n.format("selectWorld.edit.resetIcon", new Object[0])));
this.buttonList.add(new GuiButton(4, this.width / 2 - 100, this.height / 4 + 48 + 12, I18n.format("selectWorld.edit.openFolder", new Object[0])));
this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + 12, I18n.format("selectWorld.edit.save", new Object[0])));
this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + 12, I18n.format("gui.cancel", new Object[0])));
guibutton.enabled = this.mc.getSaveLoader().getFile(this.worldId, "icon.png").isFile();
ISaveFormat isaveformat = this.mc.getSaveLoader();
WorldInfo worldinfo = isaveformat.getWorldInfo(this.worldId);
String s = worldinfo.getWorldName();
this.nameEdit = new GuiTextField(2, this.fontRendererObj, this.width / 2 - 100, 60, 200, 20);
this.nameEdit.setFocused(true);
this.nameEdit.setText(s);
}
示例13: func_146317_a
import net.minecraft.world.storage.ISaveFormat; //导入依赖的package包/类
public static String func_146317_a(ISaveFormat p_146317_0_, String p_146317_1_)
{
p_146317_1_ = p_146317_1_.replaceAll("[\\./\"]", "_");
String[] astring = disallowedFilenames;
int i = astring.length;
for (int j = 0; j < i; ++j)
{
String s1 = astring[j];
if (p_146317_1_.equalsIgnoreCase(s1))
{
p_146317_1_ = "_" + p_146317_1_ + "_";
}
}
while (p_146317_0_.getWorldInfo(p_146317_1_) != null)
{
p_146317_1_ = p_146317_1_ + "-";
}
return p_146317_1_;
}
示例14: 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);
}
}
}
示例15: func_146317_a
import net.minecraft.world.storage.ISaveFormat; //导入依赖的package包/类
public static String func_146317_a(ISaveFormat p_146317_0_, String p_146317_1_)
{
p_146317_1_ = p_146317_1_.replaceAll("[\\./\"]", "_");
String[] var2 = field_146327_L;
int var3 = var2.length;
for (int var4 = 0; var4 < var3; ++var4)
{
String var5 = var2[var4];
if (p_146317_1_.equalsIgnoreCase(var5))
{
p_146317_1_ = "_" + p_146317_1_ + "_";
}
}
while (p_146317_0_.getWorldInfo(p_146317_1_) != null)
{
p_146317_1_ = p_146317_1_ + "-";
}
return p_146317_1_;
}