From 5f6ab12368126170756b42d03b14ba4381bdf666 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=A8=E8=91=89=20Scarlet?= <93977077+mukjepscarlet@users.noreply.github.com> Date: Sun, 22 Dec 2024 23:42:05 +0800 Subject: [PATCH] Background Tessellator --- .../utils/render/shader/Background.kt | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/render/shader/Background.kt b/src/main/java/net/ccbluex/liquidbounce/utils/render/shader/Background.kt index 5ede6801b0b..a4f17013c23 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/render/shader/Background.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/render/shader/Background.kt @@ -8,10 +8,10 @@ package net.ccbluex.liquidbounce.utils.render.shader import net.ccbluex.liquidbounce.LiquidBounce.CLIENT_NAME import net.ccbluex.liquidbounce.utils.client.ClientUtils.LOGGER import net.ccbluex.liquidbounce.utils.client.MinecraftInstance.Companion.mc +import net.ccbluex.liquidbounce.utils.render.drawWithTessellatorWorldRenderer import net.ccbluex.liquidbounce.utils.render.shader.shaders.BackgroundShader import net.minecraft.client.gui.Gui import net.minecraft.client.renderer.GlStateManager.color -import net.minecraft.client.renderer.Tessellator import net.minecraft.client.renderer.texture.DynamicTexture import net.minecraft.client.renderer.vertex.DefaultVertexFormats import net.minecraft.util.ResourceLocation @@ -88,14 +88,13 @@ private class ShaderBackground(backgroundFile: File) : Background(backgroundFile if (shaderInitialized) { shader.startShader() - val instance = Tessellator.getInstance() - val worldRenderer = instance.worldRenderer - worldRenderer.begin(7, DefaultVertexFormats.POSITION) - worldRenderer.pos(0.0, height.toDouble(), 0.0).endVertex() - worldRenderer.pos(width.toDouble(), height.toDouble(), 0.0).endVertex() - worldRenderer.pos(width.toDouble(), 0.0, 0.0).endVertex() - worldRenderer.pos(0.0, 0.0, 0.0).endVertex() - instance.draw() + drawWithTessellatorWorldRenderer { + begin(7, DefaultVertexFormats.POSITION) + pos(0.0, height.toDouble(), 0.0).endVertex() + pos(width.toDouble(), height.toDouble(), 0.0).endVertex() + pos(width.toDouble(), 0.0, 0.0).endVertex() + pos(0.0, 0.0, 0.0).endVertex() + } shader.stopShader() }