diff --git a/src/main/java/noppes/npcs/client/ClientTickHandler.java b/src/main/java/noppes/npcs/client/ClientTickHandler.java index bfbb559b3..e1a0a5d56 100644 --- a/src/main/java/noppes/npcs/client/ClientTickHandler.java +++ b/src/main/java/noppes/npcs/client/ClientTickHandler.java @@ -12,10 +12,7 @@ import noppes.npcs.CustomNpcs; import noppes.npcs.NoppesUtilPlayer; import noppes.npcs.client.controllers.MusicController; import noppes.npcs.client.controllers.ScriptSoundController; -import noppes.npcs.client.gui.player.inventory.GuiCNPCInventory; -import noppes.npcs.client.gui.player.inventory.GuiFaction; -import noppes.npcs.client.gui.player.inventory.GuiParty; -import noppes.npcs.client.gui.player.inventory.GuiQuestLog; +import noppes.npcs.client.gui.player.inventory.*; import noppes.npcs.client.renderer.RenderNPCInterface; import noppes.npcs.constants.EnumPlayerPacket; import org.lwjgl.input.Keyboard; @@ -105,6 +102,9 @@ public class ClientTickHandler{ case 2: NoppesUtil.openGUI(mc.thePlayer, new GuiFaction()); break; + case 3: + NoppesUtil.openGUI(mc.thePlayer, new GuiSettings()); + break; } } else if(mc.currentScreen instanceof GuiQuestLog) diff --git a/src/main/java/noppes/npcs/client/gui/OverlayQuestTracking.java b/src/main/java/noppes/npcs/client/gui/OverlayQuestTracking.java index 90a46fbe5..badcc3880 100644 --- a/src/main/java/noppes/npcs/client/gui/OverlayQuestTracking.java +++ b/src/main/java/noppes/npcs/client/gui/OverlayQuestTracking.java @@ -185,53 +185,62 @@ public class OverlayQuestTracking extends Gui { GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glPushMatrix(); - GL11.glTranslatef(ConfigClient.TrackingInfoAlignment%3*((float)(scaledWidth)/2), (float) (Math.floor((float)(ConfigClient.TrackingInfoAlignment/3))*((float)(scaledHeight)/2)),0.0F); + GL11.glTranslatef(ConfigClient.TrackingInfoAlignment%3*((float)(scaledWidth)/2), (float) (Math.floor((float)(ConfigClient.TrackingInfoAlignment/3))*((float)(scaledHeight)/2)),0.0F); - float offsetX = ConfigClient.TrackingInfoAlignment%3 == 0 ? 5 : -5; - GL11.glTranslatef(ConfigClient.TrackingInfoX + offsetX, ConfigClient.TrackingInfoY, 0.0F); + float offsetX = ConfigClient.TrackingInfoAlignment%3 == 0 ? 5 : -5; - red = (color >> 16 & 255) / 255f; - green = (color >> 8 & 255) / 255f; - blue = (color & 255) / 255f; + float offsetY = ConfigClient.TrackingInfoAlignment < 3 ? 5 : 0; + offsetY = ConfigClient.TrackingInfoAlignment > 5 ? -5 : offsetY; - float centerX = -60; - centerX *= ConfigClient.TrackingInfoAlignment%3 == 0 ? -1 : 1; - float questTitleTop; - this.renderOffsetY = -40; - GL11.glPushMatrix(); - GL11.glTranslatef(centerX, 0.0F, 0.0F); - this.renderStringLines(trackedQuestLines,1.2F, false, true, 0); - GL11.glPopMatrix(); - questTitleTop = this.renderOffsetY; - this.renderOffsetY -= 10; - GL11.glPushMatrix(); - GL11.glTranslatef(centerX, 0.0F, 0.0F); - this.renderStringLines(categoryNameLines,0.85F, false, false, 0); - GL11.glPopMatrix(); + GL11.glTranslatef(ConfigClient.TrackingInfoX + offsetX, ConfigClient.TrackingInfoY + offsetY, 0.0F); - this.renderOffsetY = -10; - GL11.glPushMatrix(); - this.renderStringLines(objectiveLines,1F, true, false, ConfigClient.TrackingInfoAlignment%3 == 0 ? 1 : 2); - GL11.glPopMatrix(); + red = (color >> 16 & 255) / 255f; + green = (color >> 8 & 255) / 255f; + blue = (color & 255) / 255f; - this.renderOffsetY += 10; - GL11.glPushMatrix(); - this.renderStringLines(turnInText,1F, false, false, ConfigClient.TrackingInfoAlignment%3 == 0 ? 1 : 2); - GL11.glPopMatrix(); + float centerX = -60; + if (ConfigClient.TrackingInfoAlignment % 3 == 1) { // For Center alignment + centerX = 0; + } else { + centerX *= ConfigClient.TrackingInfoAlignment % 3 == 0 ? -1 : 1; + } - this.renderOffsetY = -20; - GL11.glPushMatrix(); - this.drawHorizontalLine((int)(-overlayWidth/2 + centerX), (int)(overlayWidth/2 + centerX), (int) (this.renderOffsetY+2), 0xFF777777); - this.drawHorizontalLine((int)(-overlayWidth/2 + centerX), (int)(overlayWidth/2 + centerX), (int) (this.renderOffsetY+1), 0xFFA8A8A8); - this.drawHorizontalLine((int)(-overlayWidth/2 + centerX), (int)(overlayWidth/2 + centerX), (int) (this.renderOffsetY), 0xFFFFFFFF); - GL11.glPopMatrix(); - this.renderOffsetY = questTitleTop + 2; - GL11.glPushMatrix(); - this.drawHorizontalLine((int)(-overlayWidth/2 + centerX), (int)(overlayWidth/2 + centerX), (int) (this.renderOffsetY), 0xFFFFFFFF); - this.drawHorizontalLine((int)(-overlayWidth/2 + centerX), (int)(overlayWidth/2 + centerX), (int) (this.renderOffsetY-1), 0xFFA8A8A8); - this.drawHorizontalLine((int)(-overlayWidth/2 + centerX), (int)(overlayWidth/2 + centerX), (int) (this.renderOffsetY-2), 0xFF777777); - GL11.glPopMatrix(); + float questTitleTop; + this.renderOffsetY = -40; + GL11.glPushMatrix(); + GL11.glTranslatef(centerX, 0.0F, 0.0F); + this.renderStringLines(trackedQuestLines,1.2F, false, true, 0); + GL11.glPopMatrix(); + questTitleTop = this.renderOffsetY; + this.renderOffsetY -= 10; + GL11.glPushMatrix(); + GL11.glTranslatef(centerX, 0.0F, 0.0F); + this.renderStringLines(categoryNameLines,0.85F, false, false, 0); + GL11.glPopMatrix(); + + this.renderOffsetY = -10; + GL11.glPushMatrix(); + this.renderStringLines(objectiveLines, 1F, true, false, ConfigClient.TrackingInfoAlignment % 3 == 0 ? 1 : (ConfigClient.TrackingInfoAlignment % 3 == 2 ? 2 : 0)); + GL11.glPopMatrix(); + + this.renderOffsetY += 10; + GL11.glPushMatrix(); + this.renderStringLines(turnInText, 1F, true, false, ConfigClient.TrackingInfoAlignment % 3 == 0 ? 1 : (ConfigClient.TrackingInfoAlignment % 3 == 2 ? 2 : 0)); + GL11.glPopMatrix(); + + this.renderOffsetY = -20; + GL11.glPushMatrix(); + this.drawHorizontalLine((int)(-overlayWidth/2 + centerX), (int)(overlayWidth/2 + centerX), (int) (this.renderOffsetY+2), 0xFF777777); + this.drawHorizontalLine((int)(-overlayWidth/2 + centerX), (int)(overlayWidth/2 + centerX), (int) (this.renderOffsetY+1), 0xFFA8A8A8); + this.drawHorizontalLine((int)(-overlayWidth/2 + centerX), (int)(overlayWidth/2 + centerX), (int) (this.renderOffsetY), 0xFFFFFFFF); + GL11.glPopMatrix(); + this.renderOffsetY = questTitleTop + 2; + GL11.glPushMatrix(); + this.drawHorizontalLine((int)(-overlayWidth/2 + centerX), (int)(overlayWidth/2 + centerX), (int) (this.renderOffsetY), 0xFFFFFFFF); + this.drawHorizontalLine((int)(-overlayWidth/2 + centerX), (int)(overlayWidth/2 + centerX), (int) (this.renderOffsetY-1), 0xFFA8A8A8); + this.drawHorizontalLine((int)(-overlayWidth/2 + centerX), (int)(overlayWidth/2 + centerX), (int) (this.renderOffsetY-2), 0xFF777777); + GL11.glPopMatrix(); GL11.glPopMatrix(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); diff --git a/src/main/java/noppes/npcs/client/gui/player/GuiDialogInteract.java b/src/main/java/noppes/npcs/client/gui/player/GuiDialogInteract.java index c850a0269..5c1186d23 100644 --- a/src/main/java/noppes/npcs/client/gui/player/GuiDialogInteract.java +++ b/src/main/java/noppes/npcs/client/gui/player/GuiDialogInteract.java @@ -21,6 +21,8 @@ import noppes.npcs.client.controllers.MusicController; import noppes.npcs.client.gui.util.GuiNPCInterface; import noppes.npcs.client.gui.util.GuiSelectionListener; import noppes.npcs.client.gui.util.IGuiClose; +import noppes.npcs.config.ConfigClient; +import noppes.npcs.config.ConfigMain; import noppes.npcs.constants.EnumOptionType; import noppes.npcs.constants.EnumPlayerPacket; import noppes.npcs.controllers.data.Dialog; @@ -57,9 +59,6 @@ public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose private int instantLinePos = 0; private int prevPausePos = -1; - private static int textSpeed = 10; - private static boolean textSoundEnabled = true; - private int scrollY; private ResourceLocation wheel; private ResourceLocation[] wheelparts; @@ -177,11 +176,6 @@ public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose GL11.glPushMatrix(); GL11.glTranslatef(0.0F, 0.5f, 100.065F); - if (dialog.renderGradual) { - drawString(fontRendererObj, "Text Speed: " + textSpeed, 10, 10, 0xFFFFFF); - drawString(fontRendererObj, "Text Sound: " + (textSoundEnabled ? "On" : "Off"), 10, 20, 0xFFFFFF); - } - for (IDialogImage dialogImage : dialog.dialogImages.values()) { if (dialogImage.getImageType() != 0) continue; @@ -317,8 +311,8 @@ public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose try { if (textPauseTime > 0) { textPauseTime--; - } else if (textSpeed > 10 || gradualTextTime%(11 - textSpeed) == 0) { - int addChar = textSpeed > 10 ? textSpeed - 9 : 1; + } else if (ConfigClient.DialogSpeed > 10 || gradualTextTime%(11 - ConfigClient.DialogSpeed) == 0) { + int addChar = ConfigClient.DialogSpeed > 10 ? ConfigClient.DialogSpeed - 9 : 1; String addText = line.getFormattedText().substring(gradualText.length(), gradualText.length() + addChar); if (addText.matches("^(\\{(\\d+)})(.*)")) { @@ -353,10 +347,12 @@ public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose } gradualText += addText; - if (textSoundTime % 5 == 0) { - Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation(dialog.textSound), dialog.textPitch)); - } - textSoundTime++; + if(ConfigClient.DialogSound){ + if (textSoundTime % 5 == 0) { + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation(dialog.textSound), dialog.textPitch)); + } + textSoundTime++; + } } } catch (IndexOutOfBoundsException exception) { gradualText = line.getFormattedText(); @@ -581,20 +577,6 @@ public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose } } - if(i == mc.gameSettings.keyBindForward.getKeyCode() || i == Keyboard.KEY_LEFT){ - textSpeed--; - if (textSpeed < 1) { - textSpeed = 1; - } - } - if(i == mc.gameSettings.keyBindBack.getKeyCode() || i == Keyboard.KEY_RIGHT){ - textSpeed++; - } - - if(i == mc.gameSettings.keyBindJump.getKeyCode() || i == Keyboard.KEY_SPACE){ - textSoundEnabled = !textSoundEnabled; - } - if (dialog.alignment == 1 && totalRows * ClientProxy.Font.height() > dialog.textHeight) { if ((i == mc.gameSettings.keyBindBack.getKeyCode() || i == 201) && scrollY < totalRows * ClientProxy.Font.height()) {//Page up scrollY += ClientProxy.Font.height() * 2; 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 b8870861a..53de1634e 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,10 +1,12 @@ package noppes.npcs.client.gui.player.inventory; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import noppes.npcs.CustomItems; +import noppes.npcs.client.gui.util.GuiButtonNextPage; import noppes.npcs.client.gui.util.GuiMenuSideButton; import noppes.npcs.client.gui.util.GuiNPCInterface; import noppes.npcs.config.ConfigClient; @@ -12,7 +14,6 @@ import tconstruct.client.tabs.InventoryTabCustomNpc; 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; @@ -55,7 +56,7 @@ public class GuiCNPCInventory extends GuiNPCInterface { } y += 21; - GuiMenuSideButton clientButton = new GuiMenuSideButton(101, 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.renderIconPosX = 16; @@ -63,6 +64,28 @@ public class GuiCNPCInventory extends GuiNPCInterface { addButton(clientButton); } + @Override + protected void actionPerformed(GuiButton guibutton){ + if (guibutton.id >= 100) { + if (guibutton.id == 100 && activeTab != 0) { + activeTab = 0; + mc.displayGuiScreen(new GuiQuestLog(mc.thePlayer)); + } + if (guibutton.id == 101 && activeTab != 1) { + activeTab = 1; + mc.displayGuiScreen(new GuiParty(mc.thePlayer)); + } + if (guibutton.id == 102 && activeTab != 2) { + activeTab = 2; + mc.displayGuiScreen(new GuiFaction()); + } + if (guibutton.id == 103 && activeTab != 3) { + activeTab = 3; + mc.displayGuiScreen(new GuiSettings()); + } + } + } + @Override public void save() {} } 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 1b668fa1b..0362351dd 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,21 +133,10 @@ public class GuiFaction extends GuiCNPCInventory implements IGuiData{ @Override protected void actionPerformed(GuiButton guibutton){ - if (guibutton.id >= 100) { - if (guibutton.id == 100 && activeTab != 0) { - activeTab = 0; - mc.displayGuiScreen(new GuiQuestLog(mc.thePlayer)); - } - if (guibutton.id == 101 && activeTab != 1) { - activeTab = 1; - mc.displayGuiScreen(new GuiParty(mc.thePlayer)); - } - if (guibutton.id == 102 && activeTab != 2) { - activeTab = 2; - mc.displayGuiScreen(new GuiFaction()); - } - } - + if (guibutton.id >= 100) { + super.actionPerformed(guibutton); + return; + } if(!(guibutton instanceof GuiButtonNextPage)) return; int id = guibutton.id; 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 8f516c887..3c1bfe594 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 @@ -215,6 +215,10 @@ public class GuiParty extends GuiCNPCInventory implements ITextfieldListener, IT @Override protected void actionPerformed(GuiButton guibutton){ + if (guibutton.id >= 100) { + super.actionPerformed(guibutton); + return; + } Party party = ClientCacheHandler.party; switch (guibutton.id) { @@ -284,18 +288,6 @@ public class GuiParty extends GuiCNPCInventory implements ITextfieldListener, IT break; } initGui(); - if (guibutton.id == 100 && activeTab != 0) { - activeTab = 0; - mc.displayGuiScreen(new GuiQuestLog(mc.thePlayer)); - } - if (guibutton.id == 101 && activeTab != 1) { - activeTab = 1; - mc.displayGuiScreen(new GuiParty(mc.thePlayer)); - } - if (guibutton.id == 102 && activeTab != 2) { - activeTab = 2; - mc.displayGuiScreen(new GuiFaction()); - } } @Override 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 9e823e536..d5d8d37ec 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 @@ -167,21 +167,10 @@ public class GuiQuestLog extends GuiCNPCInventory implements ITopButtonListener, if(lastClicked > System.currentTimeMillis() - 10){ return; } - - if(guibutton.id == 11){ - questPages = 1; - lastClicked = System.currentTimeMillis(); + if (guibutton.id >= 100) { + super.actionPerformed(guibutton); + return; } - else if(guibutton.id == 10){ - questPages = 0; - } - else if(guibutton.id == 1){ - questPages = 2; - } - else if(guibutton.id == 2){ - questPages = 1; - lastClicked = System.currentTimeMillis(); - } if (guibutton.id == 3) { @@ -203,18 +192,6 @@ public class GuiQuestLog extends GuiCNPCInventory implements ITopButtonListener, data.toggleQuestAlerts(); } initGui(); - if (guibutton.id == 100 && activeTab != 0) { - activeTab = 0; - mc.displayGuiScreen(new GuiQuestLog(mc.thePlayer)); - } - if (guibutton.id == 101 && activeTab != 1) { - activeTab = 1; - mc.displayGuiScreen(new GuiParty(mc.thePlayer)); - } - if (guibutton.id == 102 && activeTab != 2) { - activeTab = 2; - mc.displayGuiScreen(new GuiFaction()); - } } @Override public void drawScreen(int i, int j, float f){ 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 new file mode 100644 index 000000000..ed336b50b --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/player/inventory/GuiSettings.java @@ -0,0 +1,144 @@ +package noppes.npcs.client.gui.player.inventory; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; +import noppes.npcs.NoppesUtilPlayer; +import noppes.npcs.client.CustomNpcResourceListener; +import noppes.npcs.client.gui.util.*; +import noppes.npcs.config.ConfigClient; +import noppes.npcs.constants.EnumPlayerPacket; +import noppes.npcs.controllers.data.Faction; +import noppes.npcs.controllers.data.PlayerFactionData; +import org.lwjgl.opengl.GL11; +import tconstruct.client.tabs.InventoryTabCustomNpc; +import tconstruct.client.tabs.TabRegistry; + +import java.util.ArrayList; + +public class GuiSettings extends GuiCNPCInventory implements ITextfieldListener { + + private final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/standardbg.png"); + private Minecraft mc = Minecraft.getMinecraft(); + + + public GuiSettings() { + super(); + xSize = 280; + ySize = 180; + this.drawDefaultBackground = false; + title = ""; + } + + @Override + public void initGui() + { + super.initGui(); + TabRegistry.addTabsToList(buttonList); + TabRegistry.updateTabValues(guiLeft, guiTop, InventoryTabCustomNpc.class); + + int y = 0; + this.addLabel(new GuiNpcLabel(1, "Chat Bubbles", guiLeft + 8, guiTop + 14 + y)); + this.addButton(new GuiNpcButton(1, guiLeft + 105, guiTop + 9 + y, 50, 20, new String[]{"gui.no", "gui.yes"}, ConfigClient.EnableChatBubbles?1:0)); + + this.addLabel(new GuiNpcLabel(3, "Tracking Alignment", guiLeft + 8 + 155, guiTop + 14 + y)); + this.addButton(new GuiNpcButton(3, guiLeft + 105 + 160, guiTop + 9 + y, 50, 20, new String[]{"TLeft", "TCenter", "TRight", "Left", "Center", "Right", "BLeft", "BCenter", "BRight"}, ConfigClient.TrackingInfoAlignment)); + + y += 22; + this.addLabel(new GuiNpcLabel(2, "Dialog Sound", guiLeft + 8, guiTop + 14 + y)); + this.addButton(new GuiNpcButton(2, guiLeft + 105, guiTop + 9 + y, 50, 20, new String[]{"gui.no", "gui.yes"}, ConfigClient.DialogSound?1:0)); + + this.addLabel(new GuiNpcLabel(12,"Alignment X", guiLeft + 8 + 155, guiTop + 14 + y)); + this.addTextField(new GuiNpcTextField(12, this, this.fontRendererObj, guiLeft + 107 + 160, guiTop + 9 + y, 45, 20, ConfigClient.TrackingInfoX + "")); + getTextField(12).integersOnly = true; + getTextField(12).setMinMaxDefault(-2000, 2000, 0); + + y += 22; + this.addLabel(new GuiNpcLabel(10,"Dialog Speed", guiLeft + 8, guiTop + 14 + y)); + this.addTextField(new GuiNpcTextField(10, this, this.fontRendererObj, guiLeft + 107, guiTop + 9 + y, 45, 20, ConfigClient.DialogSpeed + "")); + getTextField(10).integersOnly = true; + getTextField(10).setMinMaxDefault(1, 20, 10); + + this.addLabel(new GuiNpcLabel(13,"Alignment Y", guiLeft + 8 + 155, guiTop + 14 + y)); + this.addTextField(new GuiNpcTextField(13, this, this.fontRendererObj, guiLeft + 107 + 160, guiTop + 9 + y, 45, 20, ConfigClient.TrackingInfoY + "")); + getTextField(13).integersOnly = true; + getTextField(13).setMinMaxDefault(-2000, 2000, 0); + + + // Planned + // Clear Skin Cache + // Clear Tracked Quest + // + } + + @Override + public void drawScreen(int i, int j, float f) + { + drawDefaultBackground(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + mc.renderEngine.bindTexture(resource); + drawTexturedModalRect(guiLeft, guiTop, 0, 0, 252, 195); + drawTexturedModalRect(guiLeft + 252, guiTop, 188, 0, 67, 195); + super.drawScreen(i, j, f); + + } + + @Override + protected void actionPerformed(GuiButton btn){ + if (btn.id >= 100) { + super.actionPerformed(btn); + return; + } + if(!(btn instanceof GuiNpcButton)) + return; + GuiNpcButton button = (GuiNpcButton) btn; + if(button.id == 1){ + ConfigClient.EnableChatBubbles = button.getValue() == 1; + ConfigClient.EnableChatBubblesProperty.set(ConfigClient.EnableChatBubbles); + } + if(button.id == 2){ + ConfigClient.DialogSound = button.getValue() == 1; + ConfigClient.DialogSoundProperty.set(ConfigClient.DialogSound); + } + if(button.id == 3){ + ConfigClient.TrackingInfoAlignment = button.getValue(); + ConfigClient.TrackingInfoAlignmentProperty.set(ConfigClient.TrackingInfoAlignment); + } + } + + + @Override + public void keyTyped(char c, int i) + { + super.keyTyped(c, i); + if (i == 1 || isInventoryKey(i)) + { + close(); + } + } + + @Override + public void save() {} + + + @Override + public void unFocused(GuiNpcTextField textfield) { + if(textfield.id == 10){ + ConfigClient.DialogSpeed = textfield.getInteger(); + ConfigClient.DialogSpeedProperty.set(ConfigClient.DialogSound); + } + + // Quest Tracking + if(textfield.id == 12){ + ConfigClient.TrackingInfoX = textfield.getInteger(); + ConfigClient.TrackingInfoXProperty.set(ConfigClient.TrackingInfoX); + } + if(textfield.id == 13){ + ConfigClient.TrackingInfoY = textfield.getInteger(); + ConfigClient.TrackingInfoYProperty.set(ConfigClient.TrackingInfoY); + } + } +} diff --git a/src/main/java/noppes/npcs/config/ConfigClient.java b/src/main/java/noppes/npcs/config/ConfigClient.java index 8e9312d39..e6d5176a1 100644 --- a/src/main/java/noppes/npcs/config/ConfigClient.java +++ b/src/main/java/noppes/npcs/config/ConfigClient.java @@ -24,9 +24,6 @@ public class ConfigClient public static Property CacheLifeProperty; public static int CacheLife = 10; - public static Property enableFactionTabProperty; - public static boolean enableFactionTab = true; - /** * Visual Properties **/ @@ -36,6 +33,9 @@ public class ConfigClient public static Property InventoryGuiEnabledProperty; public static boolean InventoryGuiEnabled = true; + public static Property enableFactionTabProperty; + public static boolean enableFactionTab = true; + public static Property FontTypeProperty; public static String FontType = "Default"; @@ -54,6 +54,12 @@ public class ConfigClient public static Property TrackingInfoYProperty; public static int TrackingInfoY = 0; + public static Property DialogSpeedProperty; + public static int DialogSpeed = 10; + + public static Property DialogSoundProperty; + public static boolean DialogSound = true; + public static void init(File configFile) { config = new Configuration(configFile); @@ -66,9 +72,6 @@ public class ConfigClient CacheLifeProperty = config.get(GENERAL, "Cache Life", 10, "How long should downloaded imagery data be saved client side? (In minutes)"); CacheLife = CacheLifeProperty.getInt(10); - enableFactionTabProperty = config.get(GENERAL, "Enable Faction Tab", true, "Enable the Faction Tab"); - enableFactionTab = enableFactionTabProperty.getBoolean(true); - // Visual EnableChatBubblesProperty = config.get(VISUAL, "Enable Chat Bubbles", true, "Enable/Disable Chat Bubbles"); EnableChatBubbles = EnableChatBubblesProperty.getBoolean(true); @@ -76,6 +79,9 @@ public class ConfigClient InventoryGuiEnabledProperty = config.get(VISUAL, "Enable Inventory Tabs", true, "Enable/Disable Inventory Tabs"); InventoryGuiEnabled = InventoryGuiEnabledProperty.getBoolean(true); + enableFactionTabProperty = config.get(VISUAL, "Enable Faction Tab", true, "Enable the Faction Tab"); + enableFactionTab = enableFactionTabProperty.getBoolean(true); + FontTypeProperty = config.get(VISUAL, "Font Type", "Default", "When set to Minecraft it will use minecrafts font, when Default it will use OpenSans. Can only use fonts installed on your PC"); FontType = FontTypeProperty.getString(); @@ -92,6 +98,12 @@ public class ConfigClient TrackingInfoYProperty = config.get(QUESTING, "Tracking Info Y", 0, "Client sided! Offsets the tracking info GUI by this amount in the Y direction."); TrackingInfoY = TrackingInfoYProperty.getInt(0); + DialogSpeedProperty = config.get(VISUAL, "Dialog Speed", 10, "Only set for gradual dialogs"); + DialogSpeed = DialogSpeedProperty.getInt(10); + + DialogSoundProperty = config.get(VISUAL, "Dialog Sound", 10, "Only for dialogs with sounds"); + DialogSound = DialogSoundProperty.getBoolean(true); + // Convert to Legacy if(CustomNpcs.legacyExist){ EnableChatBubbles = LegacyConfig.EnableChatBubbles; @@ -132,4 +144,4 @@ public class ConfigClient } } } -} \ No newline at end of file +} diff --git a/src/main/java/tconstruct/client/tabs/InventoryTabCustomNpc.java b/src/main/java/tconstruct/client/tabs/InventoryTabCustomNpc.java index d4ed35488..2e00ee573 100644 --- a/src/main/java/tconstruct/client/tabs/InventoryTabCustomNpc.java +++ b/src/main/java/tconstruct/client/tabs/InventoryTabCustomNpc.java @@ -4,10 +4,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import noppes.npcs.CustomItems; -import noppes.npcs.client.gui.player.inventory.GuiCNPCInventory; -import noppes.npcs.client.gui.player.inventory.GuiFaction; -import noppes.npcs.client.gui.player.inventory.GuiParty; -import noppes.npcs.client.gui.player.inventory.GuiQuestLog; +import noppes.npcs.client.gui.player.inventory.*; public class InventoryTabCustomNpc extends AbstractTab { public InventoryTabCustomNpc() { @@ -43,6 +40,9 @@ public class InventoryTabCustomNpc extends AbstractTab { case 2: mc.displayGuiScreen(new GuiFaction()); break; + case 3: + mc.displayGuiScreen(new GuiSettings()); + break; } } };