fix transparent pixel issue in wiki icon screenshitter

This commit is contained in:
George Paton 2025-08-27 13:12:01 +10:00
parent a0451b46a5
commit e5b29e3352

View File

@ -77,7 +77,7 @@ public class GUIScreenWikiRender extends GuiScreen {
try { try {
String slotName = getStackName.apply(preview[index]).replaceAll("§.", "").replaceAll("[^\\w ().-]+", ""); String slotName = getStackName.apply(preview[index]).replaceAll("§.", "").replaceAll("[^\\w ().-]+", "");
if(!slotName.endsWith(".name")) { if(!slotName.endsWith(".name")) {
saveScreenshot(Minecraft.getMinecraft().mcDataDir, saveLocation, prefix + slotName + ".png", zoom, zoom, zoom * 16, zoom * 16, 0xFF8B8B8B); saveScreenshot(Minecraft.getMinecraft().mcDataDir, saveLocation, prefix + slotName + ".png", zoom, zoom, zoom * 16, zoom * 16, 0xFFFF00FF);
} }
} catch (Exception ex) { } catch (Exception ex) {
// Just skip any failures caused by display name or rendering // Just skip any failures caused by display name or rendering
@ -88,24 +88,31 @@ public class GUIScreenWikiRender extends GuiScreen {
protected void drawGuiContainerBackgroundLayer() { protected void drawGuiContainerBackgroundLayer() {
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); {
this.mc.getTextureManager().bindTexture(texture);
ScaledResolution res = new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight); ScaledResolution res = new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight);
GL11.glScaled(scale, scale, scale);
this.drawTexturedModalRect(0, res.getScaledHeight_double() / scale - 18D, 5, 87, 18, 18); int size = 18;
GL11.glPopMatrix(); double y = res.getScaledHeight_double() / scale - 18D;
}
GL11.glScaled(scale, scale, scale);
GL11.glColor4f(1.0F, 0.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_TEXTURE_2D);
public void drawTexturedModalRect(double x, double y, int sourceX, int sourceY, int sizeX, int sizeY) {
double f = 0.00390625D;
double f1 = 0.00390625D;
Tessellator tessellator = Tessellator.instance; Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads(); tessellator.startDrawingQuads();
tessellator.addVertexWithUV((double) (x + 0), (double) (y + sizeY), (double) this.zLevel, (double) ((float) (sourceX + 0) * f), (double) ((float) (sourceY + sizeY) * f1)); tessellator.addVertex((double) 0, (double) y + size, (double) this.zLevel);
tessellator.addVertexWithUV((double) (x + sizeX), (double) (y + sizeY), (double) this.zLevel, (double) ((float) (sourceX + sizeX) * f), (double) ((float) (sourceY + sizeY) * f1)); tessellator.addVertex((double) size, (double) y + size, (double) this.zLevel);
tessellator.addVertexWithUV((double) (x + sizeX), (double) (y + 0), (double) this.zLevel, (double) ((float) (sourceX + sizeX) * f), (double) ((float) (sourceY + 0) * f1)); tessellator.addVertex((double) size, (double) y, (double) this.zLevel);
tessellator.addVertexWithUV((double) (x + 0), (double) (y + 0), (double) this.zLevel, (double) ((float) (sourceX + 0) * f), (double) ((float) (sourceY + 0) * f1)); tessellator.addVertex((double) 0, (double) y, (double) this.zLevel);
tessellator.draw(); tessellator.draw();
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
GL11.glPopMatrix();
} }
protected void drawGuiContainerForegroundLayer(ItemStack preview) { protected void drawGuiContainerForegroundLayer(ItemStack preview) {