Skip to content

Commit

Permalink
Bump version to 1.5.0.
Browse files Browse the repository at this point in the history
Add HandInfo exporter.
  • Loading branch information
iChun committed Nov 28, 2021
1 parent 023e295 commit cbad4bc
Show file tree
Hide file tree
Showing 8 changed files with 680 additions and 3 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'

version = '10.4.0'
version = '10.5.0'
group = 'tabula'
archivesBaseName = 'Tabula-1.16.5'

Expand Down Expand Up @@ -69,7 +69,7 @@ dependencies {
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
minecraft 'net.minecraftforge:forge:1.16.5-36.0.55'
implementation fg.deobf("ichunutil:iChunUtil:10.4.0")
implementation fg.deobf("ichunutil:iChunUtil:10.5.0")

// You may put jars on which you depend on in ./libs or you may define them like so..
// compile "some.group:artifact:version:classifier"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public final class ExportList
{
public static final TreeMap<String, Exporter> EXPORTERS = new TreeMap<String, Exporter>(Comparator.naturalOrder()) {{
put("blockJson", new ExportBlockJson());
put("handInfo", new ExportHandInfo());
put("headInfo", new ExportHeadInfo());
put("javaClass", new ExportJava());
put("projectTexture", new ExportProjectTexture());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package me.ichun.mods.tabula.client.export.types;

import com.google.common.base.Splitter;
import me.ichun.mods.ichunutil.api.client.hand.HandInfo;
import me.ichun.mods.ichunutil.client.gui.bns.Workspace;
import me.ichun.mods.ichunutil.common.head.HeadHandler;
import me.ichun.mods.ichunutil.common.module.tabula.formats.types.Exporter;
import me.ichun.mods.ichunutil.common.module.tabula.project.Project;
import me.ichun.mods.tabula.client.core.ResourceHelper;
import me.ichun.mods.tabula.client.export.types.handInfo.WindowExportHandInfo;
import me.ichun.mods.tabula.client.gui.WorkspaceTabula;
import me.ichun.mods.tabula.client.tabula.Mainframe;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import org.apache.commons.io.FileUtils;

import java.io.File;
import java.util.List;

public class ExportHandInfo extends Exporter
{
public ExportHandInfo()
{
super(I18n.format("tabula.export.handInfo.name"));
}

@Override
public String getId()
{
return "handInfo";
}

@Override
public boolean override(Workspace workspace, Project project)
{
Mainframe.ProjectInfo activeProject = ((WorkspaceTabula)workspace).mainframe.getActiveProject();
if(activeProject != null)
{
WindowExportHandInfo.open((WorkspaceTabula)workspace, activeProject);
}

return true;
}

@Override
public boolean export(Project project, Object... params)
{
HandInfo info = (HandInfo)params[0];

if(!Minecraft.getInstance().getSession().getUsername().equals("Dev"))
{
info.author = Minecraft.getInstance().getSession().getUsername();
}

List<String> strings = Splitter.on(".").trimResults().omitEmptyStrings().splitToList(info.forClass);

if(strings.isEmpty())
{
strings.add("NO_CLASS_DEFINED");
}

File file = new File(ResourceHelper.getExportsDir().toFile(), strings.get(strings.size() - 1) + ".json");
try
{
String json = HeadHandler.GSON.toJson(info, HandInfo.class);
FileUtils.writeStringToFile(file, json, "UTF-8");
return true;
}
catch(Throwable e1)
{
e1.printStackTrace();
}

return false; //Export is done by the window. We forget about it here.
}
}
Loading

0 comments on commit cbad4bc

Please sign in to comment.