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 9777cd999..b8870861a 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 @@ -1,6 +1,7 @@ package noppes.npcs.client.gui.player.inventory; import net.minecraft.client.Minecraft; +import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import noppes.npcs.CustomItems; @@ -12,6 +13,8 @@ import tconstruct.client.tabs.TabRegistry; public class GuiCNPCInventory extends GuiNPCInterface { private final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/standardbg.png"); + public static final ResourceLocation specialIcons = new ResourceLocation("customnpcs","textures/gui/icons.png"); + public static int activeTab = 0; private Minecraft mc = Minecraft.getMinecraft(); @@ -26,25 +29,38 @@ public class GuiCNPCInventory extends GuiNPCInterface { super.initGui(); guiTop +=10; - GuiMenuSideButton questsButton = new GuiMenuSideButton(100, guiLeft + xSize + 37, this.guiTop + 3, 22, 22, ""); + int y = 3; + GuiMenuSideButton questsButton = new GuiMenuSideButton(100, guiLeft + xSize + 37, this.guiTop + y, 22, 22, ""); questsButton.rightSided = true; questsButton.active = activeTab == 0; - questsButton.renderStack = new ItemStack(CustomItems.letter); + questsButton.renderIconPosX = 32; + questsButton.renderResource = specialIcons; addButton(questsButton); - GuiMenuSideButton partyButton = new GuiMenuSideButton(101, guiLeft + xSize + 37, this.guiTop + 3 + 21, 22, 22, ""); + y += 21; + GuiMenuSideButton partyButton = new GuiMenuSideButton(101, guiLeft + xSize + 37, this.guiTop + y, 22, 22, ""); partyButton.rightSided = true; partyButton.active = activeTab == 1; - partyButton.renderStack = new ItemStack(CustomItems.bag); + partyButton.renderResource = specialIcons; addButton(partyButton); if(ConfigClient.enableFactionTab){ - GuiMenuSideButton factionButton = new GuiMenuSideButton(102, guiLeft + xSize + 37, this.guiTop + 3 + 21*2, 22, 22, ""); + y += 21; + GuiMenuSideButton factionButton = new GuiMenuSideButton(102, guiLeft + xSize + 37, this.guiTop + y, 22, 22, ""); factionButton.rightSided = true; factionButton.active = activeTab == 2; - factionButton.renderStack = new ItemStack(CustomItems.wallBanner); + factionButton.renderIconPosX = 48; + factionButton.renderResource = specialIcons; addButton(factionButton); } + + y += 21; + GuiMenuSideButton clientButton = new GuiMenuSideButton(101, guiLeft + xSize + 37, this.guiTop + y, 22, 22, ""); + clientButton.rightSided = true; + clientButton.active = activeTab == 3; + clientButton.renderIconPosX = 16; + clientButton.renderResource = specialIcons; + addButton(clientButton); } @Override diff --git a/src/main/java/noppes/npcs/client/gui/util/GuiMenuSideButton.java b/src/main/java/noppes/npcs/client/gui/util/GuiMenuSideButton.java index 99fdb45c8..866d763d7 100644 --- a/src/main/java/noppes/npcs/client/gui/util/GuiMenuSideButton.java +++ b/src/main/java/noppes/npcs/client/gui/util/GuiMenuSideButton.java @@ -6,6 +6,7 @@ import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; +import noppes.npcs.client.gui.player.inventory.GuiCNPCInventory; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; @@ -16,6 +17,9 @@ public class GuiMenuSideButton extends GuiNpcButton{ public boolean active; public boolean rightSided; public ItemStack renderStack; + public ResourceLocation renderResource; + public int renderIconPosX = 0; + public int renderIconPosY = 0; public GuiMenuSideButton(int id, int x, int y, String s){ this(id, x, y, 200, 20, s); @@ -54,6 +58,15 @@ public class GuiMenuSideButton extends GuiNpcButton{ } mouseDragged(minecraft, i, j); + // Render Custom Icon + if (this.renderResource != null) { + this.zLevel = 100.0F; + minecraft.renderEngine.bindTexture(renderResource); + drawTexturedModalRect(xPosition + 2, yPosition + height/2 - 8, renderIconPosX, renderIconPosY, 16, 16); + this.zLevel = 0.0F; + } + + if (this.renderStack != null) { RenderHelper.enableGUIStandardItemLighting(); this.zLevel = 100.0F; @@ -71,7 +84,7 @@ public class GuiMenuSideButton extends GuiNpcButton{ this.zLevel = 0.0F; RenderHelper.disableStandardItemLighting(); } - + String text = ""; float maxWidth = width * 0.75f; if(fontrenderer.getStringWidth(displayString) > maxWidth){ @@ -102,7 +115,7 @@ public class GuiMenuSideButton extends GuiNpcButton{ @Override public void mouseReleased(int i, int j){ - + } @Override diff --git a/src/main/resources/assets/customnpcs/textures/gui/icons.png b/src/main/resources/assets/customnpcs/textures/gui/icons.png new file mode 100644 index 000000000..80d28fa9b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/icons.png differ