diff --git a/build.gradle b/build.gradle index c13a3e25d..478bd6638 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ plugins { id 'idea' } -version = "1.9.4-beta2.9" +version = "1.9.4-beta3.1" group= "kamkeel.customnpc-plus" archivesBaseName = "CustomNPC-Plus" diff --git a/src/main/java/kamkeel/npcs/addon/client/DBCClient.java b/src/main/java/kamkeel/npcs/addon/client/DBCClient.java index 5fdc75d7e..7dd94ef6a 100644 --- a/src/main/java/kamkeel/npcs/addon/client/DBCClient.java +++ b/src/main/java/kamkeel/npcs/addon/client/DBCClient.java @@ -34,7 +34,4 @@ public class DBCClient { public GuiNPCInterface2 manageCustomForms(EntityNPCInterface npcInterface){ return null; } // Manage Custom Forms public GuiNPCInterface2 manageCustomAuras(EntityNPCInterface npcInterface){ return null; } - - // Inventory GUI - public GuiCNPCInventory inventoryGUI(){ return null; } } diff --git a/src/main/java/kamkeel/npcs/network/packets/data/ChatAlertPacket.java b/src/main/java/kamkeel/npcs/network/packets/data/ChatAlertPacket.java index 67574442a..fd47a6287 100644 --- a/src/main/java/kamkeel/npcs/network/packets/data/ChatAlertPacket.java +++ b/src/main/java/kamkeel/npcs/network/packets/data/ChatAlertPacket.java @@ -64,7 +64,7 @@ public final class ChatAlertPacket extends AbstractPacket { while ((part = ByteBufUtils.readString(in)) != null && !part.isEmpty()) { parts.add(part); } - + StringBuilder finalMessage = new StringBuilder(); for (String s : parts) { finalMessage.append(StatCollector.translateToLocal(s)); diff --git a/src/main/java/noppes/npcs/client/ClientTickHandler.java b/src/main/java/noppes/npcs/client/ClientTickHandler.java index 038ea5177..7c9e627e6 100644 --- a/src/main/java/noppes/npcs/client/ClientTickHandler.java +++ b/src/main/java/noppes/npcs/client/ClientTickHandler.java @@ -23,6 +23,7 @@ import noppes.npcs.client.renderer.RenderNPCInterface; import noppes.npcs.constants.EnumPlayerPacket; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; +import tconstruct.client.tabs.InventoryTabCustomNpc; import static noppes.npcs.client.ClientEventHandler.renderCNPCPlayer; @@ -94,23 +95,7 @@ public class ClientTickHandler{ if(ClientProxy.NPCButton.isPressed()){ Minecraft mc = Minecraft.getMinecraft(); if(mc.currentScreen == null){ - switch (GuiCNPCInventory.activeTab){ - case 0: - NoppesUtil.openGUI(mc.thePlayer, new GuiQuestLog()); - break; - case 1: - NoppesUtil.openGUI(mc.thePlayer, new GuiParty()); - break; - case 2: - NoppesUtil.openGUI(mc.thePlayer, new GuiFaction()); - break; - case 3: - NoppesUtil.openGUI(mc.thePlayer, new GuiSettings()); - break; - case 4: - NoppesUtil.openGUI(mc.thePlayer, DBCClient.Instance.inventoryGUI()); - break; - } + InventoryTabCustomNpc.tabHelper(); } else if(mc.currentScreen instanceof GuiCNPCInventory) mc.setIngameFocus(); diff --git a/src/main/java/noppes/npcs/client/gui/player/inventory/GuiCNPCInventory.java b/src/main/java/noppes/npcs/client/gui/player/inventory/GuiCNPCInventory.java index 3ab43c14e..2509837a8 100644 --- a/src/main/java/noppes/npcs/client/gui/player/inventory/GuiCNPCInventory.java +++ b/src/main/java/noppes/npcs/client/gui/player/inventory/GuiCNPCInventory.java @@ -15,7 +15,7 @@ import tconstruct.client.tabs.TabRegistry; public class GuiCNPCInventory extends GuiNPCInterface { public static final ResourceLocation specialIcons = new ResourceLocation("customnpcs","textures/gui/icons.png"); - public static int activeTab = 0; + public static int activeTab = -100; protected Minecraft mc = Minecraft.getMinecraft(); public GuiCNPCInventory() { @@ -34,54 +34,43 @@ public class GuiCNPCInventory extends GuiNPCInterface { int y = 3; - GuiMenuSideButton questsButton = new GuiMenuSideButton(100, guiLeft + xSize + 37, this.guiTop + y, 22, 22, ""); + GuiMenuSideButton questsButton = new GuiMenuSideButton(-100, guiLeft + xSize + 37, this.guiTop + y, 22, 22, ""); questsButton.rightSided = true; - questsButton.active = activeTab == 0; + questsButton.active = activeTab == -100; questsButton.renderIconPosX = 32; questsButton.renderResource = specialIcons; addButton(questsButton); y += 21; - GuiMenuSideButton partyButton = new GuiMenuSideButton(101, guiLeft + xSize + 37, this.guiTop + y, 22, 22, ""); + GuiMenuSideButton partyButton = new GuiMenuSideButton(-101, guiLeft + xSize + 37, this.guiTop + y, 22, 22, ""); partyButton.rightSided = true; - partyButton.active = activeTab == 1; + partyButton.active = activeTab == -101; partyButton.renderResource = specialIcons; addButton(partyButton); if(ConfigClient.enableFactionTab){ y += 21; - GuiMenuSideButton factionButton = new GuiMenuSideButton(102, guiLeft + xSize + 37, this.guiTop + y, 22, 22, ""); + GuiMenuSideButton factionButton = new GuiMenuSideButton(-102, guiLeft + xSize + 37, this.guiTop + y, 22, 22, ""); factionButton.rightSided = true; - factionButton.active = activeTab == 2; + factionButton.active = activeTab == -102; factionButton.renderIconPosX = 48; factionButton.renderResource = specialIcons; addButton(factionButton); } - - if(Loader.isModLoaded("npcdbc")){ - y += 21; - GuiMenuSideButton dbcButton = new GuiMenuSideButton(104, guiLeft + xSize + 37, this.guiTop + y, 22, 22, ""); - dbcButton.rightSided = true; - dbcButton.active = activeTab == 4; - dbcButton.renderIconPosX = 64; - dbcButton.renderResource = specialIcons; - addButton(dbcButton); - } - if(ConfigMain.EnableProfiles){ y += 21; - GuiMenuSideButton profileButton = new GuiMenuSideButton(105, guiLeft + xSize + 37, this.guiTop + y, 22, 22, ""); + GuiMenuSideButton profileButton = new GuiMenuSideButton(-104, guiLeft + xSize + 37, this.guiTop + y, 22, 22, ""); profileButton.rightSided = true; - profileButton.active = activeTab == 5; + profileButton.active = activeTab == -104; profileButton.renderIconPosX = 80; profileButton.renderResource = specialIcons; addButton(profileButton); } y += 21; - GuiMenuSideButton clientButton = new GuiMenuSideButton(103, guiLeft + xSize + 37, this.guiTop + y, 22, 22, ""); + GuiMenuSideButton clientButton = new GuiMenuSideButton(-103, guiLeft + xSize + 37, this.guiTop + y, 22, 22, ""); clientButton.rightSided = true; - clientButton.active = activeTab == 3; + clientButton.active = activeTab == -103; clientButton.renderIconPosX = 16; clientButton.renderResource = specialIcons; addButton(clientButton); @@ -89,29 +78,25 @@ public class GuiCNPCInventory extends GuiNPCInterface { @Override protected void actionPerformed(GuiButton guibutton){ - if (guibutton.id >= 100) { - if (guibutton.id == 100 && activeTab != 0) { - activeTab = 0; + if (guibutton.id <= -100) { + if (guibutton.id == -100 && activeTab != 0) { + activeTab = -100; mc.displayGuiScreen(new GuiQuestLog()); } - if (guibutton.id == 101 && activeTab != 1) { - activeTab = 1; + if (guibutton.id == -101 && activeTab != 1) { + activeTab = -101; mc.displayGuiScreen(new GuiParty()); } - if (guibutton.id == 102 && activeTab != 2) { - activeTab = 2; + if (guibutton.id == -102 && activeTab != 2) { + activeTab = -102; mc.displayGuiScreen(new GuiFaction()); } - if (guibutton.id == 103 && activeTab != 3) { - activeTab = 3; + if (guibutton.id == -103 && activeTab != 3) { + activeTab = -103; mc.displayGuiScreen(new GuiSettings()); } - if (guibutton.id == 104 && activeTab != 4) { - activeTab = 4; - mc.displayGuiScreen(DBCClient.Instance.inventoryGUI()); - } - if (guibutton.id == 105 && activeTab != 5) { - activeTab = 5; + if (guibutton.id == -104 && activeTab != 4) { + activeTab = -104; mc.displayGuiScreen(new GuiProfiles()); } } diff --git a/src/main/java/noppes/npcs/client/gui/player/inventory/GuiFaction.java b/src/main/java/noppes/npcs/client/gui/player/inventory/GuiFaction.java index 9e7b39cf6..ff7dcbb7a 100644 --- a/src/main/java/noppes/npcs/client/gui/player/inventory/GuiFaction.java +++ b/src/main/java/noppes/npcs/client/gui/player/inventory/GuiFaction.java @@ -133,7 +133,7 @@ public class GuiFaction extends GuiCNPCInventory implements IGuiData { if(guibutton instanceof AbstractTab) return; - if (guibutton.id >= 100 && guibutton.id <= 105) { + if (guibutton.id <= -100) { super.actionPerformed(guibutton); return; } diff --git a/src/main/java/noppes/npcs/client/gui/player/inventory/GuiParty.java b/src/main/java/noppes/npcs/client/gui/player/inventory/GuiParty.java index 07af473b1..a6c1a4dc6 100644 --- a/src/main/java/noppes/npcs/client/gui/player/inventory/GuiParty.java +++ b/src/main/java/noppes/npcs/client/gui/player/inventory/GuiParty.java @@ -226,7 +226,7 @@ public class GuiParty extends GuiCNPCInventory implements ITextfieldListener,ICu return; Party party = ClientCacheHandler.party; - if (guibutton.id >= 100 && guibutton.id <= 105) { + if (guibutton.id <= -100) { super.actionPerformed(guibutton); return; } diff --git a/src/main/java/noppes/npcs/client/gui/player/inventory/GuiQuestLog.java b/src/main/java/noppes/npcs/client/gui/player/inventory/GuiQuestLog.java index 1ab495627..6091ce220 100644 --- a/src/main/java/noppes/npcs/client/gui/player/inventory/GuiQuestLog.java +++ b/src/main/java/noppes/npcs/client/gui/player/inventory/GuiQuestLog.java @@ -171,7 +171,7 @@ public class GuiQuestLog extends GuiCNPCInventory implements ICustomScrollListen if(guibutton instanceof AbstractTab) return; - if (guibutton.id >= 100 && guibutton.id <= 105) { + if (guibutton.id <= -100) { super.actionPerformed(guibutton); return; } diff --git a/src/main/java/noppes/npcs/client/gui/player/inventory/GuiSettings.java b/src/main/java/noppes/npcs/client/gui/player/inventory/GuiSettings.java index f85d95c00..e702e59cb 100644 --- a/src/main/java/noppes/npcs/client/gui/player/inventory/GuiSettings.java +++ b/src/main/java/noppes/npcs/client/gui/player/inventory/GuiSettings.java @@ -122,7 +122,7 @@ public class GuiSettings extends GuiCNPCInventory implements ITextfieldListener, if(btn instanceof AbstractTab) return; - if (btn.id >= 100 && btn.id <= 105) { + if (btn.id <= -100) { super.actionPerformed(btn); return; } diff --git a/src/main/java/tconstruct/client/tabs/InventoryTabCustomNpc.java b/src/main/java/tconstruct/client/tabs/InventoryTabCustomNpc.java index 888bc77f1..39f9f1761 100644 --- a/src/main/java/tconstruct/client/tabs/InventoryTabCustomNpc.java +++ b/src/main/java/tconstruct/client/tabs/InventoryTabCustomNpc.java @@ -17,8 +17,6 @@ public class InventoryTabCustomNpc extends AbstractTab { @Override public void onTabClicked() { - - Thread t = new Thread(){ @Override public void run(){ @@ -27,24 +25,7 @@ public class InventoryTabCustomNpc extends AbstractTab { } catch (InterruptedException e) { e.printStackTrace(); } - Minecraft mc = Minecraft.getMinecraft(); - switch (GuiCNPCInventory.activeTab){ - case 0: - mc.displayGuiScreen(new GuiQuestLog()); - break; - case 1: - mc.displayGuiScreen(new GuiParty()); - break; - case 2: - mc.displayGuiScreen(new GuiFaction()); - break; - case 3: - mc.displayGuiScreen(new GuiSettings()); - break; - case 4: - mc.displayGuiScreen(DBCClient.Instance.inventoryGUI()); - break; - } + tabHelper(); } }; t.start(); @@ -54,4 +35,24 @@ public class InventoryTabCustomNpc extends AbstractTab { public boolean shouldAddToList() { return true; } + + public static void tabHelper(){ + Minecraft mc = Minecraft.getMinecraft(); + int tab = GuiCNPCInventory.activeTab; + if(tab == -100){ + mc.displayGuiScreen(new GuiQuestLog()); + } + if(tab == -101){ + mc.displayGuiScreen(new GuiParty()); + } + if(tab == -102){ + mc.displayGuiScreen(new GuiFaction()); + } + if(tab == -103){ + mc.displayGuiScreen(new GuiSettings()); + } + if(tab == -104){ + // Profile Tab + } + } } diff --git a/src/main/resources/assets/customnpcs/textures/gui/icons.png b/src/main/resources/assets/customnpcs/textures/gui/icons.png index a0bd71c26..bcfb3ba65 100644 Binary files a/src/main/resources/assets/customnpcs/textures/gui/icons.png and b/src/main/resources/assets/customnpcs/textures/gui/icons.png differ