Skip to content

Commit

Permalink
Update to 1.21-pre1
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander01998 committed May 29, 2024
1 parent fbe7940 commit ffa13bd
Show file tree
Hide file tree
Showing 37 changed files with 319 additions and 242 deletions.
8 changes: 4 additions & 4 deletions src/main/java/net/wurstclient/ai/PathRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public static void renderArrow(MatrixStack matrixStack, BlockPos start,
{
Tessellator tessellator = RenderSystem.renderThreadTesselator();
RenderSystem.setShader(GameRenderer::getPositionProgram);
BufferBuilder bufferBuilder = tessellator.begin(
VertexFormat.DrawMode.DEBUG_LINES, VertexFormats.POSITION);
BufferBuilder bufferBuilder = tessellator
.begin(VertexFormat.DrawMode.DEBUG_LINES, VertexFormats.POSITION);

int startX = start.getX() - region.x();
int startY = start.getY();
Expand Down Expand Up @@ -112,8 +112,8 @@ public static void renderNode(MatrixStack matrixStack, BlockPos pos,
Tessellator tessellator = RenderSystem.renderThreadTesselator();

RenderSystem.setShader(GameRenderer::getPositionProgram);
BufferBuilder bufferBuilder = tessellator.begin(
VertexFormat.DrawMode.DEBUG_LINES, VertexFormats.POSITION);
BufferBuilder bufferBuilder = tessellator
.begin(VertexFormat.DrawMode.DEBUG_LINES, VertexFormats.POSITION);

// middle part
bufferBuilder.vertex(matrix, 0, 0, 1);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/wurstclient/altmanager/AltRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ private static void drawTexture(DrawContext context, int x, int y, float u,
RenderSystem.setShader(GameRenderer::getPositionTexProgram);
MatrixStack matrixStack = context.getMatrices();
Matrix4f matrix4f = matrixStack.peek().getPositionMatrix();
BufferBuilder bufferBuilder = Tessellator.getInstance().begin(
VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE);
BufferBuilder bufferBuilder = Tessellator.getInstance()
.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE);
bufferBuilder.vertex(matrix4f, x, y, z).texture(uOverFw, vOverFh);
bufferBuilder.vertex(matrix4f, x, y2, z).texture(uOverFw, vPlusHOverFh);
bufferBuilder.vertex(matrix4f, x2, y2, z).texture(uPlusWOverFw,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,8 @@ public void render(DrawContext context, int mouseX, int mouseY,

RenderSystem.setShaderColor(1, 0, 0, errorTimer / 16F);

BufferBuilder bufferBuilder = tessellator.begin(
VertexFormat.DrawMode.QUADS, VertexFormats.POSITION);
BufferBuilder bufferBuilder = tessellator
.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION);
bufferBuilder.vertex(matrix, 0, 0, 0);
bufferBuilder.vertex(matrix, width, 0, 0);
bufferBuilder.vertex(matrix, width, height, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,8 @@ public void render(DrawContext context, int mouseX, int mouseY,

RenderSystem.setShaderColor(1, 0, 0, errorTimer / 16F);

BufferBuilder bufferBuilder = tessellator.begin(
VertexFormat.DrawMode.QUADS, VertexFormats.POSITION);
BufferBuilder bufferBuilder = tessellator
.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION);
bufferBuilder.vertex(matrix, 0, 0, 0);
bufferBuilder.vertex(matrix, width, 0, 0);
bufferBuilder.vertex(matrix, width, height, 0);
Expand Down Expand Up @@ -660,14 +660,13 @@ protected void renderItem(DrawContext context, int id, int x, int y,

RenderSystem.setShaderColor(0, 1, 0, opacity);

BufferBuilder bufferBuilder = tessellator.begin(
VertexFormat.DrawMode.QUADS, VertexFormats.POSITION);
BufferBuilder bufferBuilder = tessellator
.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION);
bufferBuilder.vertex(matrix, x - 2, y - 2, 0);
bufferBuilder.vertex(matrix, x - 2 + 220, y - 2, 0);
bufferBuilder.vertex(matrix, x - 2 + 220, y - 2 + 30, 0);
bufferBuilder.vertex(matrix, x - 2, y - 2 + 30, 0);
BufferRenderer
.drawWithGlobalProgram(bufferBuilder.end());
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());

GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_BLEND);
Expand Down
59 changes: 28 additions & 31 deletions src/main/java/net/wurstclient/clickgui/ClickGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -676,8 +676,8 @@ private void renderWindow(DrawContext context, Window window, int mouseX,
RenderSystem.setShaderColor(bgColor[0], bgColor[1], bgColor[2],
opacity);

BufferBuilder bufferBuilder = tessellator.begin(
VertexFormat.DrawMode.QUADS, VertexFormats.POSITION);
BufferBuilder bufferBuilder = tessellator
.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION);
bufferBuilder.vertex(matrix, xs2, ys1, 0);
bufferBuilder.vertex(matrix, xs2, ys2, 0);
bufferBuilder.vertex(matrix, xs3, ys2, 0);
Expand All @@ -690,8 +690,7 @@ private void renderWindow(DrawContext context, Window window, int mouseX,
bufferBuilder.vertex(matrix, xs1, ys2, 0);
bufferBuilder.vertex(matrix, xs2, ys2, 0);
bufferBuilder.vertex(matrix, xs2, ys4, 0);
BufferRenderer
.drawWithGlobalProgram(bufferBuilder.end());
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());

boolean hovering = mouseX >= xs1 && mouseY >= ys3
&& mouseX < xs2 && mouseY < ys4;
Expand All @@ -700,29 +699,27 @@ private void renderWindow(DrawContext context, Window window, int mouseX,
RenderSystem.setShaderColor(acColor[0], acColor[1], acColor[2],
hovering ? opacity * 1.5F : opacity);

bufferBuilder = tessellator.begin(
VertexFormat.DrawMode.QUADS, VertexFormats.POSITION);
bufferBuilder = tessellator.begin(VertexFormat.DrawMode.QUADS,
VertexFormats.POSITION);
bufferBuilder.vertex(matrix, xs1, ys3, 0);
bufferBuilder.vertex(matrix, xs1, ys4, 0);
bufferBuilder.vertex(matrix, xs2, ys4, 0);
bufferBuilder.vertex(matrix, xs2, ys3, 0);
BufferRenderer
.drawWithGlobalProgram(bufferBuilder.end());
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());

// outline
RenderSystem.setShaderColor(acColor[0], acColor[1], acColor[2],
0.5F);

bufferBuilder = tessellator.begin(
VertexFormat.DrawMode.DEBUG_LINE_STRIP,
VertexFormats.POSITION);
bufferBuilder =
tessellator.begin(VertexFormat.DrawMode.DEBUG_LINE_STRIP,
VertexFormats.POSITION);
bufferBuilder.vertex(matrix, xs1, ys3, 0);
bufferBuilder.vertex(matrix, xs1, ys4, 0);
bufferBuilder.vertex(matrix, xs2, ys4, 0);
bufferBuilder.vertex(matrix, xs2, ys3, 0);
bufferBuilder.vertex(matrix, xs1, ys3, 0);
BufferRenderer
.drawWithGlobalProgram(bufferBuilder.end());
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
}

int x3 = x1 + 2;
Expand All @@ -735,8 +732,8 @@ private void renderWindow(DrawContext context, Window window, int mouseX,
RenderSystem.setShaderColor(bgColor[0], bgColor[1], bgColor[2],
opacity);

BufferBuilder bufferBuilder = tessellator.begin(
VertexFormat.DrawMode.QUADS, VertexFormats.POSITION);
BufferBuilder bufferBuilder = tessellator
.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION);
bufferBuilder.vertex(matrix, x1, y3, 0);
bufferBuilder.vertex(matrix, x1, y2, 0);
bufferBuilder.vertex(matrix, x3, y2, 0);
Expand All @@ -759,8 +756,8 @@ private void renderWindow(DrawContext context, Window window, int mouseX,

RenderSystem.setShaderColor(bgColor[0], bgColor[1], bgColor[2],
opacity);
bufferBuilder = tessellator.begin(
VertexFormat.DrawMode.QUADS, VertexFormats.POSITION);
bufferBuilder = tessellator.begin(VertexFormat.DrawMode.QUADS,
VertexFormats.POSITION);

// window background
// between children
Expand Down Expand Up @@ -825,8 +822,8 @@ private void renderWindow(DrawContext context, Window window, int mouseX,
if(!window.isMinimized())
{
// title bar outline
bufferBuilder = tessellator.begin(
VertexFormat.DrawMode.DEBUG_LINES, VertexFormats.POSITION);
bufferBuilder = tessellator.begin(VertexFormat.DrawMode.DEBUG_LINES,
VertexFormats.POSITION);
bufferBuilder.vertex(matrix, x1, y3, 0);
bufferBuilder.vertex(matrix, x2, y3, 0);
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
Expand Down Expand Up @@ -970,8 +967,8 @@ private void renderMinimizeButton(MatrixStack matrixStack, int x1, int y1,
}

// arrow
BufferBuilder bufferBuilder = tessellator.begin(
VertexFormat.DrawMode.TRIANGLES, VertexFormats.POSITION);
BufferBuilder bufferBuilder = tessellator
.begin(VertexFormat.DrawMode.TRIANGLES, VertexFormats.POSITION);
bufferBuilder.vertex(matrix, xa1, ya1, 0);
bufferBuilder.vertex(matrix, xa3, ya1, 0);
bufferBuilder.vertex(matrix, xa2, ya2, 0);
Expand Down Expand Up @@ -1009,8 +1006,8 @@ private void renderPinButton(MatrixStack matrixStack, int x1, int y1,

// knob
RenderSystem.setShaderColor(h, 0, 0, 0.5F);
BufferBuilder bufferBuilder = tessellator.begin(
VertexFormat.DrawMode.QUADS, VertexFormats.POSITION);
BufferBuilder bufferBuilder = tessellator
.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION);
bufferBuilder.vertex(matrix, xk1, yk1, 0);
bufferBuilder.vertex(matrix, xk2, yk1, 0);
bufferBuilder.vertex(matrix, xk2, yk2, 0);
Expand All @@ -1028,8 +1025,8 @@ private void renderPinButton(MatrixStack matrixStack, int x1, int y1,

// needle
RenderSystem.setShaderColor(h, h, h, 1);
bufferBuilder = tessellator.begin(
VertexFormat.DrawMode.QUADS, VertexFormats.POSITION);
bufferBuilder = tessellator.begin(VertexFormat.DrawMode.QUADS,
VertexFormats.POSITION);
bufferBuilder.vertex(matrix, xn1, yn1, 0);
bufferBuilder.vertex(matrix, xn2, yn1, 0);
bufferBuilder.vertex(matrix, xn2, yn2, 0);
Expand Down Expand Up @@ -1082,8 +1079,8 @@ private void renderPinButton(MatrixStack matrixStack, int x1, int y1,

// knob
RenderSystem.setShaderColor(0, h, 0, 1);
BufferBuilder bufferBuilder = tessellator.begin(
VertexFormat.DrawMode.QUADS, VertexFormats.POSITION);
BufferBuilder bufferBuilder = tessellator
.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION);
bufferBuilder.vertex(matrix, xk1, yk1, 0);
bufferBuilder.vertex(matrix, xk2, yk2, 0);
bufferBuilder.vertex(matrix, xk3, yk3, 0);
Expand All @@ -1103,8 +1100,8 @@ private void renderPinButton(MatrixStack matrixStack, int x1, int y1,

// needle
RenderSystem.setShaderColor(h, h, h, 1);
bufferBuilder = tessellator.begin(
VertexFormat.DrawMode.TRIANGLES, VertexFormats.POSITION);
bufferBuilder = tessellator.begin(VertexFormat.DrawMode.TRIANGLES,
VertexFormats.POSITION);
bufferBuilder.vertex(matrix, xn1, yn1, 0);
bufferBuilder.vertex(matrix, xn2, yn2, 0);
bufferBuilder.vertex(matrix, xn3, yn3, 0);
Expand Down Expand Up @@ -1181,8 +1178,8 @@ private void renderCloseButton(MatrixStack matrixStack, int x1, int y1,

// outline
RenderSystem.setShaderColor(0.0625F, 0.0625F, 0.0625F, 0.5F);
bufferBuilder = tessellator.begin(
VertexFormat.DrawMode.DEBUG_LINES, VertexFormats.POSITION);
bufferBuilder = tessellator.begin(VertexFormat.DrawMode.DEBUG_LINES,
VertexFormats.POSITION);
bufferBuilder.vertex(matrix, xc1, yc1, 0);
bufferBuilder.vertex(matrix, xc2, yc2, 0);
bufferBuilder.vertex(matrix, xc6, yc5, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ private void drawSeparator(MatrixStack matrixStack, int x3, int y1, int y2)
Matrix4f matrix = matrixStack.peek().getPositionMatrix();
Tessellator tessellator = RenderSystem.renderThreadTesselator();

BufferBuilder bufferBuilder = tessellator.begin(
VertexFormat.DrawMode.DEBUG_LINES, VertexFormats.POSITION);
BufferBuilder bufferBuilder = tessellator
.begin(VertexFormat.DrawMode.DEBUG_LINES, VertexFormats.POSITION);
bufferBuilder.vertex(matrix, x3, y1, 0);
bufferBuilder.vertex(matrix, x3, y2, 0);
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
Expand Down Expand Up @@ -238,8 +238,8 @@ private void drawArrow(MatrixStack matrixStack, int x2, int x3, int y1,
}

// arrow
BufferBuilder bufferBuilder = tessellator.begin(
VertexFormat.DrawMode.TRIANGLES, VertexFormats.POSITION);
BufferBuilder bufferBuilder = tessellator
.begin(VertexFormat.DrawMode.TRIANGLES, VertexFormats.POSITION);
bufferBuilder.vertex(matrix, xa1, ya1, 0);
bufferBuilder.vertex(matrix, xa3, ya1, 0);
bufferBuilder.vertex(matrix, xa2, ya2, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ private void drawSeparator(MatrixStack matrixStack, int x3, int y1, int y2)
Tessellator tessellator = RenderSystem.renderThreadTesselator();

// separator
BufferBuilder bufferBuilder = tessellator.begin(
VertexFormat.DrawMode.DEBUG_LINES, VertexFormats.POSITION);
BufferBuilder bufferBuilder = tessellator
.begin(VertexFormat.DrawMode.DEBUG_LINES, VertexFormats.POSITION);
bufferBuilder.vertex(matrix, x3, y1, 0);
bufferBuilder.vertex(matrix, x3, y2, 0);
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
Expand Down Expand Up @@ -268,8 +268,8 @@ private void drawSettingsArrow(MatrixStack matrixStack, int x2, int x3,
}

// arrow
BufferBuilder bufferBuilder = tessellator.begin(
VertexFormat.DrawMode.TRIANGLES, VertexFormats.POSITION);
BufferBuilder bufferBuilder = tessellator
.begin(VertexFormat.DrawMode.TRIANGLES, VertexFormats.POSITION);
bufferBuilder.vertex(matrix, xa1, ya1, 0);
bufferBuilder.vertex(matrix, xa3, ya1, 0);
bufferBuilder.vertex(matrix, xa2, ya2, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.render.BufferBuilder;
import net.minecraft.client.render.BufferRenderer;
import net.minecraft.client.render.BuiltBuffer;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.render.Tessellator;
import net.minecraft.client.render.VertexFormat;
Expand Down Expand Up @@ -190,7 +191,9 @@ else if(e instanceof AnimalEntity || e instanceof AmbientEntity
middleY + (float)renderY + 0.5F, 0)
.color(red, green, blue, alpha);
}
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
BuiltBuffer buffer = bufferBuilder.endNullable();
if(buffer != null)
BufferRenderer.drawWithGlobalProgram(buffer);
}

@Override
Expand Down
36 changes: 21 additions & 15 deletions src/main/java/net/wurstclient/hacks/BaseFinderHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.lwjgl.opengl.GL11;

import com.mojang.blaze3d.systems.RenderSystem;

import net.minecraft.client.gl.ShaderProgram;
import net.minecraft.client.gl.VertexBuffer;
import net.minecraft.client.render.BufferBuilder;
Expand Down Expand Up @@ -200,23 +201,28 @@ public void onUpdate()
if(modulo == 0 || !region.equals(lastRegion))
{
if(vertexBuffer != null)
{
vertexBuffer.close();
vertexBuffer = null;
}

vertexBuffer = new VertexBuffer(VertexBuffer.Usage.STATIC);

Tessellator tessellator = RenderSystem.renderThreadTesselator();
BufferBuilder bufferBuilder = tessellator.begin(
VertexFormat.DrawMode.QUADS, VertexFormats.POSITION);

for(int[] vertex : vertices)
bufferBuilder.vertex(vertex[0] - region.x(), vertex[1],
vertex[2] - region.z());

BuiltBuffer buffer = bufferBuilder.end();

vertexBuffer.bind();
vertexBuffer.upload(buffer);
VertexBuffer.unbind();
if(!vertices.isEmpty())
{
Tessellator tessellator = RenderSystem.renderThreadTesselator();
BufferBuilder bufferBuilder = tessellator
.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION);

for(int[] vertex : vertices)
bufferBuilder.vertex(vertex[0] - region.x(), vertex[1],
vertex[2] - region.z());

BuiltBuffer buffer = bufferBuilder.end();

vertexBuffer = new VertexBuffer(VertexBuffer.Usage.STATIC);
vertexBuffer.bind();
vertexBuffer.upload(buffer);
VertexBuffer.unbind();
}

lastRegion = region;
}
Expand Down
36 changes: 22 additions & 14 deletions src/main/java/net/wurstclient/hacks/CaveFinderHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.lwjgl.opengl.GL11;

import com.mojang.blaze3d.systems.RenderSystem;

import net.minecraft.block.Blocks;
import net.minecraft.client.gl.ShaderProgram;
import net.minecraft.client.gl.VertexBuffer;
Expand Down Expand Up @@ -253,24 +254,31 @@ else if(notify)

private void setBufferFromTask()
{
Tessellator tessellator = RenderSystem.renderThreadTesselator();
BufferBuilder bufferBuilder = tessellator
.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION);

ArrayList<int[]> vertices = compileVerticesTask.join();
RegionPos region = RenderUtils.getCameraRegion();
for(int[] vertex : compileVerticesTask.join())
bufferBuilder.vertex(vertex[0] - region.x(), vertex[1],
vertex[2] - region.z());

BuiltBuffer buffer = bufferBuilder.end();

if(vertexBuffer != null)
{
vertexBuffer.close();
vertexBuffer = null;
}

vertexBuffer = new VertexBuffer(VertexBuffer.Usage.STATIC);
vertexBuffer.bind();
vertexBuffer.upload(buffer);
VertexBuffer.unbind();
if(!vertices.isEmpty())
{
Tessellator tessellator = RenderSystem.renderThreadTesselator();
BufferBuilder bufferBuilder = tessellator
.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION);

for(int[] vertex : vertices)
bufferBuilder.vertex(vertex[0] - region.x(), vertex[1],
vertex[2] - region.z());

BuiltBuffer buffer = bufferBuilder.end();

vertexBuffer = new VertexBuffer(VertexBuffer.Usage.STATIC);
vertexBuffer.bind();
vertexBuffer.upload(buffer);
VertexBuffer.unbind();
}

bufferUpToDate = true;
bufferRegion = region;
Expand Down
Loading

0 comments on commit ffa13bd

Please sign in to comment.