From a59ee11285af3d58ad9c5854a8d8b013e1f4c88c Mon Sep 17 00:00:00 2001 From: PLASMAchicken Date: Tue, 3 Feb 2026 19:47:56 +0100 Subject: [PATCH 1/6] Implement null check in drawToolStats (#251) --- src/main/java/tconstruct/tools/gui/CraftingStationGui.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/tconstruct/tools/gui/CraftingStationGui.java b/src/main/java/tconstruct/tools/gui/CraftingStationGui.java index 8a750ec1..2cb4928d 100644 --- a/src/main/java/tconstruct/tools/gui/CraftingStationGui.java +++ b/src/main/java/tconstruct/tools/gui/CraftingStationGui.java @@ -164,6 +164,8 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler { } void drawToolStats(ItemStack stack) { + if (stack == null) return; + if (stack.getItem() instanceof IModifyable) ToolStationGuiHelper.drawToolStats(stack, descTextLeft + 10, 0); int matID = PatternBuilder.instance.getPartID(stack); From 1755470299a471b54f6d641126218f233d8a7423 Mon Sep 17 00:00:00 2001 From: loenaaaa Date: Wed, 4 Feb 2026 10:24:18 +0800 Subject: [PATCH 2/6] Fix tool forge voiding items bug/desync (#244) Co-authored-by: Martin Robertz Co-authored-by: Nikolay S. --- .../tconstruct/tools/inventory/ToolStationContainer.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/tconstruct/tools/inventory/ToolStationContainer.java b/src/main/java/tconstruct/tools/inventory/ToolStationContainer.java index 723b5014..56070615 100644 --- a/src/main/java/tconstruct/tools/inventory/ToolStationContainer.java +++ b/src/main/java/tconstruct/tools/inventory/ToolStationContainer.java @@ -198,4 +198,13 @@ public class ToolStationContainer extends ActiveContainer { return failedToMerge; } + + @Override + public ItemStack slotClick(int slotId, int clickedButton, int mode, EntityPlayer player) { + ItemStack output = super.slotClick(slotId, clickedButton, mode, player); + if (slotId > 0) { + this.logic.buildTool(this.logic.toolName); + } + return output; + } } From 345965f4d06e6d6675827340e2044b678719e0fe Mon Sep 17 00:00:00 2001 From: "Nikolay S." Date: Tue, 3 Feb 2026 20:27:11 -0600 Subject: [PATCH 3/6] Don't use a regex in Tool Station (#253) --- src/main/java/tconstruct/tools/gui/ToolStationGui.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/tconstruct/tools/gui/ToolStationGui.java b/src/main/java/tconstruct/tools/gui/ToolStationGui.java index b3145527..d4840abd 100644 --- a/src/main/java/tconstruct/tools/gui/ToolStationGui.java +++ b/src/main/java/tconstruct/tools/gui/ToolStationGui.java @@ -112,7 +112,7 @@ public class ToolStationGui extends GuiContainer implements INEIGuiHandler { iconX = element.iconsX; iconY = element.iconsY; title = "§n" + StatCollector.translateToLocal(element.title); - body = StatCollector.translateToLocal(element.body).replaceAll("\\\\n", "\n"); + body = StatCollector.translateToLocal(element.body).replace("\\n", "\n"); } protected void setSlotType(int type) { From f3111fed19f8d4d0a4e507ee16992b9d82ae7648 Mon Sep 17 00:00:00 2001 From: MCTBL <30978504+MCTBL@users.noreply.github.com> Date: Thu, 19 Feb 2026 00:36:15 +0800 Subject: [PATCH 4/6] fix the shift left click transfer function in Stencil Table (#255) --- .../inventory/PatternShaperContainer.java | 41 +++++++++++++++---- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/src/main/java/tconstruct/tools/inventory/PatternShaperContainer.java b/src/main/java/tconstruct/tools/inventory/PatternShaperContainer.java index 062b9fb2..d28e51df 100644 --- a/src/main/java/tconstruct/tools/inventory/PatternShaperContainer.java +++ b/src/main/java/tconstruct/tools/inventory/PatternShaperContainer.java @@ -15,6 +15,8 @@ public class PatternShaperContainer extends Container { public StencilTableLogic logic; + public static ItemStack BLANK_PATTERN = new ItemStack(TinkerTools.blankPattern, 1, 0); + public PatternShaperContainer(InventoryPlayer inventoryplayer, StencilTableLogic shaper) { logic = shaper; this.addSlotToContainer(new Slot(shaper, 0, 48, 35)); @@ -58,13 +60,36 @@ public class PatternShaperContainer extends Container { @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { return null; - /* - * ItemStack stack = null; Slot slot = (Slot)this.inventorySlots.get(slotID); if (slot != null && - * slot.getHasStack()) { ItemStack slotStack = slot.getStack(); stack = slotStack.copy(); if (slotID < - * logic.getSizeInventory()) { if (!this.mergeItemStack(slotStack, logic.getSizeInventory(), - * this.inventorySlots.size(), true)) { return null; } } else if (!this.mergeItemStack(slotStack, 0, - * logic.getSizeInventory()-1, false)) { return null; } if (slotStack.stackSize == 0) { - * slot.putStack((ItemStack)null); } else { slot.onSlotChanged(); } } return stack; - */ + } + + @Override + public ItemStack slotClick(int slotId, int clickedButton, int mode, EntityPlayer player) { + if (mode == 1 && clickedButton == 0) { + // is it shift left click? + Slot slot = (Slot) this.inventorySlots.get(slotId); + if (slot != null && slot.getHasStack()) { + ItemStack stack = slot.getStack(); + if (slotId >= logic.getSizeInventory() && stack.isItemEqual(BLANK_PATTERN)) { + // clicked in player inventory + if (!this.mergeItemStack(stack, 0, 1, false)) { + return null; + } + } else if (slotId < logic.getSizeInventory()) { + // pattern slot + if (!this.mergeItemStack(stack, 2, this.inventorySlots.size(), false)) { + return null; + } else if (slotId == 1) { + // special for shift click the output pattern + this.inventorySlots.get(0).decrStackSize(1); + } + } + if (stack.stackSize == 0) { + slot.putStack((ItemStack) null); + } else { + slot.onSlotChanged(); + } + } + } + return super.slotClick(slotId, clickedButton, mode, player); } } From 4f59ed6ea0b43f2741bada61587146467780c566 Mon Sep 17 00:00:00 2001 From: Ranzu <66495944+Ranzuu@users.noreply.github.com> Date: Mon, 2 Mar 2026 15:50:23 +0100 Subject: [PATCH 5/6] Fixes Inventory Tab Pixels (#259) --- .../java/tconstruct/client/tabs/AbstractTab.java | 6 ++++++ .../client/tabs/InventoryTabVanilla.java | 15 +++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/main/java/tconstruct/client/tabs/AbstractTab.java b/src/main/java/tconstruct/client/tabs/AbstractTab.java index 2b5fbdbf..6f1e2939 100644 --- a/src/main/java/tconstruct/client/tabs/AbstractTab.java +++ b/src/main/java/tconstruct/client/tabs/AbstractTab.java @@ -45,6 +45,9 @@ public abstract class AbstractTab extends GuiButton { mc.renderEngine.bindTexture(this.texture); this.drawTexturedModalRect(this.xPosition, yPos, xOffset * 28, yTexPos, 28, ySize); + if (this.enabled) { + this.drawUnselectedTabDecorations(mc, xOffset, yTexPos, yPos, ySize); + } RenderHelper.enableGUIStandardItemLighting(); this.zLevel = 100.0F; @@ -69,6 +72,9 @@ public abstract class AbstractTab extends GuiButton { } } + protected void drawUnselectedTabDecorations(Minecraft mc, int textureXOffset, int textureYStart, int tabTopY, + int tabHeight) {} + @Override public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) { boolean inWindow = this.enabled && this.visible diff --git a/src/main/java/tconstruct/client/tabs/InventoryTabVanilla.java b/src/main/java/tconstruct/client/tabs/InventoryTabVanilla.java index 699e2b0c..dbfa85ef 100644 --- a/src/main/java/tconstruct/client/tabs/InventoryTabVanilla.java +++ b/src/main/java/tconstruct/client/tabs/InventoryTabVanilla.java @@ -1,5 +1,6 @@ package tconstruct.client.tabs; +import net.minecraft.client.Minecraft; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; @@ -18,4 +19,18 @@ public class InventoryTabVanilla extends AbstractTab { public boolean shouldAddToList() { return true; } + + @Override + protected void drawUnselectedTabDecorations(Minecraft mc, int textureXOffset, int textureYStart, int tabTopY, + int tabHeight) { + int textureX = textureXOffset * 28; + int sourceY = 29; + int targetY = tabTopY + tabHeight; + + // Extend the bottom-left corner on the unselected vanilla tab. + // 0,29 -> two extra pixels down; 1,29 -> one extra pixel down. + this.drawTexturedModalRect(this.xPosition, targetY, textureX, sourceY, 1, 1); + this.drawTexturedModalRect(this.xPosition, targetY + 1, textureX, sourceY, 1, 1); + this.drawTexturedModalRect(this.xPosition + 1, targetY, textureX + 1, sourceY, 1, 1); + } } From 848ba01de49fa630008aa0c08775fd445cdadae9 Mon Sep 17 00:00:00 2001 From: Ranzu <66495944+Ranzuu@users.noreply.github.com> Date: Tue, 3 Mar 2026 04:36:43 +0100 Subject: [PATCH 6/6] Added optional Nei color localization (#254) Co-authored-by: UltraProdigy <187078471+UltraProdigy@users.noreply.github.com> --- .../nei/RecipeHandlerToolMaterials.java | 64 ++++++++++++++----- 1 file changed, 48 insertions(+), 16 deletions(-) diff --git a/src/main/java/tconstruct/plugins/nei/RecipeHandlerToolMaterials.java b/src/main/java/tconstruct/plugins/nei/RecipeHandlerToolMaterials.java index 0b41bca3..397abbc7 100644 --- a/src/main/java/tconstruct/plugins/nei/RecipeHandlerToolMaterials.java +++ b/src/main/java/tconstruct/plugins/nei/RecipeHandlerToolMaterials.java @@ -28,6 +28,23 @@ import tconstruct.util.config.PHConstruct; 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; @@ -99,38 +116,43 @@ public class RecipeHandlerToolMaterials extends RecipeHandlerBase { 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, 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"); @@ -139,19 +161,24 @@ public class RecipeHandlerToolMaterials extends RecipeHandlerBase { 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; 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 +188,15 @@ public class RecipeHandlerToolMaterials extends RecipeHandlerBase { 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); } } } @@ -175,20 +207,20 @@ public class RecipeHandlerToolMaterials extends RecipeHandlerBase { 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) { @@ -198,14 +230,14 @@ public class RecipeHandlerToolMaterials extends RecipeHandlerBase { 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); } }