Fixes Inventory Tab Pixels (#259)

This commit is contained in:
Ranzu authored and GitHub committed 2026-03-02 15:50:23 +01:00
1 parent f3111fed19
commit 4f59ed6ea0
2 files changed
+21

No files matched your search

@@ -45,6 +45,9 @@ public abstract class AbstractTab extends GuiButton {
mc.renderEngine.bindTexture(this.texture); mc.renderEngine.bindTexture(this.texture);
this.drawTexturedModalRect(this.xPosition, yPos, xOffset * 28, yTexPos, 28, ySize); this.drawTexturedModalRect(this.xPosition, yPos, xOffset * 28, yTexPos, 28, ySize);
if (this.enabled) {
this.drawUnselectedTabDecorations(mc, xOffset, yTexPos, yPos, ySize);
}
RenderHelper.enableGUIStandardItemLighting(); RenderHelper.enableGUIStandardItemLighting();
this.zLevel = 100.0F; 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 @Override
public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) { public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) {
boolean inWindow = this.enabled && this.visible boolean inWindow = this.enabled && this.visible
@@ -1,5 +1,6 @@
package tconstruct.client.tabs; package tconstruct.client.tabs;
import net.minecraft.client.Minecraft;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@@ -18,4 +19,18 @@ public class InventoryTabVanilla extends AbstractTab {
public boolean shouldAddToList() { public boolean shouldAddToList() {
return true; 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);
}
} }