GuiQuestLog:

-You can now scroll through side buttons with the mouse wheel.
This commit is contained in:
Luis C.M committed 2023-08-22 18:00:04 -05:00
1 parent 0405b6d475
commit b639685b5f
2 files changed
+21 -3

No files matched your search

@@ -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<Integer,GuiMenuSideButton> 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);
@@ -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);