From 1c9ea6f8bd7652148f24c1b36aad2877ed072d8c Mon Sep 17 00:00:00 2001
From: DBotThePony <dbotthepony@yandex.ru>
Date: Tue, 9 Jan 2024 13:15:41 +0700
Subject: [PATCH] Revert fluid gauge panel clicking for jei recipes

---
 .../client/screen/widget/FluidGaugePanel.kt   | 35 ++-----------------
 1 file changed, 2 insertions(+), 33 deletions(-)

diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/FluidGaugePanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/FluidGaugePanel.kt
index 854e521f7..cccd7e3ac 100644
--- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/FluidGaugePanel.kt
+++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/widget/FluidGaugePanel.kt
@@ -1,11 +1,8 @@
 package ru.dbotthepony.mc.otm.client.screen.widget
 
-import com.mojang.blaze3d.platform.InputConstants
 import com.mojang.blaze3d.systems.RenderSystem
 import com.mojang.blaze3d.vertex.DefaultVertexFormat
 import com.mojang.blaze3d.vertex.VertexFormat
-import mezz.jei.api.forge.ForgeTypes
-import mezz.jei.api.recipe.RecipeIngredientRole
 import net.minecraft.ChatFormatting
 import net.minecraft.client.gui.screens.Screen
 import net.minecraft.client.renderer.GameRenderer
@@ -16,16 +13,12 @@ import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions
 import net.minecraftforge.fml.ModList
 import org.lwjgl.opengl.GL11
 import ru.dbotthepony.mc.otm.OverdriveThatMatters
-import ru.dbotthepony.mc.otm.client.CursorType
-import ru.dbotthepony.mc.otm.client.render.MGUIGraphics
 import ru.dbotthepony.mc.otm.client.ShiftPressedCond
 import ru.dbotthepony.mc.otm.client.minecraft
+import ru.dbotthepony.mc.otm.client.render.MGUIGraphics
 import ru.dbotthepony.mc.otm.client.render.sprites.MatterySprite
 import ru.dbotthepony.mc.otm.client.render.tesselator
 import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel
-import ru.dbotthepony.mc.otm.client.screen.panels.button.AbstractButtonPanel
-import ru.dbotthepony.mc.otm.compat.jei.JEIPlugin
-import ru.dbotthepony.mc.otm.compat.jei.isJeiLoaded
 import ru.dbotthepony.mc.otm.core.TextComponent
 import ru.dbotthepony.mc.otm.core.TranslatableComponent
 import ru.dbotthepony.mc.otm.core.isNotEmpty
@@ -34,7 +27,6 @@ import ru.dbotthepony.mc.otm.core.math.linearInterpolation
 import ru.dbotthepony.mc.otm.core.registryName
 import ru.dbotthepony.mc.otm.core.util.formatFluidLevel
 import ru.dbotthepony.mc.otm.menu.widget.FluidGaugeWidget
-import kotlin.jvm.optionals.getOrNull
 
 open class FluidGaugePanel<out S : Screen>(
 	screen: S,
@@ -42,7 +34,7 @@ open class FluidGaugePanel<out S : Screen>(
 	val widget: FluidGaugeWidget,
 	x: Float = 0f,
 	y: Float = 0f
-) : AbstractButtonPanel<S>(screen, parent, x, y, width = GAUGE.width, height = GAUGE.height) {
+) : EditablePanel<S>(screen, parent, x, y, width = GAUGE.width, height = GAUGE.height) {
 	init {
 		scissor = true
 	}
@@ -69,29 +61,6 @@ open class FluidGaugePanel<out S : Screen>(
 		return false
 	}
 
-	private fun openFluidRecipes(button: Int) {
-		val ingredient = JEIPlugin.RUNTIME.ingredientManager.createTypedIngredient(ForgeTypes.FLUID_STACK, widget.fluid).getOrNull() ?: return
-
-		if (button == InputConstants.MOUSE_BUTTON_RIGHT) {
-			JEIPlugin.RUNTIME.recipesGui.show(JEIPlugin.RUNTIME.jeiHelpers.focusFactory.createFocus(RecipeIngredientRole.INPUT, ingredient))
-		} else {
-			JEIPlugin.RUNTIME.recipesGui.show(JEIPlugin.RUNTIME.jeiHelpers.focusFactory.createFocus(RecipeIngredientRole.OUTPUT, ingredient))
-		}
-	}
-
-	override val cursorType: CursorType
-		get() = if (isJeiLoaded && widget.fluid.isNotEmpty) CursorType.HAND else CursorType.ARROW
-
-	override fun test(value: Int): Boolean {
-		return (value == InputConstants.MOUSE_BUTTON_RIGHT || value == InputConstants.MOUSE_BUTTON_LEFT) && isJeiLoaded && widget.fluid.isNotEmpty
-	}
-
-	override fun onClick(mouseButton: Int) {
-		if (isJeiLoaded && widget.fluid.isNotEmpty) {
-			openFluidRecipes(mouseButton)
-		}
-	}
-
 	override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
 		if (widget.percentage > 0.01f && widget.fluid.isNotEmpty) {
 			val data = IClientFluidTypeExtensions.of(widget.fluid.fluid)