diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/Gauges.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/Gauges.kt index e6751c646..fe82ac6a7 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/Gauges.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/Gauges.kt @@ -1,5 +1,6 @@ package ru.dbotthepony.mc.otm.compat.jei +import mezz.jei.api.gui.builder.ITooltipBuilder import net.minecraft.network.chat.Component import ru.dbotthepony.mc.otm.client.render.MGUIGraphics import ru.dbotthepony.mc.otm.client.ShiftPressedCond @@ -37,13 +38,13 @@ fun renderEnergyGauge( PowerGaugePanel.GAUGE_FOREGROUND.renderPartial(guiGraphics, x, y + height * (1f - perc) - 1f, width, height * perc) } -fun matterGaugeTooltips(target: MutableList, matter: Decimal, mouseX: Double, mouseY: Double, x: Float, y: Float, width: Float = MatterGaugePanel.GAUGE_BACKGROUND.width, height: Float = MatterGaugePanel.GAUGE_BACKGROUND.height) { +fun matterGaugeTooltips(target: ITooltipBuilder, matter: Decimal, mouseX: Double, mouseY: Double, x: Float, y: Float, width: Float = MatterGaugePanel.GAUGE_BACKGROUND.width, height: Float = MatterGaugePanel.GAUGE_BACKGROUND.height) { if (mouseX in x .. (x + width - 1) && mouseY in y .. (y + height - 1)) { target.add(TranslatableComponent("otm.gui.matter_panel.matter_required", matter.formatMatter(formatAsReadable = ShiftPressedCond))) } } -fun energyGaugeTooltips(target: MutableList, energy: Decimal, mouseX: Double, mouseY: Double, x: Float, y: Float, width: Float = PowerGaugePanel.GAUGE_BACKGROUND.width, height: Float = PowerGaugePanel.GAUGE_BACKGROUND.height) { +fun energyGaugeTooltips(target: ITooltipBuilder, energy: Decimal, mouseX: Double, mouseY: Double, x: Float, y: Float, width: Float = PowerGaugePanel.GAUGE_BACKGROUND.width, height: Float = PowerGaugePanel.GAUGE_BACKGROUND.height) { if (mouseX in x .. (x + width - 1) && mouseY in y .. (y + height - 1)) { target.add(TranslatableComponent("otm.gui.energy_required", energy.formatPower(formatAsReadable = ShiftPressedCond))) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/MatterEntanglerRecipeCategory.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/MatterEntanglerRecipeCategory.kt index a079ac8f7..132eb418b 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/MatterEntanglerRecipeCategory.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/compat/jei/MatterEntanglerRecipeCategory.kt @@ -1,6 +1,7 @@ package ru.dbotthepony.mc.otm.compat.jei import mezz.jei.api.gui.builder.IRecipeLayoutBuilder +import mezz.jei.api.gui.builder.ITooltipBuilder import mezz.jei.api.gui.drawable.IDrawable import mezz.jei.api.gui.ingredient.IRecipeSlotsView import mezz.jei.api.recipe.IFocusGroup @@ -19,6 +20,9 @@ import ru.dbotthepony.mc.otm.config.MachinesConfig import ru.dbotthepony.mc.otm.core.TranslatableComponent import ru.dbotthepony.mc.otm.core.math.Decimal import ru.dbotthepony.mc.otm.recipe.IMatterEntanglerRecipe +import ru.dbotthepony.mc.otm.recipe.get +import ru.dbotthepony.mc.otm.recipe.height +import ru.dbotthepony.mc.otm.recipe.width import ru.dbotthepony.mc.otm.registry.MItems import ru.dbotthepony.mc.otm.registry.MNames @@ -83,12 +87,8 @@ object MatterEntanglerRecipeCategory : IRecipeCategory, wrap.draw(x = 85f, y = 45f, text = TranslatableComponent("otm.gui.recipe.ticks", recipe.ticks), drawShadow = true) } - override fun getTooltipStrings(recipe: IMatterEntanglerRecipe, recipeSlotsView: IRecipeSlotsView, mouseX: Double, mouseY: Double): MutableList { - val result = ArrayList() - - matterGaugeTooltips(result, recipe.matter, mouseX, mouseY, 13f, 6f) - energyGaugeTooltips(result, MachinesConfig.MATTER_ENTANGLER.energyConsumption * recipe.ticks * MachinesConfig.MATTER_ENTANGLER.workTimeMultiplier, mouseX, mouseY, 4f, 6f) - - return result + override fun getTooltip(tooltip: ITooltipBuilder, recipe: IMatterEntanglerRecipe, recipeSlotsView: IRecipeSlotsView, mouseX: Double, mouseY: Double) { + matterGaugeTooltips(tooltip, recipe.matter, mouseX, mouseY, 13f, 6f) + energyGaugeTooltips(tooltip, MachinesConfig.MATTER_ENTANGLER.energyConsumption * recipe.ticks * MachinesConfig.MATTER_ENTANGLER.workTimeMultiplier, mouseX, mouseY, 4f, 6f) } }