use of net.minecraft.util.math.Matrix4f in project EdenClient by HahaOO7.
the class EntityEsp method render.
private void render(MatrixStack matrixStack, VertexConsumerProvider.Immediate vertexConsumerProvider, float tickDelta) {
if (!enabled)
return;
RenderSystem.setShader(GameRenderer::getPositionShader);
RenderSystem.setShaderColor(r, g, b, 1);
RenderSystem.disableDepthTest();
if (tracer) {
Vec3d start = RenderUtils.getCameraPos().add(PlayerUtils.getClientLookVec());
Matrix4f matrix = matrixStack.peek().getPositionMatrix();
BufferBuilder bb = Tessellator.getInstance().getBuffer();
bb.begin(VertexFormat.DrawMode.DEBUG_LINES, VertexFormats.POSITION);
for (Entity target : entities) {
Vec3d t = new Vec3d(target.prevX + (target.getX() - target.prevX) * tickDelta, target.prevY + (target.getY() - target.prevY) * tickDelta, target.prevZ + (target.getZ() - target.prevZ) * tickDelta);
bb.vertex(matrix, (float) t.x, (float) t.y, (float) t.z).next();
bb.vertex(matrix, (float) start.x, (float) start.y, (float) start.z).next();
}
bb.end();
BufferRenderer.draw(bb);
}
Runnable drawBoxTask = solid ? () -> solidBox.setShader(matrixStack.peek().getPositionMatrix(), RenderSystem.getProjectionMatrix(), RenderSystem.getShader()) : () -> wireframeBox.setShader(matrixStack.peek().getPositionMatrix(), RenderSystem.getProjectionMatrix(), RenderSystem.getShader());
for (Entity target : entities) {
matrixStack.push();
matrixStack.translate(target.prevX + (target.getX() - target.prevX) * tickDelta, target.prevY + (target.getY() - target.prevY) * tickDelta, target.prevZ + (target.getZ() - target.prevZ) * tickDelta);
matrixStack.scale(target.getWidth(), target.getHeight(), target.getWidth());
drawBoxTask.run();
matrixStack.pop();
}
}
use of net.minecraft.util.math.Matrix4f in project EnvironmentZ by Globox1997.
the class InGameOverlayRendererMixin method renderWinterOverlay.
private static void renderWinterOverlay(MinecraftClient minecraftClient, MatrixStack matrixStack, float smooth) {
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.enableTexture();
RenderSystem.setShaderTexture(0, WINTER_TEX);
BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
float f = minecraftClient.player.getBrightnessAtEyes();
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
RenderSystem.setShaderColor(f, f, f, smooth);
float m = -minecraftClient.player.getYaw() / 64.0F;
float n = minecraftClient.player.getPitch() / 64.0F;
Matrix4f matrix4f = matrixStack.peek().getModel();
bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE);
bufferBuilder.vertex(matrix4f, -1.0F, -1.0F, -0.5F).texture(4.0F + m, 4.0F + n).next();
bufferBuilder.vertex(matrix4f, 1.0F, -1.0F, -0.5F).texture(0.0F + m, 4.0F + n).next();
bufferBuilder.vertex(matrix4f, 1.0F, 1.0F, -0.5F).texture(0.0F + m, 0.0F + n).next();
bufferBuilder.vertex(matrix4f, -1.0F, 1.0F, -0.5F).texture(4.0F + m, 0.0F + n).next();
bufferBuilder.end();
BufferRenderer.draw(bufferBuilder);
RenderSystem.disableBlend();
}
use of net.minecraft.util.math.Matrix4f in project BleachHack by BleachDrinker420.
the class Peek method renderTooltipBox.
private void renderTooltipBox(MatrixStack matrices, int x1, int y1, int x2, int y2, boolean wrap) {
int xStart = x1 + 12;
int yStart = y1 - 12;
if (wrap) {
if (xStart + x2 > mc.currentScreen.width)
xStart -= 28 + x2;
if (yStart + y2 + 6 > mc.currentScreen.height)
yStart = mc.currentScreen.height - y2 - 6;
}
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferBuilder = tessellator.getBuffer();
bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
Matrix4f matrix4f = matrices.peek().getModel();
fillGradient(matrix4f, bufferBuilder, xStart - 3, yStart - 4, xStart + x2 + 3, yStart - 3, -267386864, -267386864);
fillGradient(matrix4f, bufferBuilder, xStart - 3, yStart + y2 + 3, xStart + x2 + 3, yStart + y2 + 4, -267386864, -267386864);
fillGradient(matrix4f, bufferBuilder, xStart - 3, yStart - 3, xStart + x2 + 3, yStart + y2 + 3, -267386864, -267386864);
fillGradient(matrix4f, bufferBuilder, xStart - 4, yStart - 3, xStart - 3, yStart + y2 + 3, -267386864, -267386864);
fillGradient(matrix4f, bufferBuilder, xStart + x2 + 3, yStart - 3, xStart + x2 + 4, yStart + y2 + 3, -267386864, -267386864);
fillGradient(matrix4f, bufferBuilder, xStart - 3, yStart - 3 + 1, xStart - 3 + 1, yStart + y2 + 3 - 1, 1347420415, 1344798847);
fillGradient(matrix4f, bufferBuilder, xStart + x2 + 2, yStart - 3 + 1, xStart + x2 + 3, yStart + y2 + 3 - 1, 1347420415, 1344798847);
fillGradient(matrix4f, bufferBuilder, xStart - 3, yStart - 3, xStart + x2 + 3, yStart - 3 + 1, 1347420415, 1347420415);
fillGradient(matrix4f, bufferBuilder, xStart - 3, yStart + y2 + 2, xStart + x2 + 3, yStart + y2 + 3, 1344798847, 1344798847);
RenderSystem.disableTexture();
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
RenderSystem.setShader(GameRenderer::getPositionColorShader);
bufferBuilder.end();
BufferRenderer.draw(bufferBuilder);
RenderSystem.disableBlend();
RenderSystem.enableTexture();
}
use of net.minecraft.util.math.Matrix4f in project Client by MatHax.
the class WorldRendererMixin method onRenderEndSkyDraw.
/**
* @author Walaryne
*/
@Inject(method = "renderEndSky", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/Tessellator;draw()V"))
private void onRenderEndSkyDraw(MatrixStack matrices, CallbackInfo info) {
Ambience ambience = Modules.get().get(Ambience.class);
if (ambience.isActive() && ambience.endSky.get() && ambience.customSkyColor.get()) {
Color customEndSkyColor = ambience.skyColor();
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferBuilder = tessellator.getBuffer();
Matrix4f matrix4f = matrices.peek().getPositionMatrix();
bufferBuilder.clear();
bufferBuilder.vertex(matrix4f, -100.0F, -100.0F, -100.0F).texture(0.0F, 0.0F).color(customEndSkyColor.r, customEndSkyColor.g, customEndSkyColor.b, 255).next();
bufferBuilder.vertex(matrix4f, -100.0F, -100.0F, 100.0F).texture(0.0F, 16.0F).color(customEndSkyColor.r, customEndSkyColor.g, customEndSkyColor.b, 255).next();
bufferBuilder.vertex(matrix4f, 100.0F, -100.0F, 100.0F).texture(16.0F, 16.0F).color(customEndSkyColor.r, customEndSkyColor.g, customEndSkyColor.b, 255).next();
bufferBuilder.vertex(matrix4f, 100.0F, -100.0F, -100.0F).texture(16.0F, 0.0F).color(customEndSkyColor.r, customEndSkyColor.g, customEndSkyColor.b, 255).next();
}
}
use of net.minecraft.util.math.Matrix4f in project Hypnotic-Client by Hypnotic-Development.
the class RenderUtils method fill.
public static void fill(MatrixStack matrixStack, double x1, double y1, double x2, double y2, Color color) {
Matrix4f matrix = matrixStack.peek().getPositionMatrix();
double j;
if (x1 < x2) {
j = x1;
x1 = x2;
x2 = j;
}
if (y1 < y2) {
j = y1;
y1 = y2;
y2 = j;
}
float f = (float) color.getRed() / 255.0F;
float g = (float) color.getGreen() / 255.0F;
float h = (float) color.getBlue() / 255.0F;
float k = (float) color.getAlpha() / 255.0F;
BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
RenderSystem.enableBlend();
RenderSystem.disableTexture();
RenderSystem.defaultBlendFunc();
RenderSystem.setShader(GameRenderer::getPositionColorShader);
bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
bufferBuilder.vertex(matrix, (float) x1, (float) y2, 0.0F).color(g, h, k, f).next();
bufferBuilder.vertex(matrix, (float) x2, (float) y2, 0.0F).color(g, h, k, f).next();
bufferBuilder.vertex(matrix, (float) x2, (float) y1, 0.0F).color(g, h, k, f).next();
bufferBuilder.vertex(matrix, (float) x1, (float) y1, 0.0F).color(g, h, k, f).next();
bufferBuilder.end();
BufferRenderer.draw(bufferBuilder);
RenderSystem.enableTexture();
RenderSystem.disableBlend();
}
Aggregations