Change Inventory Tab Handling

This commit is contained in:
Kam committed 2025-02-18 18:48:56 -05:00
1 parent 753a2a1927
commit 64bb024e61
11 files changed
+51 -83

No files matched your search

+1 -1
View File
@@ -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"
@@ -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; }
}
@@ -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));
@@ -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();
@@ -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());
}
}
@@ -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;
}
@@ -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;
}
@@ -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;
}
@@ -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;
}
@@ -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
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB