import com.irtimaled.bbor.common.MathHelper;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawableHelper;
+import net.minecraft.client.util.math.MatrixStack;
import java.util.ArrayList;
import java.util.List;
return true;
}
- public void render(int mouseX, int mouseY) {
+ public void render(MatrixStack matrixStack, int mouseX, int mouseY) {
this.amountScrolled = MathHelper.clamp(this.amountScrolled, 0.0D, this.getMaxScroll());
RenderHelper.disableLighting();
int listTop = this.top + PADDING - (int) this.amountScrolled;
- drawEntries(mouseX, mouseY, listTop);
+ drawEntries(matrixStack, mouseX, mouseY, listTop);
+
+ RenderHelper.enableDepthTest();
+ RenderHelper.depthFuncAlways();
- RenderHelper.disableDepthTest();
this.overlayBackground(0, this.top);
this.overlayBackground(this.bottom, this.height);
+ RenderHelper.depthFuncLessEqual();
+ RenderHelper.disableDepthTest();
RenderHelper.enableBlend();
RenderHelper.blendFuncGui();
RenderHelper.disableAlphaTest();
}
private void drawListBackground() {
- this.minecraft.getTextureManager().bindTexture(DrawableHelper.BACKGROUND_LOCATION);
+ this.minecraft.getTextureManager().bindTexture(DrawableHelper.OPTIONS_BACKGROUND_TEXTURE);
Renderer.startTextured()
.setColor(32, 32, 32)
.setAlpha(255)
.render();
}
- private void drawEntries(int mouseX, int mouseY, int top) {
+ private void drawEntries(MatrixStack matrixStack, int mouseX, int mouseY, int top) {
for (ControlListEntry entry : this.entries) {
if (!entry.isVisible()) continue;
entry.setY(top);
int height = entry.getControlHeight();
- drawEntry(mouseX, mouseY, top, entry, height);
- top += height;
+ int bottom = top + height;
+ if(top <= this.bottom && bottom >= this.top) {
+ drawEntry(matrixStack, mouseX, mouseY, top, entry, height);
+ }
+ top = bottom;
}
}
- protected void drawEntry(int mouseX, int mouseY, int top, ControlListEntry entry, int height) {
- entry.render(mouseX, mouseY);
+ protected void drawEntry(MatrixStack matrixStack, int mouseX, int mouseY, int top, ControlListEntry entry, int height) {
+ entry.render(matrixStack, mouseX, mouseY);
}
private void overlayBackground(int top, int bottom) {
- this.minecraft.getTextureManager().bindTexture(DrawableHelper.BACKGROUND_LOCATION);
+ this.minecraft.getTextureManager().bindTexture(DrawableHelper.OPTIONS_BACKGROUND_TEXTURE);
Renderer.startTextured()
.setColor(64, 64, 64)
.setAlpha(255)
- .addPoint(0, bottom, 0.0D, 0.0D, (float) bottom / 32.0F)
- .addPoint(this.width, bottom, 0.0D, (float) this.width / 32.0F, (float) bottom / 32.0F)
- .addPoint(this.width, top, 0.0D, (float) this.width / 32.0F, (float) top / 32.0F)
- .addPoint(0, top, 0.0D, 0.0D, (float) top / 32.0F)
+ .addPoint(0, bottom, -100.0D, 0.0D, (float) bottom / 32.0F)
+ .addPoint(this.width, bottom, -100.0D, (float) this.width / 32.0F, (float) bottom / 32.0F)
+ .addPoint(this.width, top, -100.0D, (float) this.width / 32.0F, (float) top / 32.0F)
+ .addPoint(0, top, -100.0D, 0.0D, (float) top / 32.0F)
.render();
}