From 91975bf22481edb0f74c204a7b847baac3830736 Mon Sep 17 00:00:00 2001 From: Cow Date: Tue, 29 Dec 2020 14:06:37 +0100 Subject: Added quick lookup for item prices and wiki --- .../de/cowtipper/cowlection/util/GuiHelper.java | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/main/java/de/cowtipper/cowlection/util/GuiHelper.java') diff --git a/src/main/java/de/cowtipper/cowlection/util/GuiHelper.java b/src/main/java/de/cowtipper/cowlection/util/GuiHelper.java index 44bfe13..8ce23e5 100644 --- a/src/main/java/de/cowtipper/cowlection/util/GuiHelper.java +++ b/src/main/java/de/cowtipper/cowlection/util/GuiHelper.java @@ -49,9 +49,9 @@ public final class GuiHelper extends GuiScreen { return instance; } - public static Slot getSlotUnderMouse(GuiChest guiChest) { + public static Slot getSlotUnderMouse(GuiContainer guiContainer) { try { - return ReflectionHelper.getPrivateValue(GuiContainer.class, guiChest, "theSlot", "field_147006_u"); + return ReflectionHelper.getPrivateValue(GuiContainer.class, guiContainer, "theSlot", "field_147006_u"); } catch (ReflectionHelper.UnableToAccessFieldException e) { e.printStackTrace(); return null; @@ -94,6 +94,17 @@ public final class GuiHelper extends GuiScreen { tessellator.draw(); } + public static void drawHoveringTextWithGraph(List toolTip) { + int mouseX = Mouse.getX() * getInstance().width / getInstance().mc.displayWidth; + int mouseY = getInstance().height - Mouse.getY() * getInstance().height / getInstance().mc.displayHeight - 1; + ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); + + getInstance().width = scaledResolution.getScaledWidth(); + getInstance().height = scaledResolution.getScaledHeight(); + + getInstance().drawHoveringText(toolTip, mouseX, mouseY, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), -1, true); + } + public static void drawHoveringText(List textLines, int mouseX, int mouseY, int screenWidth, int screenHeight, int maxTextWidth) { if (ForgeVersion.getBuildVersion() < 1808) { // we're running a forge version from before 24 March 2016 (http://files.minecraftforge.net/maven/net/minecraftforge/forge/index_1.8.9.html for reference) @@ -107,17 +118,6 @@ public final class GuiHelper extends GuiScreen { } } - public static void drawHoveringTextWithGraph(List toolTip) { - int mouseX = Mouse.getX() * getInstance().width / getInstance().mc.displayWidth; - int mouseY = getInstance().height - Mouse.getY() * getInstance().height / getInstance().mc.displayHeight - 1; - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - - getInstance().width = scaledResolution.getScaledWidth(); - getInstance().height = scaledResolution.getScaledHeight(); - - getInstance().drawHoveringText(toolTip, mouseX, mouseY, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), -1, true); - } - /** * Fixed method for forge versions older than 1.8.9-11.15.1.1808 * -- cgit