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 c949e02610.
This commit is contained in:
bdew committed 2013-12-17 09:16:19 +02:00
1 parent 3d7ef9fa46
commit 353839ac8e
1 file changed
+2 -11
@@ -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)