Search in sources :

Example 1 with TextureManager

use of net.minecraft.client.texture.TextureManager in project BleachHack by BleachDrinker420.

the class ShaderLoader method loadEffect.

public static ShaderEffect loadEffect(Framebuffer framebuffer, Identifier id) throws JsonSyntaxException, IOException {
    ResourceManager resMang = MinecraftClient.getInstance().getResourceManager();
    TextureManager texMang = MinecraftClient.getInstance().getTextureManager();
    return new ShaderEffect(texMang, new OpenResourceManager(resMang), framebuffer, id);
}
Also used : TextureManager(net.minecraft.client.texture.TextureManager) ResourceManager(net.minecraft.resource.ResourceManager) ShaderEffect(net.minecraft.client.gl.ShaderEffect)

Example 2 with TextureManager

use of net.minecraft.client.texture.TextureManager in project Blockify by clownless.

the class RenderUtil method drawTexture.

public static void drawTexture(MatrixStack matrixStack, URLImage image, float x, float y, float scale) {
    Identifier texture = image.getIdentifier();
    int width = image.getWidth();
    int height = image.getHeight();
    TextureManager tex = MinecraftClient.getInstance().getTextureManager();
    tex.bindTexture(texture);
    RenderSystem.enableTexture();
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder bufferBuilder = tessellator.getBuffer();
    RenderSystem.setShader(GameRenderer::getPositionTexShader);
    RenderSystem.setShaderTexture(0, texture);
    RenderSystem.enableBlend();
    RenderSystem.blendFunc(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA);
    RenderSystem.enableDepthTest();
    bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE);
    Matrix4f matrices = matrixStack.peek().getPositionMatrix();
    bufferBuilder.vertex(matrices, x, y + (height * scale), 0).texture(0, 1).next();
    bufferBuilder.vertex(matrices, x + (width * scale), y + (height * scale), 0).texture(1, 1).next();
    bufferBuilder.vertex(matrices, x + (width * scale), y, 0).texture(1, 0).next();
    bufferBuilder.vertex(matrices, x, y, 0).texture(0, 0).next();
    tessellator.draw();
    RenderSystem.disableBlend();
}
Also used : TextureManager(net.minecraft.client.texture.TextureManager) Matrix4f(net.minecraft.util.math.Matrix4f) Identifier(net.minecraft.util.Identifier)

Example 3 with TextureManager

use of net.minecraft.client.texture.TextureManager in project KiwiClient by TangyKiwi.

the class InGameHudMixin method render.

@Inject(method = "render", at = @At(value = "TAIL"), cancellable = true)
private void render(CallbackInfo info) {
    if (!MinecraftClient.getInstance().options.debugEnabled) {
        MinecraftClient client = MinecraftClient.getInstance();
        TextRenderer textRenderer = client.textRenderer;
        TextureManager textureManager = client.getTextureManager();
        MatrixStack matrixStack = new MatrixStack();
        RenderSystem.setShaderTexture(0, KiwiClient.DUCK);
        client.inGameHud.drawTexture(matrixStack, 0, 0, 0, 0, 130, 130);
    }
    DrawOverlayEvent event = new DrawOverlayEvent(new MatrixStack());
    KiwiClient.eventBus.post(event);
    if (event.isCancelled())
        info.cancel();
}
Also used : DrawOverlayEvent(com.tangykiwi.kiwiclient.event.DrawOverlayEvent) TextureManager(net.minecraft.client.texture.TextureManager) MatrixStack(net.minecraft.client.util.math.MatrixStack) MinecraftClient(net.minecraft.client.MinecraftClient) TextRenderer(net.minecraft.client.font.TextRenderer)

Aggregations

TextureManager (net.minecraft.client.texture.TextureManager)3 DrawOverlayEvent (com.tangykiwi.kiwiclient.event.DrawOverlayEvent)1 MinecraftClient (net.minecraft.client.MinecraftClient)1 TextRenderer (net.minecraft.client.font.TextRenderer)1 ShaderEffect (net.minecraft.client.gl.ShaderEffect)1 MatrixStack (net.minecraft.client.util.math.MatrixStack)1 ResourceManager (net.minecraft.resource.ResourceManager)1 Identifier (net.minecraft.util.Identifier)1 Matrix4f (net.minecraft.util.math.Matrix4f)1