import com.irtimaled.bbor.client.renderers.RenderHelper;
import com.irtimaled.bbor.client.renderers.Renderer;
import com.irtimaled.bbor.common.MathHelper;
+import com.mojang.blaze3d.platform.GlStateManager;
+import com.mojang.blaze3d.systems.RenderSystem;
+import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawableHelper;
+import net.minecraft.client.render.BufferBuilder;
+import net.minecraft.client.render.GameRenderer;
+import net.minecraft.client.render.Tessellator;
+import net.minecraft.client.render.VertexFormat;
+import net.minecraft.client.render.VertexFormats;
import net.minecraft.client.util.math.MatrixStack;
import java.util.ArrayList;
public void render(MatrixStack matrixStack, int mouseX, int mouseY) {
this.amountScrolled = MathHelper.clamp(this.amountScrolled, 0.0D, this.getMaxScroll());
- RenderHelper.disableLighting();
- // RenderHelper.disableFog();
- if (!transparentBackground) drawListBackground();
-
int listTop = this.top + PADDING - (int) this.amountScrolled;
drawEntries(matrixStack, mouseX, mouseY, listTop);
RenderHelper.disableDepthTest();
RenderHelper.enableBlend();
RenderHelper.blendFuncGui();
- RenderHelper.disableAlphaTest();
- RenderHelper.shadeModelSmooth();
+ // RenderHelper.shadeModelSmooth();
RenderHelper.disableTexture();
drawOverlayShadows();
}
RenderHelper.enableTexture();
- RenderHelper.shadeModelFlat();
- RenderHelper.enableAlphaTest();
+ // RenderHelper.shadeModelFlat();
RenderHelper.disableBlend();
}
- private void drawListBackground() {
- RenderHelper.setTexture(DrawableHelper.OPTIONS_BACKGROUND_TEXTURE);
+ private void drawListBackground(MatrixStack matrixStack) {
+ MinecraftClient.getInstance().getTextureManager().bindTexture(DrawableHelper.OPTIONS_BACKGROUND_TEXTURE);
Renderer.startTextured()
+ .setMatrixStack(matrixStack)
.setColor(32, 32, 32)
.setAlpha(255)
.addPoint(0, this.bottom, 0.0D, (float) 0 / 32.0F, (float) (this.bottom + (int) this.amountScrolled) / 32.0F)
}
private void overlayBackground(int top, int bottom) {
- RenderHelper.setTexture(DrawableHelper.OPTIONS_BACKGROUND_TEXTURE);
- Renderer.startTextured()
- .setColor(64, 64, 64)
- .setAlpha(255)
- .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();
+ Tessellator tessellator = Tessellator.getInstance();
+ BufferBuilder bufferBuilder = tessellator.getBuffer();
+ RenderSystem.setShader(GameRenderer::getPositionTexColorShader);
+ RenderSystem.setShaderTexture(0, DrawableHelper.OPTIONS_BACKGROUND_TEXTURE);
+
+ bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE_COLOR);
+ bufferBuilder
+ .vertex(0, bottom, -100.0D)
+ .texture(0.0F, (float) bottom / 32.0F)
+ .color(64, 64, 64, 255)
+ .next();
+ bufferBuilder
+ .vertex(this.width, bottom, -100.0D)
+ .texture((float) this.width / 32.0F, (float) bottom / 32.0F)
+ .color(64, 64, 64, 255)
+ .next();
+ bufferBuilder
+ .vertex(this.width, top, -100.0D)
+ .texture((float) this.width / 32.0F, (float) top / 32.0F)
+ .color(64, 64, 64, 255)
+ .next();
+ bufferBuilder
+ .vertex(0, top, -100.0D)
+ .texture(0.0f, (float) top / 32.0F)
+ .color(64, 64, 64, 255)
+ .next();
+ tessellator.draw();
}
private void drawScrollBar(int maxScroll) {
scrollBarTop = this.top;
}
- Renderer.startTextured()
- .setAlpha(255)
- .addPoint(this.scrollBarLeft, this.bottom, 0.0D, 0.0D, 1.0D)
- .addPoint(this.width, this.bottom, 0.0D, 1.0D, 1.0D)
- .addPoint(this.width, this.top, 0.0D, 1.0D, 0.0D)
- .addPoint(this.scrollBarLeft, this.top, 0.0D, 0.0D, 0.0D)
- .render();
+ Tessellator tessellator = Tessellator.getInstance();
+ BufferBuilder bufferBuilder = tessellator.getBuffer();
+ RenderSystem.disableTexture();
+ RenderSystem.setShader(GameRenderer::getPositionColorShader);
- Renderer.startTextured()
- .setColor(128, 128, 128)
- .setAlpha(255)
- .addPoint(this.scrollBarLeft, scrollBarTop + scrollBarHeight, 0.0D, 0.0D, 1.0D)
- .addPoint(this.width, scrollBarTop + scrollBarHeight, 0.0D, 1.0D, 1.0D)
- .addPoint(this.width, scrollBarTop, 0.0D, 1.0D, 0.0D)
- .addPoint(this.scrollBarLeft, scrollBarTop, 0.0D, 0.0D, 0.0D)
- .render();
+ bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
- Renderer.startTextured()
- .setColor(192, 192, 192)
- .setAlpha(255)
- .addPoint(this.scrollBarLeft, scrollBarTop + scrollBarHeight - 1, 0.0D, 0.0D, 1.0D)
- .addPoint(this.width - 1, scrollBarTop + scrollBarHeight - 1, 0.0D, 1.0D, 1.0D)
- .addPoint(this.width - 1, scrollBarTop, 0.0D, 1.0D, 0.0D)
- .addPoint(this.scrollBarLeft, scrollBarTop, 0.0D, 0.0D, 0.0D)
- .render();
+ bufferBuilder.vertex(this.scrollBarLeft, this.bottom, 0.0D).color(0, 0, 0, 255).next();
+ bufferBuilder.vertex(this.width, this.bottom, 0.0D).color(0, 0, 0, 255).next();
+ bufferBuilder.vertex(this.width, this.top, 0.0D).color(0, 0, 0, 255).next();
+ bufferBuilder.vertex(this.scrollBarLeft, this.top, 0.0D).color(0, 0, 0, 255).next();
+
+ bufferBuilder.vertex(this.scrollBarLeft, scrollBarTop + scrollBarHeight, 0.0D).color(128, 128, 128, 255).next();
+ bufferBuilder.vertex(this.width, scrollBarTop + scrollBarHeight, 0.0D).color(128, 128, 128, 255).next();
+ bufferBuilder.vertex(this.width, scrollBarTop, 0.0D).color(128, 128, 128, 255).next();
+ bufferBuilder.vertex(this.scrollBarLeft, scrollBarTop, 0.0D).color(128, 128, 128, 255).next();
+
+ bufferBuilder.vertex(this.scrollBarLeft, scrollBarTop + scrollBarHeight - 1, 0.0D).color(192, 192, 192, 255).next();
+ bufferBuilder.vertex(this.width - 1, scrollBarTop + scrollBarHeight - 1, 0.0D).color(192, 192, 192, 255).next();
+ bufferBuilder.vertex(this.width - 1, scrollBarTop, 0.0D).color(192, 192, 192, 255).next();
+ bufferBuilder.vertex(this.scrollBarLeft, scrollBarTop, 0.0D).color(192, 192, 192, 255).next();
+
+ tessellator.draw();
+ RenderSystem.enableTexture();
}
private void drawOverlayShadows() {
- Renderer.startTextured()
- .addPoint(0, this.top + 4, 0.0D, 0.0D, 1.0D)
- .addPoint(this.width, this.top + 4, 0.0D, 1.0D, 1.0D)
- .setAlpha(255)
- .addPoint(this.width, this.top, 0.0D, 1.0D, 0.0D)
- .addPoint(0, this.top, 0.0D, 0.0D, 0.0D)
- .render();
- Renderer.startTextured()
- .addPoint(this.width, this.bottom - 4, 0.0D, 1.0D, 0.0D)
- .addPoint(0, this.bottom - 4, 0.0D, 0.0D, 0.0D)
- .setAlpha(255)
- .addPoint(0, this.bottom, 0.0D, 0.0D, 1.0D)
- .addPoint(this.width, this.bottom, 0.0D, 1.0D, 1.0D)
- .render();
+ RenderSystem.setShader(GameRenderer::getPositionTexColorShader);
+ RenderSystem.enableBlend();
+ RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SrcFactor.ZERO, GlStateManager.DstFactor.ONE);
+ RenderSystem.disableTexture();
+ RenderSystem.setShader(GameRenderer::getPositionColorShader);
+ Tessellator tessellator = Tessellator.getInstance();
+ BufferBuilder bufferBuilder = tessellator.getBuffer();
+
+ bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
+
+ bufferBuilder.vertex(0, this.top + 4, 0.0D).color(0, 0, 0, 0).next();
+ bufferBuilder.vertex(this.width, this.top + 4, 0.0D).color(0, 0, 0, 0).next();
+ bufferBuilder.vertex(this.width, this.top, 0.0D).color(0, 0, 0, 255).next();
+ bufferBuilder.vertex(0, this.top, 0.0D).color(0, 0, 0, 255).next();
+
+ bufferBuilder.vertex(this.width, this.bottom - 4, 0.0D).color(0, 0, 0, 0).next();
+ bufferBuilder.vertex(0, this.bottom - 4, 0.0D).color(0, 0, 0, 0).next();
+ bufferBuilder.vertex(0, this.bottom, 0.0D).color(0, 0, 0, 255).next();
+ bufferBuilder.vertex(this.width, this.bottom, 0.0D).color(0, 0, 0, 255).next();
+
+ tessellator.draw();
+ RenderSystem.enableTexture();
+ RenderSystem.disableBlend();
}
ControlList section(String title, CreateControl... createControls) {