diff --git a/src/main/java/com/falsepattern/lib/util/RenderUtil.java b/src/main/java/com/falsepattern/lib/util/RenderUtil.java index 7d2cceb..2c30ebd 100644 --- a/src/main/java/com/falsepattern/lib/util/RenderUtil.java +++ b/src/main/java/com/falsepattern/lib/util/RenderUtil.java @@ -23,11 +23,13 @@ package com.falsepattern.lib.util; import com.falsepattern.lib.StableAPI; +import com.falsepattern.lib.internal.Tags; import com.falsepattern.lib.internal.render.ClampedIcon; import com.falsepattern.lib.internal.render.FullTextureIcon; import lombok.SneakyThrows; import lombok.experimental.UtilityClass; import lombok.val; +import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import net.minecraft.client.Minecraft; @@ -45,6 +47,7 @@ import static net.minecraft.client.Minecraft.getMinecraft; @StableAPI(since = "0.8.0") public final class RenderUtil { private static final Timer MINECRAFT_TIMER = getMinecraftTimer(); + private static final ResourceLocation EMPTY_TEXTURE = new ResourceLocation(Tags.MODID, "textures/gui/empty_texture.png"); /** * Sets the OpenGL translation, relative to the player's position. @@ -95,6 +98,19 @@ public final class RenderUtil { return new ClampedIcon(icon); } + /** + * Binds an empty texture. + *

+ * When rendering without shaders, using {@link GL11#glDisable(int)} with {@link GL11#GL_TEXTURE_2D} + * is sufficient to achieve the same effect. + *

+ * However, when shaders are enabled, disabling textures using this method will have no effect. Therefore this method can be used as a workaround. + */ + // TODO: Define stable API Version + public static void bindEmptyTexture() { + getMinecraft().renderEngine.bindTexture(EMPTY_TEXTURE); + } + /** * Provides the partial tick between the last and next client tick, in the range of 0 to 1. *

diff --git a/src/main/resources/assets/falsepatternlib/textures/empty_texture.png b/src/main/resources/assets/falsepatternlib/textures/empty_texture.png new file mode 100644 index 0000000..771c145 Binary files /dev/null and b/src/main/resources/assets/falsepatternlib/textures/empty_texture.png differ diff --git a/src/main/resources/assets/falsepatternlib/textures/empty_texture_n.png b/src/main/resources/assets/falsepatternlib/textures/empty_texture_n.png new file mode 100644 index 0000000..6a2331e Binary files /dev/null and b/src/main/resources/assets/falsepatternlib/textures/empty_texture_n.png differ diff --git a/src/main/resources/assets/falsepatternlib/textures/empty_texture_s.png b/src/main/resources/assets/falsepatternlib/textures/empty_texture_s.png new file mode 100644 index 0000000..aeeb634 Binary files /dev/null and b/src/main/resources/assets/falsepatternlib/textures/empty_texture_s.png differ