mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-13 05:27:37 +00:00
Fix Hover Labels on Scroll Components
This commit is contained in:
1 parent
f95e7afb4e
commit
21cd8e9e01
3 files changed
+9
-9
No files matched your search
@@ -16,7 +16,7 @@ public class SubGuiSpawningOptions extends SubGuiInterface implements ITextfield
|
||||
public SubGuiSpawningOptions(SpawnData data) {
|
||||
this.data = data;
|
||||
setBackground("menubg.png");
|
||||
xSize = 236;
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
}
|
||||
@@ -98,7 +98,7 @@ public class SubGuiSpawningOptions extends SubGuiInterface implements ITextfield
|
||||
sw.getTextField(19).setHoverText("tooltip.naturalspawns.options.playerMinDistance");
|
||||
y += 22;
|
||||
|
||||
sw.addButton(new GuiNpcButton(20, controlX, y, 74, 20,
|
||||
sw.addButton(new GuiNpcButton(20, controlX, y, 100, 20,
|
||||
new String[]{"spawning.despawn.forceNatural", "spawning.despawn.preserve", "spawning.despawn.forcePersistent"}, data.despawnMode));
|
||||
sw.addLabel(new GuiNpcLabel(20, "spawning.despawnMode", labelX, y + 5));
|
||||
sw.getButton(20).setHoverText("tooltip.naturalspawns.options.despawnMode");
|
||||
|
||||
@@ -417,6 +417,12 @@ public abstract class GuiNPCInterface extends GuiScreen {
|
||||
}
|
||||
}
|
||||
|
||||
for(GuiScrollWindow guiScrollableComponent : scrollWindows.values()) {
|
||||
if (guiScrollableComponent.isMouseOver(mouseX, mouseY)) {
|
||||
guiScrollableComponent.drawHoverTexts(mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
||||
for (GuiScreen gui : extra.values())
|
||||
gui.drawScreen(i, j, f);
|
||||
|
||||
|
||||
@@ -251,12 +251,6 @@ public class GuiScrollWindow extends GuiScreen implements ITextfieldListener, IC
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
// Draw hover texts in screen space (after scissor/translation are undone)
|
||||
// so tooltips are not clipped and are positioned correctly
|
||||
if (isMouseOver(mouseX, mouseY)) {
|
||||
drawHoverTexts(mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks, int mouseScroll) {
|
||||
@@ -293,7 +287,7 @@ public class GuiScrollWindow extends GuiScreen implements ITextfieldListener, IC
|
||||
* Draws hover texts for buttons in screen space (called after GL scissor/translate are undone).
|
||||
* Hover state was already computed during drawComponents with scroll-local coords.
|
||||
*/
|
||||
private void drawHoverTexts(int mouseX, int mouseY) {
|
||||
public void drawHoverTexts(int mouseX, int mouseY) {
|
||||
boolean subGui = parent.hasSubGui();
|
||||
for (GuiNpcButton button : buttons.values()) {
|
||||
if (!button.hoverableText.isEmpty()) {
|
||||
|
||||
Reference in new issue
Block a user