本文整理汇总了Java中me.ichun.mods.ichunutil.common.module.tabula.project.ProjectInfo.repair方法的典型用法代码示例。如果您正苦于以下问题:Java ProjectInfo.repair方法的具体用法?Java ProjectInfo.repair怎么用?Java ProjectInfo.repair使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类me.ichun.mods.ichunutil.common.module.tabula.project.ProjectInfo
的用法示例。
在下文中一共展示了ProjectInfo.repair方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createProjectFromFile
import me.ichun.mods.ichunutil.common.module.tabula.project.ProjectInfo; //导入方法依赖的package包/类
public static ProjectInfo createProjectFromFile(File file)
{
if(compatibleFormats.containsKey(FilenameUtils.getExtension(file.getName())))
{
Importer importer = compatibleFormats.get(FilenameUtils.getExtension(file.getName()));
try
{
ProjectInfo projectInfo = importer.createProjectInfo(file);
projectInfo.projVersion = importer.getProjectVersion();
projectInfo.repair();
return projectInfo;
}
catch(Exception e)
{
iChunUtil.LOGGER.warn("Error creating Project for format " + FilenameUtils.getExtension(file.getName()) + " for file " + file.getAbsolutePath() + " by importer " + importer);
return null;
}
}
return null;
}
示例2: importProject
import me.ichun.mods.ichunutil.common.module.tabula.project.ProjectInfo; //导入方法依赖的package包/类
public void importProject(String ident, String projectString, BufferedImage image)
{
ProjectInfo project = ((new Gson()).fromJson(projectString, ProjectInfo.class));
project.repair();
project.identifier = RandomStringUtils.randomAscii(IDENTIFIER_LENGTH);
projects.add(project);
project.bufferedTexture = image;
for(ProjectInfo info : projects)
{
if(info.identifier.equals(ident))
{
info.cubes.addAll(project.cubes);
info.cubeGroups.addAll(project.cubeGroups);
if(project.bufferedTexture != null)
{
info.textureWidth = project.textureWidth;
info.textureHeight = project.textureHeight;
info.bufferedTexture = project.bufferedTexture;
streamProject(info);
streamProjectTexture(info.identifier, info.bufferedTexture);
}
else
{
streamProject(info);
}
}
}
}
示例3: overrideProject
import me.ichun.mods.ichunutil.common.module.tabula.project.ProjectInfo; //导入方法依赖的package包/类
public void overrideProject(String projectIdent, String projectJson, BufferedImage image) // replaces an entire project with this, or creates a new one.
{
ProjectInfo project = ((new Gson()).fromJson(projectJson, ProjectInfo.class));
project.repair();
BufferedImage oriImage = null;
boolean flag = true;
if(!projectIdent.isEmpty())
{
for(int i = 0; i < projects.size(); i++)
{
ProjectInfo proj = projects.get(i);
if(proj.identifier.equals(projectIdent))
{
oriImage = proj.bufferedTexture;
int txW = project.textureWidth;
int txH = project.textureHeight;
project.inherit(proj);
project.textureWidth = txW;
project.textureHeight = txH;
project.bufferedTexture = image;
projects.remove(i);
projects.add(i, project);
flag = false;
break;
}
}
}
if(flag)
{
project.identifier = RandomStringUtils.randomAscii(IDENTIFIER_LENGTH);
projects.add(project);
project.bufferedTexture = image;
}
streamProject(project);
if(!IOUtil.areBufferedImagesEqual(oriImage, project.bufferedTexture))
{
streamProjectTexture(project.identifier, project.bufferedTexture);
}
}
示例4: elementTriggered
import me.ichun.mods.ichunutil.common.module.tabula.project.ProjectInfo; //导入方法依赖的package包/类
@Override
public void elementTriggered(Element element)
{
if(element.id == 0)
{
workspace.removeWindow(this, true);
}
if((element.id == 1 || element.id == 3) && openingFile == null && ((GuiWorkspace)workspace).isEditor)
{
for(int i = 0; i < modelList.trees.size(); i++)
{
ElementListTree.Tree tree = modelList.trees.get(i);
if(tree.selected)
{
if(workspace.windowDragged == this)
{
workspace.windowDragged = null;
}
ProjectInfo project = ImportList.createProjectFromFile((File)tree.attachedObject);
if(project == null)
{
workspace.addWindowOnTop(new WindowPopup(workspace, 0, 0, 180, 80, 180, 80, "window.open.failed").putInMiddleOfScreen());
}
else
{
project.repair();
openingFile = (File)tree.attachedObject;
openingJson = project.getAsJson();
((GuiWorkspace)workspace).openNextNewProject = true;
if(!((GuiWorkspace)workspace).remoteSession)
{
Tabula.proxy.tickHandlerClient.mainframe.overrideProject("", openingJson, project.bufferedTexture);
}
else if(!((GuiWorkspace)workspace).sessionEnded)
{
ProjectHelper.sendProjectToServer(((GuiWorkspace)workspace).host, "", project, false);
}
}
break;
}
}
}
}