From 9939f99588144210aec2d360d37acef88daa0431 Mon Sep 17 00:00:00 2001 From: tier940 Date: Sun, 4 Jan 2026 14:01:28 +0900 Subject: [PATCH 1/2] Fix DEDA JEI display --- .../github/gtexpert/core/api/util/GTELog.java | 4 +- .../recipemaps/RecipeMapDraconicUpgrade.java | 11 --- .../tierup/TierUpRecipeProperty.java | 9 ++- .../upgrade/UpgradeRecipeProperty.java | 9 ++- .../mixins/gregtech/GTRecipeWrapperMixin.java | 73 +++++++++++++++++++ .../resources/mixins.gtexpert.gregtech.json | 1 + 6 files changed, 90 insertions(+), 17 deletions(-) create mode 100644 src/main/java/com/github/gtexpert/core/mixins/gregtech/GTRecipeWrapperMixin.java diff --git a/src/main/java/com/github/gtexpert/core/api/util/GTELog.java b/src/main/java/com/github/gtexpert/core/api/util/GTELog.java index 4b4b6453..8311999e 100644 --- a/src/main/java/com/github/gtexpert/core/api/util/GTELog.java +++ b/src/main/java/com/github/gtexpert/core/api/util/GTELog.java @@ -3,11 +3,11 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import com.github.gtexpert.core.api.GTEValues; +import com.github.gtexpert.core.Tags; public class GTELog { private GTELog() {} - public static Logger logger = LogManager.getLogger(GTEValues.MODNAME); + public static Logger logger = LogManager.getLogger(Tags.MODNAME); } diff --git a/src/main/java/com/github/gtexpert/core/integration/deda/recipemaps/RecipeMapDraconicUpgrade.java b/src/main/java/com/github/gtexpert/core/integration/deda/recipemaps/RecipeMapDraconicUpgrade.java index f437f39a..69b0d6f0 100644 --- a/src/main/java/com/github/gtexpert/core/integration/deda/recipemaps/RecipeMapDraconicUpgrade.java +++ b/src/main/java/com/github/gtexpert/core/integration/deda/recipemaps/RecipeMapDraconicUpgrade.java @@ -2,7 +2,6 @@ import org.jetbrains.annotations.NotNull; -import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeBuilder; import gregtech.api.recipes.RecipeMap; @@ -12,14 +11,4 @@ public RecipeMapDraconicUpgrade(@NotNull String unlocalizedName, int maxInputs, int maxFluidOutputs, @NotNull R defaultRecipeBuilder, boolean isHidden) { super(unlocalizedName, maxInputs, maxOutputs, maxFluidInputs, maxFluidOutputs, defaultRecipeBuilder, isHidden); } - - @Override - public int getPropertyHeightShift() { - return super.getPropertyHeightShift() + 10; - } - - @Override - public int getPropertyListHeight(Recipe recipe) { - return super.getPropertyListHeight(recipe) + 10; - } } diff --git a/src/main/java/com/github/gtexpert/core/integration/deda/recipemaps/tierup/TierUpRecipeProperty.java b/src/main/java/com/github/gtexpert/core/integration/deda/recipemaps/tierup/TierUpRecipeProperty.java index 9f2d7daa..e2215e47 100644 --- a/src/main/java/com/github/gtexpert/core/integration/deda/recipemaps/tierup/TierUpRecipeProperty.java +++ b/src/main/java/com/github/gtexpert/core/integration/deda/recipemaps/tierup/TierUpRecipeProperty.java @@ -25,8 +25,13 @@ public static TierUpRecipeProperty getInstance() { @Override public void drawInfo(Minecraft minecraft, int x, int y, int color, Object value) { - minecraft.fontRenderer.drawString(I18n.format("recipemap.draconic_fusion_tier_up.property.1"), x, y, color); - minecraft.fontRenderer.drawString(I18n.format("recipemap.draconic_fusion_tier_up.property.2"), x, y + 10, + minecraft.fontRenderer.drawString(I18n.format("recipemap.draconic_fusion_tier_up.property.1"), x, y - 10, color); + minecraft.fontRenderer.drawString(I18n.format("recipemap.draconic_fusion_tier_up.property.2"), x, y, color); + } + + @Override + public int getInfoHeight(Object value) { + return 20; } } diff --git a/src/main/java/com/github/gtexpert/core/integration/deda/recipemaps/upgrade/UpgradeRecipeProperty.java b/src/main/java/com/github/gtexpert/core/integration/deda/recipemaps/upgrade/UpgradeRecipeProperty.java index fcd25e69..9d27c63c 100644 --- a/src/main/java/com/github/gtexpert/core/integration/deda/recipemaps/upgrade/UpgradeRecipeProperty.java +++ b/src/main/java/com/github/gtexpert/core/integration/deda/recipemaps/upgrade/UpgradeRecipeProperty.java @@ -25,8 +25,13 @@ public static UpgradeRecipeProperty getInstance() { @Override public void drawInfo(Minecraft minecraft, int x, int y, int color, Object value) { - minecraft.fontRenderer.drawString(I18n.format("recipemap.draconic_fusion_upgrade.property.1"), x, y, color); - minecraft.fontRenderer.drawString(I18n.format("recipemap.draconic_fusion_upgrade.property.2"), x, y + 10, + minecraft.fontRenderer.drawString(I18n.format("recipemap.draconic_fusion_upgrade.property.1"), x, y - 10, color); + minecraft.fontRenderer.drawString(I18n.format("recipemap.draconic_fusion_upgrade.property.2"), x, y, color); + } + + @Override + public int getInfoHeight(Object value) { + return 20; } } diff --git a/src/main/java/com/github/gtexpert/core/mixins/gregtech/GTRecipeWrapperMixin.java b/src/main/java/com/github/gtexpert/core/mixins/gregtech/GTRecipeWrapperMixin.java new file mode 100644 index 00000000..fe20c19a --- /dev/null +++ b/src/main/java/com/github/gtexpert/core/mixins/gregtech/GTRecipeWrapperMixin.java @@ -0,0 +1,73 @@ +package com.github.gtexpert.core.mixins.gregtech; + +import java.util.Map; + +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyVariable; + +import gregtech.api.recipes.Recipe; +import gregtech.api.recipes.RecipeMap; +import gregtech.api.recipes.recipeproperties.RecipeProperty; +import gregtech.integration.jei.recipe.GTRecipeWrapper; + +import com.github.gtexpert.core.integration.deda.recipemaps.GTEDraconicRecipeMaps; + +@Mixin(value = GTRecipeWrapper.class, remap = false) +public class GTRecipeWrapperMixin { + + @Shadow + @Final + private RecipeMap recipeMap; + + @Shadow + @Final + private Recipe recipe; + + /** + * Modify yPosition calculation to use actual getInfoHeight() values instead of assuming 10px per property. + * Only applies to DEDA recipe maps where properties have custom heights. + * Original: recipeHeight - ((recipe.getUnhiddenPropertyCount() + defaultLines) * 10 - 3) + * Fixed: recipeHeight - (sumOfPropertyHeights + defaultLines * 10 - 3) + */ + @ModifyVariable(method = "drawInfo", at = @At(value = "STORE"), ordinal = 5) + private int gteCore$fixYPosition(int original) { + // Only apply fix for DEDA recipe maps + if (recipeMap != GTEDraconicRecipeMaps.DRACONIC_FUSION_TIER_UP_RECIPES && + recipeMap != GTEDraconicRecipeMaps.DRACONIC_FUSION_UPGRADE_RECIPES) { + return original; + } + + // Calculate defaultLines the same way as the original method + var properties = recipe.getPropertyTypes(); + boolean drawTotalEU = properties.isEmpty() || + properties.stream().noneMatch(RecipeProperty::hideTotalEU); + boolean drawEUt = properties.isEmpty() || + properties.stream().noneMatch(RecipeProperty::hideEUt); + boolean drawDuration = properties.isEmpty() || + properties.stream().noneMatch(RecipeProperty::hideDuration); + + int defaultLines = 0; + if (drawTotalEU) defaultLines++; + if (drawEUt) defaultLines++; + if (drawDuration) defaultLines++; + + // Reconstruct recipeHeight from original calculation: + // original = recipeHeight - ((propertyCount + defaultLines) * 10 - 3) + int propertyCount = recipe.getUnhiddenPropertyCount(); + int originalOffset = (propertyCount + defaultLines) * 10 - 3; + int recipeHeight = original + originalOffset; + + // Calculate actual property height from getInfoHeight values + int actualPropertyHeight = 0; + for (Map.Entry, Object> entry : recipe.getPropertyValues()) { + if (!entry.getKey().isHidden()) { + actualPropertyHeight += entry.getKey().getInfoHeight(entry.getValue()); + } + } + + return recipeHeight - (actualPropertyHeight + defaultLines * 10 - 3); + } +} diff --git a/src/main/resources/mixins.gtexpert.gregtech.json b/src/main/resources/mixins.gtexpert.gregtech.json index 8b2955bc..c5f05f30 100644 --- a/src/main/resources/mixins.gtexpert.gregtech.json +++ b/src/main/resources/mixins.gtexpert.gregtech.json @@ -10,5 +10,6 @@ "server": [ ], "client": [ + "GTRecipeWrapperMixin" ] } From 6b555cc54c8d274c44bb69548673c2823dee8535 Mon Sep 17 00:00:00 2001 From: tier940 Date: Sun, 4 Jan 2026 14:02:49 +0900 Subject: [PATCH 2/2] Update CHANGELOG --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9dfb159d..3b6c47bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 2.6.1 +- Fix DEDA JEI display [#345](https://github.com/GTModpackTeam/GTExpert-Core/pull/345) + +* * * + # 2.6.0 - Mining Level and Tool Suitability Adjustments for Blocks Added via Chisel [#343](https://github.com/GTModpackTeam/GTExpert-Core/pull/343) - DEDA Integration Refactoring [#344](https://github.com/GTModpackTeam/GTExpert-Core/pull/344)