Skip to content

Commit

Permalink
This should fix the issue with baubble's inventory button not showing…
Browse files Browse the repository at this point in the history
… with tcon enabled.
  • Loading branch information
Alexander Behrhof committed Aug 7, 2014
1 parent 4a85cd6 commit e379d8f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
1 change: 0 additions & 1 deletion src/main/java/tconstruct/armor/ArmorProxyClient.java
Expand Up @@ -126,7 +126,6 @@ public Object getClientGuiElement (int ID, EntityPlayer player, World world, int
if (ID == ArmorProxyCommon.inventoryGui)
{
GuiInventory inventory = new GuiInventory(player);
TabRegistry.addTabsToInventory(inventory);
return inventory;
}
if (ID == ArmorProxyCommon.armorGuiID)
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/tconstruct/client/TControls.java
Expand Up @@ -8,6 +8,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraftforge.common.MinecraftForge;
import tconstruct.TConstruct;
import tconstruct.armor.ArmorProxyClient;
import tconstruct.armor.ArmorProxyCommon;
Expand Down Expand Up @@ -69,10 +70,9 @@ public void keyDown (Type types, KeyBinding kb, boolean tickEnd, boolean isRepea
{
openArmorGui();// mc.thePlayer.username);
}
if (kb == invKey && mc.currentScreen != null && mc.currentScreen.getClass() == GuiInventory.class)// &&
// !mc.playerController.isInCreativeMode())
if (kb == invKey && mc.currentScreen != null && mc.currentScreen.getClass() == GuiInventory.class)// &&// !mc.playerController.isInCreativeMode())
{
TabRegistry.addTabsToInventory((GuiContainer) mc.currentScreen);
MinecraftForge.EVENT_BUS.register(new TabRegistry());
}
if (kb == jumpKey) // Double jump
{
Expand Down Expand Up @@ -173,14 +173,14 @@ public static void openKnapsackGui ()
AbstractPacket packet = new AccessoryInventoryPacket(ArmorProxyCommon.knapsackGuiID);
updateServer(packet);
}
private void toggleGoggles()

private void toggleGoggles ()
{
AbstractPacket packet = new GogglePacket(activeGoggles);
updateServer(packet);
}
private void toggleBelt()

private void toggleBelt ()
{
AbstractPacket packet = new BeltPacket();
updateServer(packet);
Expand Down
27 changes: 16 additions & 11 deletions src/main/java/tconstruct/client/tabs/TabRegistry.java
Expand Up @@ -6,7 +6,11 @@
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraftforge.client.event.GuiScreenEvent;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class TabRegistry
{
Expand All @@ -21,18 +25,20 @@ public static ArrayList<AbstractTab> getTabList ()
{
return tabList;
}

public static void addTabsToInventory (GuiContainer gui)

@SideOnly(Side.CLIENT)
@SubscribeEvent
public void guiPostInit (GuiScreenEvent.InitGuiEvent.Post event)
{
if (gui.getClass() == GuiInventory.class)
if ((event.gui instanceof GuiInventory))
{
// Values are public at runtime.
int cornerX = gui.guiLeft;
int cornerY = gui.guiTop;
gui.buttonList.clear();

updateTabValues(cornerX, cornerY, InventoryTabVanilla.class);
addTabsToList(gui.buttonList);
int xSize = 176;
int ySize = 166;
int guiLeft = (event.gui.width - xSize) / 2;
int guiTop = (event.gui.height - ySize) / 2;
updateTabValues(guiLeft, guiTop, InventoryTabVanilla.class);
addTabsToList(event.gui.buttonList);
}
}

Expand All @@ -43,7 +49,6 @@ public static void openInventoryGui ()
mc.thePlayer.closeScreen();
GuiInventory inventory = new GuiInventory(mc.thePlayer);
mc.displayGuiScreen(inventory);
TabRegistry.addTabsToInventory(inventory);
}

public static void updateTabValues (int cornerX, int cornerY, Class<?> selectedButton)
Expand Down

1 comment on commit e379d8f

@radfast
Copy link
Contributor

@radfast radfast commented on e379d8f Sep 8, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See discussion of this on this issue: #935

Please sign in to comment.