use of net.minecraft.client.render.Tessellator in project Skyblocker by LifeIsAParadox.
the class RenderUtils method drawBoxOutline.
public static void drawBoxOutline(Box box, QuadColor color, float lineWidth, Direction... excludeDirs) {
if (!FrustumUtils.isBoxVisible(box)) {
return;
}
setup();
MatrixStack matrices = matrixFrom(box.minX, box.minY, box.minZ);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuffer();
// Outline
RenderSystem.disableCull();
RenderSystem.setShader(GameRenderer::getRenderTypeLinesShader);
RenderSystem.lineWidth(lineWidth);
buffer.begin(VertexFormat.DrawMode.LINES, VertexFormats.LINES);
Vertexer.vertexBoxLines(matrices, buffer, Boxes.moveToZero(box), color, excludeDirs);
tessellator.draw();
RenderSystem.enableCull();
cleanup();
}
use of net.minecraft.client.render.Tessellator in project Polymorph by TheIllusiveC4.
the class SelectionWidget method drawGradientRect.
public static void drawGradientRect(Matrix4f mat, int zLevel, int left, int top, int right, int bottom, int startColor, int endColor) {
float startAlpha = (float) (startColor >> 24 & 255) / 255.0F;
float startRed = (float) (startColor >> 16 & 255) / 255.0F;
float startGreen = (float) (startColor >> 8 & 255) / 255.0F;
float startBlue = (float) (startColor & 255) / 255.0F;
float endAlpha = (float) (endColor >> 24 & 255) / 255.0F;
float endRed = (float) (endColor >> 16 & 255) / 255.0F;
float endGreen = (float) (endColor >> 8 & 255) / 255.0F;
float endBlue = (float) (endColor & 255) / 255.0F;
RenderSystem.enableDepthTest();
RenderSystem.disableTexture();
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
RenderSystem.setShader(GameRenderer::getPositionColorShader);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuffer();
buffer.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
buffer.vertex(mat, right, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).next();
buffer.vertex(mat, left, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).next();
buffer.vertex(mat, left, bottom, zLevel).color(endRed, endGreen, endBlue, endAlpha).next();
buffer.vertex(mat, right, bottom, zLevel).color(endRed, endGreen, endBlue, endAlpha).next();
tessellator.draw();
RenderSystem.disableBlend();
RenderSystem.enableTexture();
}
use of net.minecraft.client.render.Tessellator in project jGui by ReplayMod.
the class MCVer method drawRect.
public static void drawRect(int right, int bottom, int left, int top) {
// #if MC>=10800
Tessellator tessellator = Tessellator.getInstance();
// #else
// $$ Tessellator tessellator = Tessellator.instance;
// #endif
// #if MC>=10904
BufferBuilder vertexBuffer = tessellator.getBuffer();
// #else
// #if MC>=10800
// $$ WorldRenderer vertexBuffer = tessellator.getWorldRenderer();
// #else
// $$ Tessellator vertexBuffer = tessellator;
// #endif
// #endif
// #if MC>=10809
// #if MC>=11700
// $$ vertexBuffer.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION);
// #else
vertexBuffer.begin(GL11.GL_QUADS, VertexFormats.POSITION);
// #endif
vertexBuffer.vertex(right, top, 0).next();
vertexBuffer.vertex(left, top, 0).next();
vertexBuffer.vertex(left, bottom, 0).next();
vertexBuffer.vertex(right, bottom, 0).next();
// #else
// $$ vertexBuffer.startDrawingQuads();
// $$ vertexBuffer.addVertex(right, top, 0);
// $$ vertexBuffer.addVertex(left, top, 0);
// $$ vertexBuffer.addVertex(left, bottom, 0);
// $$ vertexBuffer.addVertex(right, bottom, 0);
// #endif
tessellator.draw();
}
use of net.minecraft.client.render.Tessellator in project jGui by ReplayMod.
the class MCVer method drawRect.
public static void drawRect(int x, int y, int width, int height, ReadableColor tl, ReadableColor tr, ReadableColor bl, ReadableColor br) {
// #if MC>=10800
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder vertexBuffer = tessellator.getBuffer();
// #else
// $$ Tessellator tessellator = Tessellator.instance;
// $$ Tessellator vertexBuffer = tessellator;
// #endif
// #if MC>=10809
// #if MC>=11700
// $$ vertexBuffer.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
// #else
vertexBuffer.begin(GL11.GL_QUADS, VertexFormats.POSITION_COLOR);
// #endif
vertexBuffer.vertex(x, y + height, 0).color(bl.getRed(), bl.getGreen(), bl.getBlue(), bl.getAlpha()).next();
vertexBuffer.vertex(x + width, y + height, 0).color(br.getRed(), br.getGreen(), br.getBlue(), br.getAlpha()).next();
vertexBuffer.vertex(x + width, y, 0).color(tr.getRed(), tr.getGreen(), tr.getBlue(), tr.getAlpha()).next();
vertexBuffer.vertex(x, y, 0).color(tl.getRed(), tl.getGreen(), tl.getBlue(), tl.getAlpha()).next();
// #else
// $$ vertexBuffer.startDrawingQuads();
// $$ vertexBuffer.setColorRGBA(bl.getRed(), bl.getGreen(), bl.getBlue(), bl.getAlpha());
// $$ vertexBuffer.addVertex(x, y + height, 0);
// $$ vertexBuffer.setColorRGBA(br.getRed(), br.getGreen(), br.getBlue(), br.getAlpha());
// $$ vertexBuffer.addVertex(x + width, y + height, 0);
// $$ vertexBuffer.setColorRGBA(tr.getRed(), tr.getGreen(), tr.getBlue(), tr.getAlpha());
// $$ vertexBuffer.addVertex(x + width, y, 0);
// $$ vertexBuffer.setColorRGBA(tl.getRed(), tl.getGreen(), tl.getBlue(), tl.getAlpha());
// $$ vertexBuffer.addVertex(x, y, 0);
// #endif
tessellator.draw();
}
use of net.minecraft.client.render.Tessellator in project BlockMeter by ModProg.
the class ColorButton method render.
@Override
public void render(MatrixStack stack, final int int_1, final int int_2, final float float_1) {
super.render(stack, int_1, int_2, float_1);
RenderSystem.disableTexture();
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferBuilder = tessellator.getBuffer();
RenderSystem.setShader(GameRenderer::getPositionColorShader);
int r = this.color.getRed();
int g = this.color.getGreen();
int b = this.color.getBlue();
int a = texture ? 102 : 255;
bufferBuilder.begin(DrawMode.QUADS, VertexFormats.POSITION_COLOR);
bufferBuilder.vertex((double) this.x - (texture ? 1 : 0), (double) this.y - (texture ? 1 : 0), 0.0).color(r, g, b, a).next();
bufferBuilder.vertex((double) this.x - (texture ? 1 : 0), this.y + this.height + (texture ? 1 : 0), 0.0).color(r, g, b, a).next();
bufferBuilder.vertex(this.x + this.width + (texture ? 1 : 0), this.y + this.height + (texture ? 1 : 0), 0.0).color(r, g, b, a).next();
bufferBuilder.vertex(this.x + this.width + (texture ? 1 : 0), (double) this.y - (texture ? 1 : 0), 0.0).color(r, g, b, a).next();
tessellator.draw();
RenderSystem.enableTexture();
if (text != null) {
boolean dark = (0.299f * color.getRed() + 0.587f * color.getBlue() + 0.114f * color.getRed()) / 255f < 0.8f;
@SuppressWarnings("resource") final TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
int text_width = textRenderer.getWidth(text);
if (dark || texture)
textRenderer.drawWithShadow(stack, text, x + width / 2 - text_width / 2, y + height / 2 - 4, 0xFFFFFF);
else {
// shadow
textRenderer.draw(stack, text, x + width / 2 - text_width / 2 + 1, y + height / 2 - 3, 0xAAAAAA);
textRenderer.draw(stack, text, x + width / 2 - text_width / 2, y + height / 2 - 4, 0);
}
}
}
Aggregations