-
Notifications
You must be signed in to change notification settings - Fork 755
/
TConstructClientRegistry.java
131 lines (115 loc) · 5.07 KB
/
TConstructClientRegistry.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
package tconstruct.library.client;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import mantle.lib.client.MantleClientRegistry;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.crafting.ModifyBuilder;
import tconstruct.library.crafting.ToolBuilder;
import tconstruct.library.tools.ToolCore;
public class TConstructClientRegistry
{
public static ArrayList<ToolGuiElement> toolButtons = new ArrayList<ToolGuiElement>(20);
public static ArrayList<ToolGuiElement> tierTwoButtons = new ArrayList<ToolGuiElement>();
public static Map<String, ItemStack> manualIcons = new HashMap<String, ItemStack>();
public static ItemStack defaultStack = new ItemStack(Items.iron_ingot);
public static void addMaterialRenderMapping (int materialID, String domain, String renderName, boolean useDefaultFolder)
{
for (ToolCore tool : TConstructRegistry.getToolMapping())
{
String[] toolIcons = new String[tool.getPartAmount() + 1];
for (int i = 0; i < tool.getPartAmount() + 1; i++)
{
String icon = domain + ":";
if (useDefaultFolder)
icon += tool.getDefaultFolder() + "/";
icon += renderName + tool.getIconSuffix(i);
toolIcons[i] = icon;
}
tool.registerPartPaths(materialID, toolIcons);
}
}
public static void addAlternateMaterialRenderMapping (ToolCore tool, int materialID, String domain, String renderName, boolean useDefaultFolder)
{
String[] toolIcons = new String[tool.getPartAmount() + 1];
for (int i = 0; i < tool.getPartAmount() + 1; i++)
{
String icon = domain + ":";
if (useDefaultFolder)
icon += tool.getDefaultFolder() + "/";
icon += renderName + tool.getIconSuffix(i);
toolIcons[i] = icon;
}
tool.registerAlternatePartPaths(materialID, toolIcons);
}
public static void addEffectRenderMapping (ToolCore tool, int materialID, String domain, String renderName, boolean useDefaultFolder)
{
String icon = domain + ":";
if (useDefaultFolder)
icon += tool.getDefaultFolder() + "/";
icon += renderName + tool.getEffectSuffix();
tool.registerEffectPath(materialID, icon);
}
public static void addEffectRenderMapping (int materialID, String domain, String renderName, boolean useDefaultFolder)
{
for (ToolCore tool : TConstructRegistry.getToolMapping())
{
String icon = domain + ":";
if (useDefaultFolder)
icon += tool.getDefaultFolder() + "/";
icon += renderName + tool.getEffectSuffix();
tool.registerEffectPath(materialID, icon);
}
}
public static void addSingleEffectRenderMapping (ToolCore tool, int materialID, String domain, String renderName, boolean useDefaultFolder)
{
String icon = domain + ":";
if (useDefaultFolder)
icon += tool.getDefaultFolder() + "/";
icon += renderName + tool.getEffectSuffix();
tool.registerEffectPath(materialID, icon);
}
public static void registerManualModifier (String name, ItemStack output, ItemStack topinput)
{
registerManualModifier(name, output, topinput, null);
}
public static void registerManualModifier (String name, ItemStack output, ItemStack topinput, ItemStack bottominput)
{
ItemStack[] recipe = new ItemStack[3];
recipe[0] = ModifyBuilder.instance.modifyItem(output, new ItemStack[] {topinput, bottominput});//ToolBuilder.instance.buildTool(output, topinput, bottominput, "");
recipe[1] = topinput;
recipe[2] = bottominput;
MantleClientRegistry.recipeIcons.put(name, recipe);
}
public static void registerManualSmeltery (String name, ItemStack output, ItemStack liquid, ItemStack cast)
{
ItemStack[] recipe = new ItemStack[3];
recipe[0] = output;
recipe[1] = liquid;
recipe[2] = cast;
MantleClientRegistry.recipeIcons.put(name, recipe);
}
//Gui
public static void addToolButton (ToolGuiElement element)
{
toolButtons.add(element);
}
public static void addToolButton (int slotType, int xButton, int yButton, int[] xIcons, int[] yIcons, String title, String body, String domain, String texture)
{
toolButtons.add(new ToolGuiElement(slotType, xButton, yButton, xIcons, yIcons, title, body, domain, texture));
}
public static void addTierTwoButton (ToolGuiElement element)
{
tierTwoButtons.add(element);
}
public static void addTierTwoButton (int slotType, int xButton, int yButton, int[] xIcons, int[] yIcons, String title, String body, String domain, String texture)
{
tierTwoButtons.add(new ToolGuiElement(slotType, xButton, yButton, xIcons, yIcons, title, body, domain, texture));
}
public static ArrayList<ToolGuiElement> getToolButtons ()
{
return toolButtons;
}
}