Search in sources :

Example 1 with GameRenderer

use of net.minecraft.client.render.GameRenderer in project Skyblocker by LifeIsAParadox.

the class ResultButtonWidget method renderButton.

@Override
public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float delta) {
    MinecraftClient client = MinecraftClient.getInstance();
    RenderSystem.setShader(GameRenderer::getPositionTexShader);
    RenderSystem.setShaderTexture(0, BACKGROUND_TEXTURE);
    this.drawTexture(matrices, this.x, this.y, 29, 206, this.width, this.height);
    client.getItemRenderer().renderInGui(this.itemStack, this.x + 4, this.y + 4);
    client.getItemRenderer().renderGuiItemOverlay(client.textRenderer, itemStack, this.x + 4, this.y + 4);
}
Also used : MinecraftClient(net.minecraft.client.MinecraftClient) GameRenderer(net.minecraft.client.render.GameRenderer)

Example 2 with GameRenderer

use of net.minecraft.client.render.GameRenderer 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();
}
Also used : Tessellator(net.minecraft.client.render.Tessellator) MatrixStack(net.minecraft.client.util.math.MatrixStack) BufferBuilder(net.minecraft.client.render.BufferBuilder) GameRenderer(net.minecraft.client.render.GameRenderer)

Example 3 with GameRenderer

use of net.minecraft.client.render.GameRenderer in project Polymorph by TheIllusiveC4.

the class OutputWidget method renderButton.

@Override
public void renderButton(MatrixStack matrixStack, int button_1, int button_2, float button_3) {
    MinecraftClient minecraft = MinecraftClient.getInstance();
    RenderSystem.setShader(GameRenderer::getPositionTexShader);
    RenderSystem.setShaderTexture(0, AbstractRecipesWidget.WIDGETS);
    int j = 0;
    if (this.x + 25 > button_1 && this.x <= button_1 && this.y + 25 > button_2 && this.y <= button_2) {
        j += 25;
    }
    this.drawTexture(matrixStack, this.x, this.y, this.highlighted ? 41 : 16, j, this.width, this.height);
    int k = 4;
    ItemRenderer renderer = minecraft.getItemRenderer();
    float zLevel = renderer.zOffset;
    renderer.zOffset = 700.0F;
    renderer.renderGuiItemIcon(this.getOutput(), this.x + k, this.y + k);
    renderer.renderGuiItemOverlay(minecraft.textRenderer, this.getOutput(), this.x + k, this.y + k);
    renderer.zOffset = zLevel;
}
Also used : MinecraftClient(net.minecraft.client.MinecraftClient) ItemRenderer(net.minecraft.client.render.item.ItemRenderer) GameRenderer(net.minecraft.client.render.GameRenderer)

Example 4 with GameRenderer

use of net.minecraft.client.render.GameRenderer 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();
}
Also used : Tessellator(net.minecraft.client.render.Tessellator) BufferBuilder(net.minecraft.client.render.BufferBuilder) GameRenderer(net.minecraft.client.render.GameRenderer)

Example 5 with GameRenderer

use of net.minecraft.client.render.GameRenderer in project MiniMap by pl3xgaming.

the class GL method drawSolidRect.

public static void drawSolidRect(Matrix4f matrix, float x0, float y0, float x1, float y1, int colorTopLeft, int colorTopRight, int colorBottomLeft, int colorBottomRight) {
    RenderSystem.disableTexture();
    RenderSystem.setShader(GameRenderer::getPositionColorShader);
    BufferBuilder buf = Tessellator.getInstance().getBuffer();
    buf.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
    buf.vertex(matrix, x1, y0, 0F).color(colorTopRight).next();
    buf.vertex(matrix, x0, y0, 0F).color(colorTopLeft).next();
    buf.vertex(matrix, x0, y1, 0F).color(colorBottomLeft).next();
    buf.vertex(matrix, x1, y1, 0F).color(colorBottomRight).next();
    buf.end();
    BufferRenderer.draw(buf);
    RenderSystem.enableTexture();
}
Also used : BufferBuilder(net.minecraft.client.render.BufferBuilder) GameRenderer(net.minecraft.client.render.GameRenderer)

Aggregations

GameRenderer (net.minecraft.client.render.GameRenderer)61 BufferBuilder (net.minecraft.client.render.BufferBuilder)42 Tessellator (net.minecraft.client.render.Tessellator)29 MatrixStack (net.minecraft.client.util.math.MatrixStack)12 Matrix4f (net.minecraft.util.math.Matrix4f)11 IMatrix4f (dev.hypnotic.utils.mixin.IMatrix4f)6 MinecraftClient (net.minecraft.client.MinecraftClient)4 ItemStack (net.minecraft.item.ItemStack)4 Color (java.awt.Color)3 TextRenderer (net.minecraft.client.font.TextRenderer)3 Vec3d (net.minecraft.util.math.Vec3d)3 Camera (net.minecraft.client.render.Camera)2 VertexConsumerProvider (net.minecraft.client.render.VertexConsumerProvider)2 MapState (net.minecraft.item.map.MapState)2 OrderedText (net.minecraft.text.OrderedText)2 Text (net.minecraft.text.Text)2 TranslatableText (net.minecraft.text.TranslatableText)2 Box (net.minecraft.util.math.Box)2 IEOFWorldRenderer (com.qouteall.immersive_portals.IEOFWorldRenderer)1 Random (java.util.Random)1