diff --git a/tconstruct/TConstruct.java b/tconstruct/TConstruct.java index b204eeb3..fc48ff54 100644 --- a/tconstruct/TConstruct.java +++ b/tconstruct/TConstruct.java @@ -1,6 +1,10 @@ package tconstruct; import net.minecraftforge.common.MinecraftForge; +import tconstruct.client.tabs.InventoryTabArmorExtended; +import tconstruct.client.tabs.InventoryTabKnapsack; +import tconstruct.client.tabs.InventoryTabVanilla; +import tconstruct.client.tabs.TabRegistry; import tconstruct.common.TContent; import tconstruct.common.TProxyCommon; import tconstruct.landmine.logic.behavior.Behavior; @@ -118,6 +122,10 @@ public class TConstruct { content.intermodCommunication(); GameRegistry.registerWorldGenerator(new SlimeIslandGen(TContent.slimePool.blockID, 0)); + + TabRegistry.registerTab(new InventoryTabVanilla()); + TabRegistry.registerTab(new InventoryTabArmorExtended()); + TabRegistry.registerTab(new InventoryTabKnapsack()); } @EventHandler diff --git a/tconstruct/client/TControls.java b/tconstruct/client/TControls.java index fdd50648..a9e1bd66 100644 --- a/tconstruct/client/TControls.java +++ b/tconstruct/client/TControls.java @@ -3,16 +3,12 @@ package tconstruct.client; import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import java.util.EnumSet; - -import tconstruct.TConstruct; - import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.gui.inventory.GuiInventory; import net.minecraft.client.settings.KeyBinding; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.network.packet.Packet250CustomPayload; -import net.minecraft.server.MinecraftServer; +import tconstruct.client.tabs.TabRegistry; import cpw.mods.fml.common.TickType; import cpw.mods.fml.common.network.PacketDispatcher; @@ -67,7 +63,7 @@ public class TControls extends TKeyHandler } if (kb == invKey && mc.currentScreen != null && mc.currentScreen.getClass() == GuiInventory.class)// && !mc.playerController.isInCreativeMode()) { - TProxyClient.addTabsToInventory((GuiContainer) mc.currentScreen); + TabRegistry.addTabsToInventory((GuiContainer) mc.currentScreen); } /*if (kb == jumpKey) //Double jump { diff --git a/tconstruct/client/TProxyClient.java b/tconstruct/client/TProxyClient.java index 384f5cad..070e4e59 100644 --- a/tconstruct/client/TProxyClient.java +++ b/tconstruct/client/TProxyClient.java @@ -1,20 +1,14 @@ package tconstruct.client; import java.io.InputStream; -import java.lang.reflect.Field; import java.util.*; - import javax.xml.parsers.*; - import org.lwjgl.opengl.GL11; import org.w3c.dom.Document; - import com.google.common.collect.Lists; - import cpw.mods.fml.client.registry.*; import cpw.mods.fml.common.registry.*; import cpw.mods.fml.relauncher.Side; - import tconstruct.TConstruct; import tconstruct.blocks.logic.*; import tconstruct.client.block.*; @@ -22,6 +16,7 @@ import tconstruct.client.entity.*; import tconstruct.client.entity.projectile.*; import tconstruct.client.gui.*; import tconstruct.client.pages.*; +import tconstruct.client.tabs.*; import tconstruct.common.*; import tconstruct.entity.*; import tconstruct.entity.projectile.*; @@ -34,11 +29,9 @@ import tconstruct.library.client.*; import tconstruct.library.crafting.ToolBuilder; import tconstruct.library.tools.ToolCore; import tconstruct.util.player.*; - import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.inventory.*; import net.minecraft.client.model.ModelSlime; import net.minecraft.client.particle.*; @@ -93,7 +86,7 @@ public class TProxyClient extends TProxyCommon { } if (ID == inventoryGui) { GuiInventory inventory = new GuiInventory(player); - addTabsToInventory(inventory); + TabRegistry.addTabsToInventory(inventory); return inventory; } if (ID == armorGuiID) { @@ -179,74 +172,6 @@ public class TProxyClient extends TProxyCommon { GL11.glTranslatef(0.5F, 0.5F, 0.5F); } - public static void openInventoryGui() { - // controlInstance.openInventoryGui(); - if (mc == null) - mc = Minecraft.getMinecraft(); - GuiInventory inventory = new GuiInventory(mc.thePlayer); - mc.displayGuiScreen(inventory); - addTabsToInventory(inventory); - } - - public static void addTabsToInventory(GuiContainer gui) { - /* - * if (mc == null) mc = Minecraft.getMinecraft(); - */ - if (gui.getClass() == GuiInventory.class || classMatches(gui, "micdoodle8.mods.galacticraft.core.client.gui.GCCoreGuiInventory")) { - try { - Field guiLeft = GuiContainer.class.getDeclaredField("p"); - guiLeft.setAccessible(true); - int cornerX = (Integer) guiLeft.get(gui); - Field ySize = GuiContainer.class.getDeclaredField("d"); - ySize.setAccessible(true); - int cornerY = (gui.height - (Integer) ySize.get(gui)) / 2; - Field buttonList = GuiScreen.class.getDeclaredField("i"); - buttonList.setAccessible(true); - ArrayList listOfButtons = (ArrayList) buttonList.get(gui); - listOfButtons.clear(); - - InventoryTab tab = new InventoryTab(2, cornerX, cornerY - 28, new ItemStack(Block.workbench), 0); - tab.enabled = false; - listOfButtons.add(tab); - tab = new InventoryTab(3, cornerX + 28, cornerY - 28, new ItemStack(Item.plateDiamond), 1); - listOfButtons.add(tab); - if (armorExtended.inventory[2] != null && armorExtended.inventory[2].getItem() == TContent.knapsack) { - if (listOfButtons.size() < 3) { - tab = new InventoryTab(4, cornerX + 56, cornerY - 28, new ItemStack(TContent.knapsack), 1); - listOfButtons.add(tab); - } - } - } catch (Exception e) { - try { - Field guiLeft = GuiContainer.class.getDeclaredField("guiLeft"); - guiLeft.setAccessible(true); - int cornerX = (Integer) guiLeft.get(gui); - Field ySize = GuiContainer.class.getDeclaredField("ySize"); - ySize.setAccessible(true); - int cornerY = (gui.height - (Integer) ySize.get(gui)) / 2; - Field buttonList = GuiScreen.class.getDeclaredField("buttonList"); - buttonList.setAccessible(true); - ArrayList listOfButtons = (ArrayList) buttonList.get(gui); - listOfButtons.clear(); - - InventoryTab tab = new InventoryTab(2, cornerX, cornerY - 28, new ItemStack(Block.workbench), 0); - tab.enabled = false; - listOfButtons.add(tab); - tab = new InventoryTab(3, cornerX + 28, cornerY - 28, new ItemStack(Item.plateDiamond), 1); - listOfButtons.add(tab); - if (armorExtended.inventory[2] != null && armorExtended.inventory[2].getItem() == TContent.knapsack) { - if (listOfButtons.size() < 3) { - tab = new InventoryTab(4, cornerX + 56, cornerY - 28, new ItemStack(TContent.knapsack), 1); - listOfButtons.add(tab); - } - } - } catch (Exception ex) { - ex.printStackTrace(); - } - } - } - } - public static boolean classMatches(Object paramObject, String paramString) { try { return paramObject.getClass().getName().equals(paramString); diff --git a/tconstruct/client/gui/ArmorExtendedGui.java b/tconstruct/client/gui/ArmorExtendedGui.java index 234a9a0d..9a3d44ce 100644 --- a/tconstruct/client/gui/ArmorExtendedGui.java +++ b/tconstruct/client/gui/ArmorExtendedGui.java @@ -1,19 +1,17 @@ package tconstruct.client.gui; -import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.InventoryEffectRenderer; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; - import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; - +import tconstruct.client.tabs.InventoryTabArmorExtended; +import tconstruct.client.tabs.TabRegistry; import tconstruct.common.TContent; import tconstruct.inventory.ArmorExtendedContainer; import tconstruct.util.player.ArmorExtended; @@ -41,11 +39,14 @@ public class ArmorExtendedGui extends InventoryEffectRenderer int cornerY = (this.height - this.ySize) / 2; this.buttonList.clear(); - InventoryTab tab = new InventoryTab(2, cornerX, cornerY - 28, new ItemStack(Block.workbench), 0); - this.buttonList.add(tab); - tab = new InventoryTab(3, cornerX + 28, cornerY - 28, new ItemStack(Item.plateDiamond), 1); - tab.enabled = false; - this.buttonList.add(tab); +// InventoryTab tab = new InventoryTab(2, cornerX, cornerY - 28, new ItemStack(Block.workbench), 0); +// this.buttonList.add(tab); +// tab = new InventoryTab(3, cornerX + 28, cornerY - 28, new ItemStack(Item.plateDiamond), 1); +// tab.enabled = false; +// this.buttonList.add(tab); + + TabRegistry.updateTabValues(cornerX, cornerY, InventoryTabArmorExtended.class); + TabRegistry.addTabsToList(this.buttonList); } protected void drawGuiContainerForegroundLayer (int par1, int par2) @@ -59,23 +60,23 @@ public class ArmorExtendedGui extends InventoryEffectRenderer super.drawScreen(par1, par2, par3); this.xSize_lo = (float) par1; this.ySize_lo = (float) par2; - if (stats.inventory[2] != null && stats.inventory[2].getItem() == TContent.knapsack) - { - if (this.buttonList.size() < 3) - { - int cornerX = guiLeft; - int cornerY = (this.height - this.ySize) / 2; - InventoryTab tab = new InventoryTab(4, cornerX + 56, cornerY - 28, new ItemStack(TContent.knapsack), 1); - this.buttonList.add(tab); - } - } - else - { - if (this.buttonList.size() >= 3) - { - buttonList.remove(2); - } - } +// if (stats.inventory[2] != null && stats.inventory[2].getItem() == TContent.knapsack) +// { +// if (this.buttonList.size() < 3) +// { +// int cornerX = guiLeft; +// int cornerY = (this.height - this.ySize) / 2; +// InventoryTab tab = new InventoryTab(4, cornerX + 56, cornerY - 28, new ItemStack(TContent.knapsack), 1); +// this.buttonList.add(tab); +// } +// } +// else +// { +// if (this.buttonList.size() >= 3) +// { +// buttonList.remove(2); +// } +// } } private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/armorextended.png"); diff --git a/tconstruct/client/gui/InventoryTab.java b/tconstruct/client/gui/InventoryTab.java deleted file mode 100644 index b0a63756..00000000 --- a/tconstruct/client/gui/InventoryTab.java +++ /dev/null @@ -1,77 +0,0 @@ -package tconstruct.client.gui; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; - -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -import tconstruct.client.TControls; -import tconstruct.client.TProxyClient; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -@SideOnly(Side.CLIENT) -public class InventoryTab extends GuiButton -{ - int textureX; - //String texture = "/gui/allitems.png"; - ItemStack renderStack; - private static final ResourceLocation background = new ResourceLocation("textures/gui/container/creative_inventory/tabs.png"); - - public InventoryTab(int id, int posX, int posY, ItemStack stack, int texX) - { - super(id, posX, posY, 28, 32, ""); - textureX = texX; - renderStack = stack; - } - - /** - * Draws this button to the screen. - */ - public void drawButton (Minecraft mc, int mouseX, int mouseY) - { - if (this.drawButton) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - mc.func_110434_K().func_110577_a(background); - //mc.renderEngine.bindTexture(texture); - - int yTexPos = this.enabled ? 0 : 32; - int ySize = this.enabled ? 28 : 32; - - this.drawTexturedModalRect(this.xPosition, this.yPosition, textureX * 28, yTexPos, 28, ySize); - - RenderHelper.enableGUIStandardItemLighting(); - this.zLevel = 100.0F; - TProxyClient.itemRenderer.zLevel = 100.0F; - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - TProxyClient.itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, renderStack, xPosition + 6, yPosition + 8); - TProxyClient.itemRenderer.renderItemOverlayIntoGUI(mc.fontRenderer, mc.renderEngine, renderStack, xPosition + 6, yPosition + 8); - GL11.glDisable(GL11.GL_LIGHTING); - TProxyClient.itemRenderer.zLevel = 0.0F; - this.zLevel = 0.0F; - RenderHelper.disableStandardItemLighting(); - } - } - - public boolean mousePressed (Minecraft mc, int mouseX, int mouseY) - { - boolean inWindow = this.enabled && this.drawButton && mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; - if (inWindow) - { - if (this.id == 2) - TProxyClient.openInventoryGui(); - if (this.id == 3) - TControls.openArmorGui(); - if (this.id == 4) - TControls.openKnapsackGui(); - } - return inWindow; - } -} diff --git a/tconstruct/client/gui/KnapsackGui.java b/tconstruct/client/gui/KnapsackGui.java index 0ba14a53..203ba310 100644 --- a/tconstruct/client/gui/KnapsackGui.java +++ b/tconstruct/client/gui/KnapsackGui.java @@ -1,16 +1,12 @@ package tconstruct.client.gui; -import net.minecraft.block.Block; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; - import org.lwjgl.opengl.GL11; - -import tconstruct.common.TContent; +import tconstruct.client.tabs.InventoryTabKnapsack; +import tconstruct.client.tabs.TabRegistry; import tconstruct.inventory.KnapsackContainer; import tconstruct.util.player.KnapsackInventory; @@ -34,13 +30,16 @@ public class KnapsackGui extends GuiContainer int cornerY = (this.height - this.ySize) / 2; this.buttonList.clear(); - InventoryTab tab = new InventoryTab(2, cornerX, cornerY - 28, new ItemStack(Block.workbench), 0); - this.buttonList.add(tab); - tab = new InventoryTab(3, cornerX + 28, cornerY - 28, new ItemStack(Item.plateDiamond), 1); - this.buttonList.add(tab); - tab = new InventoryTab(4, cornerX + 56, cornerY - 28, new ItemStack(TContent.knapsack), 1); - tab.enabled = false; - this.buttonList.add(tab); + TabRegistry.updateTabValues(cornerX, cornerY, InventoryTabKnapsack.class); + TabRegistry.addTabsToList(this.buttonList); + +// InventoryTab tab = new InventoryTab(2, cornerX, cornerY - 28, new ItemStack(Block.workbench), 0); +// this.buttonList.add(tab); +// tab = new InventoryTab(3, cornerX + 28, cornerY - 28, new ItemStack(Item.plateDiamond), 1); +// this.buttonList.add(tab); +// tab = new InventoryTab(4, cornerX + 56, cornerY - 28, new ItemStack(TContent.knapsack), 1); +// tab.enabled = false; +// this.buttonList.add(tab); } protected void drawGuiContainerForegroundLayer (int par1, int par2) diff --git a/tconstruct/client/tabs/AbstractTab.java b/tconstruct/client/tabs/AbstractTab.java new file mode 100644 index 00000000..2ef21b60 --- /dev/null +++ b/tconstruct/client/tabs/AbstractTab.java @@ -0,0 +1,68 @@ +package tconstruct.client.tabs; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public abstract class AbstractTab extends GuiButton +{ + ResourceLocation texture = new ResourceLocation("textures/gui/container/creative_inventory/tabs.png"); + ItemStack renderStack; + RenderItem itemRenderer = new RenderItem(); + + public AbstractTab(int id, int posX, int posY, ItemStack renderStack) + { + super(id, posX, posY, 28, 32, ""); + this.renderStack = renderStack; + } + + @Override + public void drawButton(Minecraft mc, int mouseX, int mouseY) + { + if (this.drawButton) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + + int yTexPos = this.enabled ? 0 : 32; + int ySize = this.enabled ? 28 : 32; + int xOffset = this.id == 2 ? 0 : 1; + + mc.renderEngine.func_110577_a(this.texture); + this.drawTexturedModalRect(this.xPosition, this.yPosition, xOffset * 28, yTexPos, 28, ySize); + + RenderHelper.enableGUIStandardItemLighting(); + this.zLevel = 100.0F; + this.itemRenderer.zLevel = 100.0F; + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + this.itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, renderStack, xPosition + 6, yPosition + 8); + this.itemRenderer.renderItemOverlayIntoGUI(mc.fontRenderer, mc.renderEngine, renderStack, xPosition + 6, yPosition + 8); + GL11.glDisable(GL11.GL_LIGHTING); + this.itemRenderer.zLevel = 0.0F; + this.zLevel = 0.0F; + RenderHelper.disableStandardItemLighting(); + } + } + + @Override + public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) + { + boolean inWindow = this.enabled && this.drawButton && mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; + + if (inWindow) + { + this.onTabClicked(); + } + + return inWindow; + } + + public abstract void onTabClicked(); + + public abstract boolean shouldAddToList(); +} diff --git a/tconstruct/client/tabs/InventoryTabArmorExtended.java b/tconstruct/client/tabs/InventoryTabArmorExtended.java new file mode 100644 index 00000000..f13ca824 --- /dev/null +++ b/tconstruct/client/tabs/InventoryTabArmorExtended.java @@ -0,0 +1,25 @@ +package tconstruct.client.tabs; + +import tconstruct.client.TControls; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +public class InventoryTabArmorExtended extends AbstractTab +{ + public InventoryTabArmorExtended() + { + super(0, 0, 0, new ItemStack(Item.plateDiamond)); + } + + @Override + public void onTabClicked() + { + TControls.openArmorGui(); + } + + @Override + public boolean shouldAddToList() + { + return true; + } +} diff --git a/tconstruct/client/tabs/InventoryTabKnapsack.java b/tconstruct/client/tabs/InventoryTabKnapsack.java new file mode 100644 index 00000000..0c2311e1 --- /dev/null +++ b/tconstruct/client/tabs/InventoryTabKnapsack.java @@ -0,0 +1,26 @@ +package tconstruct.client.tabs; + +import net.minecraft.item.ItemStack; +import tconstruct.client.TControls; +import tconstruct.client.TProxyClient; +import tconstruct.common.TContent; + +public class InventoryTabKnapsack extends AbstractTab +{ + public InventoryTabKnapsack() + { + super(0, 0, 0, new ItemStack(TContent.knapsack)); + } + + @Override + public void onTabClicked() + { + TControls.openKnapsackGui(); + } + + @Override + public boolean shouldAddToList() + { + return TProxyClient.armorExtended.inventory[2] != null && TProxyClient.armorExtended.inventory[2].getItem() == TContent.knapsack; + } +} diff --git a/tconstruct/client/tabs/InventoryTabVanilla.java b/tconstruct/client/tabs/InventoryTabVanilla.java new file mode 100644 index 00000000..ace59dcc --- /dev/null +++ b/tconstruct/client/tabs/InventoryTabVanilla.java @@ -0,0 +1,24 @@ +package tconstruct.client.tabs; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; + +public class InventoryTabVanilla extends AbstractTab +{ + public InventoryTabVanilla() + { + super(0, 0, 0, new ItemStack(Block.workbench)); + } + + @Override + public void onTabClicked() + { + TabRegistry.openInventoryGui(); + } + + @Override + public boolean shouldAddToList() + { + return true; + } +} diff --git a/tconstruct/client/tabs/TabRegistry.java b/tconstruct/client/tabs/TabRegistry.java new file mode 100644 index 00000000..7119295c --- /dev/null +++ b/tconstruct/client/tabs/TabRegistry.java @@ -0,0 +1,110 @@ +package tconstruct.client.tabs; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.gui.inventory.GuiInventory; +import cpw.mods.fml.client.FMLClientHandler; + +public class TabRegistry +{ + private static ArrayList tabList = new ArrayList(); + + public static void registerTab(AbstractTab tab) + { + tabList.add(tab); + } + + public static ArrayList getTabList() + { + return tabList; + } + + public static void addTabsToInventory(GuiContainer gui) + { + if (gui.getClass() == GuiInventory.class) + { + try + { + Field guiLeft = GuiContainer.class.getDeclaredField("p"); + guiLeft.setAccessible(true); + int cornerX = (Integer) guiLeft.get(gui); + Field ySize = GuiContainer.class.getDeclaredField("d"); + ySize.setAccessible(true); + int cornerY = (gui.height - (Integer) ySize.get(gui)) / 2; + Field buttonList = GuiScreen.class.getDeclaredField("i"); + buttonList.setAccessible(true); + ArrayList listOfButtons = (ArrayList) buttonList.get(gui); + listOfButtons.clear(); + + updateTabValues(cornerX, cornerY, InventoryTabVanilla.class); + addTabsToList(listOfButtons); + } + catch (Exception e) + { + try + { + Field guiLeft = GuiContainer.class.getDeclaredField("guiLeft"); + guiLeft.setAccessible(true); + int cornerX = (Integer) guiLeft.get(gui); + Field ySize = GuiContainer.class.getDeclaredField("ySize"); + ySize.setAccessible(true); + int cornerY = (gui.height - (Integer) ySize.get(gui)) / 2; + Field buttonList = GuiScreen.class.getDeclaredField("buttonList"); + buttonList.setAccessible(true); + ArrayList listOfButtons = (ArrayList) buttonList.get(gui); + listOfButtons.clear(); + + + updateTabValues(cornerX, cornerY, InventoryTabVanilla.class); + addTabsToList(listOfButtons); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + } + } + } + + private static Minecraft mc = FMLClientHandler.instance().getClient(); + + public static void openInventoryGui() + { + GuiInventory inventory = new GuiInventory(mc.thePlayer); + mc.displayGuiScreen(inventory); + TabRegistry.addTabsToInventory(inventory); + } + + public static void updateTabValues(int cornerX, int cornerY, Class selectedButton) + { + int count = 2; + for (int i = 0; i < tabList.size(); i++) + { + AbstractTab t = tabList.get(i); + + if (t.shouldAddToList()) + { + t.id = count; + t.xPosition = cornerX + (count - 2) * 28; + t.yPosition = cornerY - 28; + t.enabled = !t.getClass().equals(selectedButton); + count++; + } + } + } + + public static void addTabsToList(List buttonList) + { + for (AbstractTab tab : tabList) + { + if (tab.shouldAddToList()) + { + buttonList.add(tab); + } + } + } +}