Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/github/gtexpert/core/api/util/GTELog.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import org.jetbrains.annotations.NotNull;

import gregtech.api.recipes.Recipe;
import gregtech.api.recipes.RecipeBuilder;
import gregtech.api.recipes.RecipeMap;

Expand All @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
@@ -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<RecipeProperty<?>, Object> entry : recipe.getPropertyValues()) {
if (!entry.getKey().isHidden()) {
actualPropertyHeight += entry.getKey().getInfoHeight(entry.getValue());
}
}

return recipeHeight - (actualPropertyHeight + defaultLines * 10 - 3);
}
}
1 change: 1 addition & 0 deletions src/main/resources/mixins.gtexpert.gregtech.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"server": [
],
"client": [
"GTRecipeWrapperMixin"
]
}