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 e68c63d6a..11267b077 100644 --- a/src/main/java/noppes/npcs/client/gui/player/GuiQuestLog.java +++ b/src/main/java/noppes/npcs/client/gui/player/GuiQuestLog.java @@ -29,6 +29,7 @@ public class GuiQuestLog extends GuiNPCInterface implements ITopButtonListener,I private EntityPlayer player; private GuiCustomScroll scroll; private HashMap sideButtons = new HashMap(); + private HashMap otherButtons = new HashMap(); private QuestLogData data = new QuestLogData(); private boolean noQuests = false; private boolean questDetails = true; @@ -68,7 +69,8 @@ public class GuiQuestLog extends GuiNPCInterface implements ITopButtonListener,I if(data.selectedCategory.isEmpty()) data.selectedCategory = category; sideButtons.put(i, new GuiMenuSideButton(i,guiLeft - 69, this.guiTop +2 + i*21, 70,22, category)); - i++; + otherButtons.put(i, new GuiNpcButton(i,guiLeft - 69, this.guiTop +2 + i*21, 70,22, category)); + i++; } sideButtons.get(categories.indexOf(data.selectedCategory)).active = true; diff --git a/src/main/java/noppes/npcs/client/gui/util/GuiButtonScroll.java b/src/main/java/noppes/npcs/client/gui/util/GuiButtonScroll.java new file mode 100644 index 000000000..9c6211923 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/util/GuiButtonScroll.java @@ -0,0 +1,61 @@ +package noppes.npcs.client.gui.util; + +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; +import noppes.npcs.client.gui.GuiNpcMobSpawner; +import noppes.npcs.controllers.data.Tag; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; + +import java.util.*; + +public class GuiButtonScroll extends GuiCustomScroll +{ + private HashMap scrollButtons = new HashMap(); + public GuiButtonScroll(GuiScreen parent, int id) + { + super(parent, id); + } + + @Override + protected void drawItems() + { + for(int i = 0; i < list.size(); i++) + { + int j = 4; + int k = (14 * i + 4) - scrollY; + if(k >= 4 && k + 12 < ySize) + { + int xOffset = scrollHeight < ySize - 8?0:10; + String displayString = StatCollector.translateToLocal(list.get(i)); + + String text = ""; + float maxWidth = (xSize + xOffset - 8) * 0.8f; + if(fontRendererObj.getStringWidth(displayString) > maxWidth){ + for(int h = 0; h < displayString.length(); h++){ + char c = displayString.charAt(h); + text += c; + if(fontRendererObj.getStringWidth(text) > maxWidth) + break; + } + if(displayString.length() > text.length()) + text += "..."; + } + else + text = displayString; + if((multipleSelection && selectedList.contains(text)) || (!multipleSelection && selected == i)) { + drawVerticalLine(j-2, k-4, k + 10, 0xffffffff); + drawVerticalLine(j + xSize - 18 + xOffset, k - 4, k + 10, 0xffffffff); + drawHorizontalLine(j - 2, j + xSize - 18 + xOffset, k - 3 , 0xffffffff); + drawHorizontalLine(j - 2, j + xSize - 18 + xOffset, k + 10 , 0xffffffff); + fontRendererObj.drawString(text, j , k, 0xffffff); + } + else if(i == hover) + fontRendererObj.drawString(text, j , k, 0x00ff00); + else + fontRendererObj.drawString(text, j , k, 0xffffff); + } + } + } +}