Rework stencil table GUI

This commit is contained in:
Bernhard Bonigl committed 2014-08-20 22:23:12 +02:00
1 parent 5dd0e0c8fa
commit bd997ab05e
9 files changed
+252 -39

No files matched your search

@@ -0,0 +1,15 @@
package tconstruct.library.client;
public class GuiElement {
public final int buttonIconX;
public final int buttonIconY;
public final String domain;
public final String texture;
public GuiElement(int buttonIconX, int buttonIconY, String domain, String texture) {
this.buttonIconX = buttonIconX;
this.buttonIconY = buttonIconY;
this.domain = domain;
this.texture = texture;
}
}
@@ -0,0 +1,11 @@
package tconstruct.library.client;
public class StencilGuiElement extends GuiElement {
public final int stencilIndex;
public StencilGuiElement(int buttonIconX, int buttonIconY, int stencilIndex, String domain, String texture) {
super(buttonIconX, buttonIconY, domain, texture);
this.stencilIndex = stencilIndex;
}
}
@@ -13,6 +13,8 @@ import tconstruct.library.tools.ToolCore;
public class TConstructClientRegistry
{
public static ArrayList<StencilGuiElement> stencilButtons = new ArrayList<StencilGuiElement>();
public static ArrayList<StencilGuiElement> stencilButtons2 = new ArrayList<StencilGuiElement>();
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>();
@@ -103,6 +105,27 @@ public class TConstructClientRegistry
}
//Gui
public static void addStencilButton (StencilGuiElement element)
{
stencilButtons.add(element);
}
public static void addStencilButton (int xButton, int yButton, int index, String domain, String texture)
{
stencilButtons.add(new StencilGuiElement(xButton, yButton, index, domain, texture));
}
public static void addStencilButton2 (StencilGuiElement element)
{
stencilButtons.add(element);
}
// adds a button to the right side of the stencil table
public static void addStencilButton2 (int xButton, int yButton, int index, String domain, String texture)
{
stencilButtons2.add(new StencilGuiElement(xButton, yButton, index, domain, texture));
}
public static void addToolButton (ToolGuiElement element)
{
toolButtons.add(element);
@@ -46,7 +46,7 @@ public class StencilBuilder {
*/
public static int getIndex(ItemStack stencil) {
for(int i = 0; i < instance.stencils.size(); i++)
if(ItemStack.areItemStackTagsEqual(stencil, getStencil(i)))
if(OreDictionary.itemMatches(stencil, getStencil(i), false))
return i;
return -1;