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 f9a923f60..bd95eee9e 100644 --- a/src/main/java/noppes/npcs/client/gui/util/GuiNPCInterface.java +++ b/src/main/java/noppes/npcs/client/gui/util/GuiNPCInterface.java @@ -36,7 +36,7 @@ public abstract class GuiNPCInterface extends GuiScreen protected HashMap scrolls = new HashMap(); protected HashMap sliders = new HashMap(); protected HashMap extra = new HashMap(); - protected HashMap scrollableGuiInserts = new HashMap<>(); + protected HashMap scrollableGuiInserts = new HashMap<>(); public String title; private ResourceLocation background = null; @@ -108,7 +108,7 @@ public abstract class GuiNPCInterface extends GuiScreen extra.put(gui.id, gui); } - public void addScrollableGui(int id, GuiScrollable gui){ + public void addScrollableGui(int id, GuiScrollableComponent gui){ gui.setWorldAndResolution(mc, width, height); gui.initGui(); scrollableGuiInserts.put(id, gui); @@ -123,9 +123,9 @@ public abstract class GuiNPCInterface extends GuiScreen if(tf.enabled) tf.mouseClicked(i, j, k); - for(GuiScrollable guiScrollable : scrollableGuiInserts.values()) { - if(guiScrollable.isMouseOver(i, j)) - guiScrollable.mouseClicked(i, j, k); + for(GuiScrollableComponent guiScrollableComponent : scrollableGuiInserts.values()) { + if(guiScrollableComponent.isMouseOver(i, j)) + guiScrollableComponent.mouseClicked(i, j, k); } if (k == 0){ @@ -204,7 +204,7 @@ public abstract class GuiNPCInterface extends GuiScreen return labels.get(i); } - public GuiScrollable getScrollableGui(int i) { + public GuiScrollableComponent getScrollableGui(int i) { return scrollableGuiInserts.get(i); } @@ -263,8 +263,8 @@ public abstract class GuiNPCInterface extends GuiScreen button.drawHover(i, j, subGui); } } - for(GuiScrollable guiScrollable : scrollableGuiInserts.values()){ - guiScrollable.drawScreen(i, j, f, guiScrollable.isMouseOver(i,j)?scrolled:0); + for(GuiScrollableComponent guiScrollableComponent : scrollableGuiInserts.values()){ + guiScrollableComponent.drawScreen(i, j, f, guiScrollableComponent.isMouseOver(i,j)?scrolled:0); } if(subgui != null) diff --git a/src/main/java/noppes/npcs/client/gui/util/GuiScrollable.java b/src/main/java/noppes/npcs/client/gui/util/GuiScrollableComponent.java similarity index 90% rename from src/main/java/noppes/npcs/client/gui/util/GuiScrollable.java rename to src/main/java/noppes/npcs/client/gui/util/GuiScrollableComponent.java index 0674ee5ba..38cc087e0 100644 --- a/src/main/java/noppes/npcs/client/gui/util/GuiScrollable.java +++ b/src/main/java/noppes/npcs/client/gui/util/GuiScrollableComponent.java @@ -4,10 +4,11 @@ import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.util.ChatComponentText; import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.scripted.CustomNPCsException; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; -public class GuiScrollable extends GuiNPCInterface{ +public class GuiScrollableComponent extends GuiNPCInterface{ protected ScaledResolution scaledResolution; public int clipWidth; @@ -24,7 +25,7 @@ public class GuiScrollable extends GuiNPCInterface{ return a + lambda * (b - a); } - public GuiScrollable(EntityNPCInterface npc, int posX, int posY, int clipWidth, int clipHeight, int maxScroll){ + public GuiScrollableComponent(EntityNPCInterface npc, int posX, int posY, int clipWidth, int clipHeight, int maxScroll){ super(npc); this.xPos = posX; this.yPos = posY; @@ -98,6 +99,11 @@ public class GuiScrollable extends GuiNPCInterface{ } } + @Override + public void addScrollableGui(int id, GuiScrollableComponent d){ + throw new CustomNPCsException("You can't put scrollable GUIs into a scrollable GUI"); + } + @Override public void buttonEvent(GuiButton button){ mc.thePlayer.addChatMessage(new ChatComponentText("LOL"));