Search in sources :

Example 11 with GameRenderer

use of net.minecraft.client.render.GameRenderer in project meteor-client by MeteorDevelopment.

the class BookTooltipComponent method drawItems.

@Override
public void drawItems(TextRenderer textRenderer, int x, int y, MatrixStack matrices, ItemRenderer itemRenderer, int z) {
    // Background
    RenderSystem.setShader(GameRenderer::getPositionTexShader);
    RenderSystem.setShaderTexture(0, TEXTURE_BOOK_BACKGROUND);
    DrawableHelper.drawTexture(matrices, x, y, z, 12, 0, 112, 134, 179, 179);
    // Content
    matrices.push();
    matrices.translate(x + 16, y + 12, z + 1);
    matrices.scale(0.7f, 0.7f, 1f);
    int offset = 0;
    for (OrderedText line : textRenderer.wrapLines(page, 112)) {
        textRenderer.draw(matrices, line, 0, offset, 0x000000);
        offset += 8;
    }
    matrices.pop();
}
Also used : GameRenderer(net.minecraft.client.render.GameRenderer) OrderedText(net.minecraft.text.OrderedText)

Example 12 with GameRenderer

use of net.minecraft.client.render.GameRenderer in project meteor-client by MeteorDevelopment.

the class PeekScreen method drawBackground.

@Override
protected void drawBackground(MatrixStack matrices, float delta, int mouseX, int mouseY) {
    Color color = Utils.getShulkerColor(storageBlock);
    RenderSystem.setShader(GameRenderer::getPositionTexShader);
    RenderSystem.setShaderColor(color.r / 255f, color.g / 255f, color.b / 255f, color.a / 255f);
    RenderSystem.setShaderTexture(0, TEXTURE);
    int i = (this.width - this.backgroundWidth) / 2;
    int j = (this.height - this.backgroundHeight) / 2;
    this.drawTexture(matrices, i, j, 0, 0, this.backgroundWidth, this.backgroundHeight);
}
Also used : Color(meteordevelopment.meteorclient.utils.render.color.Color) GameRenderer(net.minecraft.client.render.GameRenderer)

Example 13 with GameRenderer

use of net.minecraft.client.render.GameRenderer in project ImmersivePortalsMod by qouteall.

the class OFInterfaceInitializer method init.

public static void init() {
    Validate.isTrue(OFInterface.isOptifinePresent);
    OFInterface.isShaders = Config::isShaders;
    OFInterface.isShadowPass = () -> Config.isShaders() && Shaders.isShadowPass;
    OFInterface.bindToShaderFrameBuffer = () -> {
        EXTFramebufferObject.glBindFramebufferEXT(36160, OFGlobal.getDfb.get());
        GlStateManager.viewport(0, 0, Shaders.renderWidth, Shaders.renderHeight);
    };
    OFInterface.beforeRenderCenter = (partialTicks) -> {
        if (Config.isShaders()) {
            MinecraftClient mc = MinecraftClient.getInstance();
            Shaders.activeProgram = Shaders.ProgramNone;
            Shaders.beginRender(mc, mc.gameRenderer.getCamera(), partialTicks, 0);
        }
    };
    OFInterface.afterRenderCenter = () -> Shaders.activeProgram = Shaders.ProgramNone;
    OFInterface.resetViewport = () -> {
        if (OFInterface.isShaders.getAsBoolean()) {
            GlStateManager.viewport(0, 0, Shaders.renderWidth, Shaders.renderHeight);
        }
    };
    OFInterface.onPlayerTraveled = (fromDimension1, toDimension1) -> {
        if (OFInterface.isShaders.getAsBoolean()) {
            OFGlobal.shaderContextManager.onPlayerTraveled(fromDimension1, toDimension1);
        }
    };
    OFInterface.shouldDisableFog = () -> {
        GameRenderer gameRenderer = MinecraftClient.getInstance().gameRenderer;
        if (gameRenderer_fogStandard == null) {
            try {
                gameRenderer_fogStandard = GameRenderer.class.getDeclaredField("fogStandard");
            } catch (NoSuchFieldException e) {
                throw new IllegalStateException(e);
            }
        }
        try {
            boolean fogStandard = gameRenderer_fogStandard.getBoolean(gameRenderer);
            return Config.isFogOff() && fogStandard;
        } catch (IllegalAccessException e) {
            throw new IllegalStateException(e);
        }
    };
    OFInterface.createNewRenderInfosNormal = newWorldRenderer1 -> {
        /**
         *{@link WorldRenderer#chunkInfos}
         */
        // in vanilla it will create new chunkInfos object every frame
        // but with optifine it will always use one object
        // we need to switch chunkInfos correctly
        // if we do not put it a new object, it will clear the original chunkInfos
        ((IEOFWorldRenderer) newWorldRenderer1).createNewRenderInfosNormal();
    };
    OFInterface.initShaderCullingManager = ShaderCullingManager::init;
}
Also used : Config(net.optifine.Config) IEOFWorldRenderer(com.qouteall.immersive_portals.IEOFWorldRenderer) MinecraftClient(net.minecraft.client.MinecraftClient) GameRenderer(net.minecraft.client.render.GameRenderer)

