From 6f5ef9dacede839292f6295c61a3b28b8fabf973 Mon Sep 17 00:00:00 2001 From: Username404-59 Date: Tue, 13 Apr 2021 10:48:37 +0200 Subject: [PATCH] Revert "Add a try and catch in the render function of ClickBox.kt." This reverts commit 56896651a3622194660d57c733ab55be841b56b8. --- .../fr/username404/snowygui/gui/ClickBox.kt | 37 ++++++++----------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/common/src/main/kotlin/fr/username404/snowygui/gui/ClickBox.kt b/common/src/main/kotlin/fr/username404/snowygui/gui/ClickBox.kt index c69daf0..00b6253 100644 --- a/common/src/main/kotlin/fr/username404/snowygui/gui/ClickBox.kt +++ b/common/src/main/kotlin/fr/username404/snowygui/gui/ClickBox.kt @@ -3,7 +3,6 @@ package fr.username404.snowygui.gui import com.mojang.blaze3d.systems.RenderSystem import com.mojang.blaze3d.vertex.DefaultVertexFormat import com.mojang.blaze3d.vertex.PoseStack -import fr.username404.snowygui.Snowy import net.minecraft.client.Minecraft import net.minecraft.network.chat.TranslatableComponent import org.lwjgl.opengl.GL20 @@ -17,28 +16,24 @@ class ClickBox(x: Double, y: Double, private val name: TranslatableComponent? = RenderSystem.enableBlend() RenderSystem.defaultBlendFunc() with(buffer) { - try { - begin(GL20.GL_POLYGON, DefaultVertexFormat.POSITION_COLOR) - // Render the header: - vertex(x, y + height, 0.0).colorEnd() - vertex(x + width + inclination, y + height, 0.0).colorEnd() - vertex(x + width, y, 0.0).colorEnd() - vertex(x + inclination, y, 0.0).colorEnd() + begin(GL20.GL_POLYGON, DefaultVertexFormat.POSITION_COLOR) + // Render the header: + vertex(x, y + height, 0.0).colorEnd() + vertex(x + width + inclination, y + height, 0.0).colorEnd() + vertex(x + width, y, 0.0).colorEnd() + vertex(x + inclination, y, 0.0).colorEnd() - // Render the box: - val fullHeight = (y + height) + 80 - vertex(x, fullHeight, 0.0).colorEnd() - vertex(x + width + inclination, fullHeight, 0.0).colorEnd() - vertex(x + width + inclination, y + height, 0.0).colorEnd() - tessellator.end() + // Render the box: + val fullHeight = (y + height) + 80 + vertex(x, fullHeight, 0.0).colorEnd() + vertex(x + width + inclination, fullHeight, 0.0).colorEnd() + vertex(x + width + inclination, y + height, 0.0).colorEnd() + tessellator.end() - begin(GL20.GL_LINES, DefaultVertexFormat.POSITION_COLOR) - vertex(x + inclination, y + height, 0.0).colorIt(0xF2F2FC).endVertex() - vertex(x + width, y + height, 0.0).colorIt(0xF2F2FC).endVertex() - tessellator.end() - } catch (e: Error) { - Snowy.logs.error("Error caught when rendering a ClickBox: $e") - } + begin(GL20.GL_LINES, DefaultVertexFormat.POSITION_COLOR) + vertex(x + inclination, y + height, 0.0).colorIt(0xF2F2FC).endVertex() + vertex(x + width, y + height, 0.0).colorIt(0xF2F2FC).endVertex() + tessellator.end() } RenderSystem.enableTexture() RenderSystem.disableBlend()