Files
2019-02-24 22:29:41 +08:00

40 lines
3.0 KiB
Diff

--- ../src-base/minecraft/net/minecraft/client/gui/GuiSlot.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiSlot.java
@@ -181,15 +181,8 @@
GlStateManager.disableFog();
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferbuilder = tessellator.getBuffer();
- this.mc.getTextureManager().bindTexture(Gui.OPTIONS_BACKGROUND);
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- float f = 32.0F;
- bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
- bufferbuilder.pos((double)this.left, (double)this.bottom, 0.0D).tex((double)((float)this.left / 32.0F), (double)((float)(this.bottom + (int)this.amountScrolled) / 32.0F)).color(32, 32, 32, 255).endVertex();
- bufferbuilder.pos((double)this.right, (double)this.bottom, 0.0D).tex((double)((float)this.right / 32.0F), (double)((float)(this.bottom + (int)this.amountScrolled) / 32.0F)).color(32, 32, 32, 255).endVertex();
- bufferbuilder.pos((double)this.right, (double)this.top, 0.0D).tex((double)((float)this.right / 32.0F), (double)((float)(this.top + (int)this.amountScrolled) / 32.0F)).color(32, 32, 32, 255).endVertex();
- bufferbuilder.pos((double)this.left, (double)this.top, 0.0D).tex((double)((float)this.left / 32.0F), (double)((float)(this.top + (int)this.amountScrolled) / 32.0F)).color(32, 32, 32, 255).endVertex();
- tessellator.draw();
+ // Forge: background rendering moved into separate method.
+ this.drawContainerBackground(tessellator);
int k = this.left + this.width / 2 - this.getListWidth() / 2 + 2;
int l = this.top + 4 - (int)this.amountScrolled;
@@ -458,4 +451,18 @@
{
return this.slotHeight;
}
+
+ protected void drawContainerBackground(Tessellator tessellator)
+ {
+ BufferBuilder buffer = tessellator.getBuffer();
+ this.mc.getTextureManager().bindTexture(Gui.OPTIONS_BACKGROUND);
+ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
+ float f = 32.0F;
+ buffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
+ buffer.pos((double)this.left, (double)this.bottom, 0.0D).tex((double)((float)this.left / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
+ buffer.pos((double)this.right, (double)this.bottom, 0.0D).tex((double)((float)this.right / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
+ buffer.pos((double)this.right, (double)this.top, 0.0D).tex((double)((float)this.right / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
+ buffer.pos((double)this.left, (double)this.top, 0.0D).tex((double)((float)this.left / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
+ tessellator.draw();
+ }
}