Example 14 with GameRenderer

use of net.minecraft.client.render.GameRenderer 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, int 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 >> 24 & 255) / 255.0F;
    float g = (float) (color >> 16 & 255) / 255.0F;
    float h = (float) (color >> 8 & 255) / 255.0F;
    float k = (float) (color & 255) / 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();
}
Also used : Matrix4f(net.minecraft.util.math.Matrix4f) IMatrix4f(dev.hypnotic.utils.mixin.IMatrix4f) BufferBuilder(net.minecraft.client.render.BufferBuilder) GameRenderer(net.minecraft.client.render.GameRenderer)

Example 15 with GameRenderer

use of net.minecraft.client.render.GameRenderer in project Hypnotic-Client by Hypnotic-Development.

the class RenderUtils method drawAuraESP.

public static void drawAuraESP(MatrixStack matrices, Vec3d pos, float partialTicks, double rad, double height, int color) {
    float lastX = 0;
    float lastZ = (float) rad;
    for (int angle = 0; angle <= 360; angle += 6) {
        float cos = MathHelper.cos((float) Math.toRadians(angle));
        float sin = MathHelper.sin((float) Math.toRadians(angle));
        float x = (float) (rad * sin);
        float z = (float) (rad * cos);
        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder buffer = tessellator.getBuffer();
        RenderSystem.enableBlend();
        RenderSystem.disableDepthTest();
        RenderSystem.disableCull();
        RenderSystem.setShader(GameRenderer::getRenderTypeLinesShader);
        RenderSystem.lineWidth(1);
        buffer.begin(VertexFormat.DrawMode.TRIANGLE_FAN, VertexFormats.POSITION_COLOR);
        Vertexer.vertexTri(matrices, buffer, (float) pos.x + lastX, (float) pos.y, (float) pos.z + lastZ, (float) pos.x + x, (float) pos.y, (float) pos.z + z, (float) pos.x + lastX + 12, (float) pos.y + 12, (float) pos.z + lastZ + 12, Color.WHITE);
        tessellator.draw();
        RenderSystem.enableCull();
        RenderSystem.enableDepthTest();
        lastX = x;
        lastZ = z;
    }
}
Also used : Tessellator(net.minecraft.client.render.Tessellator) BufferBuilder(net.minecraft.client.render.BufferBuilder) GameRenderer(net.minecraft.client.render.GameRenderer)

Aggregations

GameRenderer (net.minecraft.client.render.GameRenderer)115 BufferBuilder (net.minecraft.client.render.BufferBuilder)75 Matrix4f (net.minecraft.util.math.Matrix4f)38 Tessellator (net.minecraft.client.render.Tessellator)34 MatrixStack (net.minecraft.client.util.math.MatrixStack)13 TextRenderer (net.minecraft.client.font.TextRenderer)11 Vec3d (net.minecraft.util.math.Vec3d)10 ClickGui (net.wurstclient.clickgui.ClickGui)8 BlockPos (net.minecraft.util.math.BlockPos)7 IMatrix4f (dev.hypnotic.utils.mixin.IMatrix4f)6 MinecraftClient (net.minecraft.client.MinecraftClient)6 ItemStack (net.minecraft.item.ItemStack)6 Box (net.minecraft.util.math.Box)6 TranslatableText (net.minecraft.text.TranslatableText)5 PathCmd (net.wurstclient.commands.PathCmd)5 PlayerEntity (net.minecraft.entity.player.PlayerEntity)4 Text (net.minecraft.text.Text)4 Color (java.awt.Color)3 LiteralText (net.minecraft.text.LiteralText)3 Camera (net.minecraft.client.render.Camera)2