diff --git a/src/main/java/noppes/npcs/client/gui/player/GuiQuestLog.java b/src/main/java/noppes/npcs/client/gui/player/GuiQuestLog.java index 11267b077..c8bf57888 100644 --- a/src/main/java/noppes/npcs/client/gui/player/GuiQuestLog.java +++ b/src/main/java/noppes/npcs/client/gui/player/GuiQuestLog.java @@ -16,6 +16,7 @@ import noppes.npcs.client.TextBlockClient; import noppes.npcs.client.gui.util.*; import noppes.npcs.constants.EnumPacketServer; import noppes.npcs.constants.EnumPlayerPacket; +import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; import tconstruct.client.tabs.InventoryTabQuests; import tconstruct.client.tabs.TabRegistry; @@ -39,6 +40,9 @@ public class GuiQuestLog extends GuiNPCInterface implements ITopButtonListener,I private Minecraft mc = Minecraft.getMinecraft(); + private float sideButtonScroll = 0; + private float destSideButtonScroll = 0; + public GuiQuestLog(EntityPlayer player) { super(); this.player = player; @@ -135,8 +139,18 @@ public class GuiQuestLog extends GuiNPCInterface implements ITopButtonListener,I fontRendererObj.drawString(StatCollector.translateToLocal("quest.noquests"),guiLeft + 84,guiTop + 80, CustomNpcResourceListener.DefaultTextColor); return; } - for(GuiMenuSideButton button: sideButtons.values().toArray(new GuiMenuSideButton[sideButtons.size()])){ - button.drawButton(mc, i, j); + + this.destSideButtonScroll += Math.signum(this.mouseWheel) * 22; + this.sideButtonScroll = this.sideButtonScroll * (1.0F - 0.2F) + (this.destSideButtonScroll * 0.2F); + + for(Map.Entry entry : this.sideButtons.entrySet()){ + int buttonNumber = entry.getKey(); + GuiMenuSideButton button = entry.getValue(); + + button.yPosition = (int) (this.guiTop +2 + buttonNumber*21 + this.sideButtonScroll); + if (button.yPosition >= this.guiTop + 2 && button.yPosition < this.guiTop + 22 * 8 + 2) { + button.drawButton(mc, i, j); + } } fontRendererObj.drawString(data.selectedCategory,guiLeft + 5,guiTop + 5, CustomNpcResourceListener.DefaultTextColor); diff --git a/src/main/java/noppes/npcs/client/gui/util/GuiNPCInterface.java b/src/main/java/noppes/npcs/client/gui/util/GuiNPCInterface.java index d7d057d16..8b76d3964 100644 --- a/src/main/java/noppes/npcs/client/gui/util/GuiNPCInterface.java +++ b/src/main/java/noppes/npcs/client/gui/util/GuiNPCInterface.java @@ -47,6 +47,8 @@ public abstract class GuiNPCInterface extends GuiScreen public float bgScaleY = 1; public float bgScaleZ = 1; + public int mouseWheel; + public GuiNPCInterface(EntityNPCInterface npc) { this.player = Minecraft.getMinecraft().thePlayer; @@ -211,6 +213,8 @@ public abstract class GuiNPCInterface extends GuiScreen @Override public void drawScreen(int i, int j, float f){ + this.mouseWheel = Mouse.getDWheel(); + if(AWTWindow != null){ if(!AWTWindow.isVisible()){ AWTWindow.dispose(); @@ -248,7 +252,7 @@ public abstract class GuiNPCInterface extends GuiScreen tf.drawTextBox(i, j); } for(GuiCustomScroll scroll : scrolls.values()) - scroll.drawScreen(i, j, f, hasSubGui()?0:Mouse.getDWheel()); + scroll.drawScreen(i, j, f, hasSubGui()?0:this.mouseWheel); for(GuiScreen gui : extra.values()) gui.drawScreen(i, j, f); super.drawScreen(i, j, f);