From 353839ac8e4fbc2f91f94a27f7cbc1391f3a4591 Mon Sep 17 00:00:00 2001 From: bdew Date: Tue, 17 Dec 2013 09:16:19 +0200 Subject: [PATCH] This doesn't actually work in an obfuscated environment Revert "Hackery to work around compiler not seeing changes to GuiContainer by NEI" This reverts commit c949e02610a547985fcc261767bbb8a090f8dd76. --- src/net/bdew/gendustry/nei/BaseRecipeHandler.scala | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/net/bdew/gendustry/nei/BaseRecipeHandler.scala b/src/net/bdew/gendustry/nei/BaseRecipeHandler.scala index 4255680..36d12c8 100644 --- a/src/net/bdew/gendustry/nei/BaseRecipeHandler.scala +++ b/src/net/bdew/gendustry/nei/BaseRecipeHandler.scala @@ -18,7 +18,6 @@ import net.bdew.gendustry.nei.helpers.RecipeComponent import java.util import net.minecraft.item.ItemStack import codechicken.nei.PositionedStack -import net.minecraft.client.gui.inventory.GuiContainer abstract class BaseRecipeHandler extends TemplateRecipeHandler { val offset: Point @@ -34,16 +33,8 @@ abstract class BaseRecipeHandler extends TemplateRecipeHandler { super.drawExtras(recipe) } - val guiCls = classOf[GuiContainer] - val guiLeftField = guiCls.getField("guiLeft") - val guiTopField = guiCls.getField("guiTop") - - def getGuiOffset(gui: GuiContainer): Point = { - return new Point(guiLeftField.get(gui).asInstanceOf[Int], guiTopField.get(gui).asInstanceOf[Int]) - } - override def mouseClicked(gui: GuiRecipe, button: Int, recipe: Int): Boolean = { - val mrel = new Point(GuiDraw.getMousePosition) - gui.getRecipePosition(recipe) + offset - getGuiOffset(gui) + val mrel = new Point(GuiDraw.getMousePosition) - gui.getRecipePosition(recipe) + offset - ((gui.guiLeft, gui.guiTop)) for (component <- arecipes.get(recipe).asInstanceOf[CachedRecipeWithComponents].components) if (component.rect.contains(mrel) && component.mouseClick(button)) return true super.mouseClicked(gui, button, recipe) @@ -51,7 +42,7 @@ abstract class BaseRecipeHandler extends TemplateRecipeHandler { override def handleTooltip(gui: GuiRecipe, currenttip: util.List[String], recipe: Int) = { import scala.collection.JavaConversions._ - val mrel = new Point(GuiDraw.getMousePosition) - gui.getRecipePosition(recipe) + offset - getGuiOffset(gui) + val mrel = new Point(GuiDraw.getMousePosition) - gui.getRecipePosition(recipe) + offset - ((gui.guiLeft, gui.guiTop)) for (component <- arecipes.get(recipe).asInstanceOf[CachedRecipeWithComponents].components) if (component.rect.contains(mrel)) currenttip.addAll(component.getTooltip) super.handleTooltip(gui, currenttip, recipe)