From 355ee8b80e28323b786ac9875fda4c35ff2ded5e Mon Sep 17 00:00:00 2001 From: Ranzu <66495944+Ranzuu@users.noreply.github.com> Date: Sun, 15 Feb 2026 00:12:12 +0100 Subject: [PATCH 1/4] Optional Nei color localization --- .../nei/RecipeHandlerToolMaterials.java | 33 +++++++++++++++++-- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/src/main/java/tconstruct/plugins/nei/RecipeHandlerToolMaterials.java b/src/main/java/tconstruct/plugins/nei/RecipeHandlerToolMaterials.java index 0b41bca3b4f..aef0cee87d5 100644 --- a/src/main/java/tconstruct/plugins/nei/RecipeHandlerToolMaterials.java +++ b/src/main/java/tconstruct/plugins/nei/RecipeHandlerToolMaterials.java @@ -28,6 +28,23 @@ public class RecipeHandlerToolMaterials extends RecipeHandlerBase { + private static final int DefaultTextColor = 0x404040; + private static final String ColorKey = "tconstruct.nei.color."; + + private static int getLocalizedColor(String colorName, int fallbackColor) { + String colorKey = ColorKey + colorName; + String colorValue = StatCollector.translateToLocal(colorKey); + if (colorKey.equals(colorValue)) { + return fallbackColor; + } + + try { + return Integer.decode(colorValue.trim()); + } catch (NumberFormatException ignored) { + return fallbackColor; + } + } + public class CachedToolMaterialsRecipe extends CachedBaseRecipe { public List toolParts; @@ -151,7 +168,12 @@ public void drawExtras(int recipe) { } int abilityY = 85; if (crecipe.material.reinforced > 0) { - GuiDraw.drawString(getReinforcedString(crecipe.material.reinforced), 35, 85, 0x404040, false); + GuiDraw.drawString( + getReinforcedString(crecipe.material.reinforced), + 35, + 85, + getLocalizedColor("materialReinforced", DefaultTextColor), + false); abilityY += 10; } String ability = crecipe.material.ability(); @@ -161,10 +183,15 @@ public void drawExtras(int recipe) { ability + " (" + Math.abs(crecipe.material.stonebound) + ")", 35, abilityY, - 0x404040, + getLocalizedColor("materialStonebound", DefaultTextColor), false); } else { - GuiDraw.drawString(ability, 35, abilityY, 0x404040, false); + GuiDraw.drawString( + ability, + 35, + abilityY, + getLocalizedColor("materialAbility", DefaultTextColor), + false); } } } From 23bae2b1ba6228f1bb9297ce074c8daea7e73f14 Mon Sep 17 00:00:00 2001 From: Ranzu <66495944+Ranzuu@users.noreply.github.com> Date: Sun, 15 Feb 2026 00:22:05 +0100 Subject: [PATCH 2/4] main material --- .../java/tconstruct/plugins/nei/RecipeHandlerToolMaterials.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/tconstruct/plugins/nei/RecipeHandlerToolMaterials.java b/src/main/java/tconstruct/plugins/nei/RecipeHandlerToolMaterials.java index aef0cee87d5..3575cc55d80 100644 --- a/src/main/java/tconstruct/plugins/nei/RecipeHandlerToolMaterials.java +++ b/src/main/java/tconstruct/plugins/nei/RecipeHandlerToolMaterials.java @@ -116,7 +116,7 @@ public void loadTransferRects() { public void drawExtras(int recipe) { CachedToolMaterialsRecipe crecipe = (CachedToolMaterialsRecipe) this.arecipes.get(recipe); if (crecipe.material != null) { - GuiDraw.drawString(EnumChatFormatting.BOLD + crecipe.material.localizedName(), 35, 10, 0x404040, false); + GuiDraw.drawString(EnumChatFormatting.BOLD + crecipe.material.localizedName(), 35, 10, getLocalizedColor("materialName", DefaultTextColor), false); GuiDraw.drawString( StatCollector.translateToLocal("gui.partcrafter4") + crecipe.material.durability, 35, From bb19e065ff48f870fad55d219a0c6cc8532451ab Mon Sep 17 00:00:00 2001 From: Ranzu <66495944+Ranzuu@users.noreply.github.com> Date: Sun, 15 Feb 2026 00:26:41 +0100 Subject: [PATCH 3/4] spotless ;v --- .../tconstruct/plugins/nei/RecipeHandlerToolMaterials.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/tconstruct/plugins/nei/RecipeHandlerToolMaterials.java b/src/main/java/tconstruct/plugins/nei/RecipeHandlerToolMaterials.java index 3575cc55d80..a27d304f262 100644 --- a/src/main/java/tconstruct/plugins/nei/RecipeHandlerToolMaterials.java +++ b/src/main/java/tconstruct/plugins/nei/RecipeHandlerToolMaterials.java @@ -116,7 +116,12 @@ public void loadTransferRects() { public void drawExtras(int recipe) { CachedToolMaterialsRecipe crecipe = (CachedToolMaterialsRecipe) this.arecipes.get(recipe); if (crecipe.material != null) { - GuiDraw.drawString(EnumChatFormatting.BOLD + crecipe.material.localizedName(), 35, 10, getLocalizedColor("materialName", DefaultTextColor), false); + GuiDraw.drawString( + EnumChatFormatting.BOLD + crecipe.material.localizedName(), + 35, + 10, + getLocalizedColor("materialName", DefaultTextColor), + false); GuiDraw.drawString( StatCollector.translateToLocal("gui.partcrafter4") + crecipe.material.durability, 35, From 47026671575a2420aed11f2af8b9f342b9d1e84a Mon Sep 17 00:00:00 2001 From: Ranzu <66495944+Ranzuu@users.noreply.github.com> Date: Sun, 15 Feb 2026 10:55:03 +0100 Subject: [PATCH 4/4] rest of the colors --- .../nei/RecipeHandlerToolMaterials.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/java/tconstruct/plugins/nei/RecipeHandlerToolMaterials.java b/src/main/java/tconstruct/plugins/nei/RecipeHandlerToolMaterials.java index a27d304f262..397abbc7aa0 100644 --- a/src/main/java/tconstruct/plugins/nei/RecipeHandlerToolMaterials.java +++ b/src/main/java/tconstruct/plugins/nei/RecipeHandlerToolMaterials.java @@ -126,33 +126,33 @@ public void drawExtras(int recipe) { StatCollector.translateToLocal("gui.partcrafter4") + crecipe.material.durability, 35, 20, - 0x404040, + getLocalizedColor("materialDurability", DefaultTextColor), false); GuiDraw.drawString( StatCollector.translateToLocal("gui.partcrafter5") + crecipe.material.handleModifier + "x", 35, 30, - 0x404040, + getLocalizedColor("materialHandleModifier1", DefaultTextColor), false); GuiDraw.drawString( StatCollector.translateToLocal("gui.partcrafter11") + Math.round(crecipe.material.durability * crecipe.material.handleModifier), 35, 40, - 0x404040, + getLocalizedColor("materialHandleModifier2", DefaultTextColor), false); GuiDraw.drawString( StatCollector.translateToLocal("gui.partcrafter6") + crecipe.material.miningspeed / 100F, 35, 50, - 0x404040, + getLocalizedColor("materialMiningSpeed", DefaultTextColor), false); GuiDraw.drawString( StatCollector.translateToLocal("gui.partcrafter7") + HarvestLevels.getHarvestLevelName(crecipe.material.harvestLevel), 35, 60, - 0x404040, + getLocalizedColor("materialHarvestLevel", DefaultTextColor), false); String heart = crecipe.material.attack == 2 ? StatCollector.translateToLocal("gui.partcrafter8") : StatCollector.translateToLocal("gui.partcrafter9"); @@ -161,14 +161,14 @@ public void drawExtras(int recipe) { StatCollector.translateToLocal("gui.partcrafter10") + crecipe.material.attack / 2 + heart, 35, 70, - 0x404040, + getLocalizedColor("materialAttack1", DefaultTextColor), false); } else { GuiDraw.drawString( StatCollector.translateToLocal("gui.partcrafter10") + crecipe.material.attack / 2F + heart, 35, 70, - 0x404040, + getLocalizedColor("materialAttack2", DefaultTextColor), false); } int abilityY = 85; @@ -207,20 +207,20 @@ public void drawExtras(int recipe) { EnumChatFormatting.BOLD + StatCollector.translateToLocal("tconstruct.nei.projectilematerials"), 35, 10, - 0x404040, + getLocalizedColor("materialBow", DefaultTextColor), false); GuiDraw.drawString( StatCollector.translateToLocal("gui.toolstation6") + crecipe.bowMaterial.drawspeed, x, y, - 0x404040, + getLocalizedColor("materialBowDrawSpeed", DefaultTextColor), false); y += 10; GuiDraw.drawString( StatCollector.translateToLocal("gui.toolstation7") + crecipe.bowMaterial.flightSpeedMax, x, y, - 0x404040, + getLocalizedColor("materialBowFlightSpeedMax", DefaultTextColor), false); } if (crecipe.arrowMaterial != null) { @@ -230,14 +230,14 @@ public void drawExtras(int recipe) { StatCollector.translateToLocal("gui.toolstation8") + crecipe.arrowMaterial.mass, x, y, - 0x404040, + getLocalizedColor("materialArrowMass", DefaultTextColor), false); y += 10; GuiDraw.drawString( StatCollector.translateToLocal("gui.toolstation22") + crecipe.arrowMaterial.breakChance, x, y, - 0x404040, + getLocalizedColor("materialArrowBreakChance", DefaultTextColor), false); } }