Skip to content

Commit 6ef55c8

Browse files
committed
Merge branch 'no-texture'
2 parents 5ea71ba + 1006421 commit 6ef55c8

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

src/main/java/com/falsepattern/lib/util/RenderUtil.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@
2323
package com.falsepattern.lib.util;
2424

2525
import com.falsepattern.lib.StableAPI;
26+
import com.falsepattern.lib.internal.Tags;
2627
import com.falsepattern.lib.internal.render.ClampedIcon;
2728
import com.falsepattern.lib.internal.render.FullTextureIcon;
2829
import lombok.SneakyThrows;
2930
import lombok.experimental.UtilityClass;
3031
import lombok.val;
32+
import net.minecraft.util.ResourceLocation;
3133
import org.lwjgl.opengl.GL11;
3234

3335
import net.minecraft.client.Minecraft;
@@ -45,6 +47,7 @@
4547
@StableAPI(since = "0.8.0")
4648
public final class RenderUtil {
4749
private static final Timer MINECRAFT_TIMER = getMinecraftTimer();
50+
private static final ResourceLocation EMPTY_TEXTURE = new ResourceLocation(Tags.MODID, "textures/gui/empty_texture.png");
4851

4952
/**
5053
* Sets the OpenGL translation, relative to the player's position.
@@ -95,6 +98,19 @@ public static IIcon wrapAsClampedIcon(IIcon icon) {
9598
return new ClampedIcon(icon);
9699
}
97100

101+
/**
102+
* Binds an empty texture.
103+
* <p>
104+
* When rendering without shaders, using {@link GL11#glDisable(int)} with {@link GL11#GL_TEXTURE_2D}
105+
* is sufficient to achieve the same effect.
106+
* <p>
107+
* However, when shaders are enabled, disabling textures using this method will have no effect. Therefore this method can be used as a workaround.
108+
*/
109+
@StableAPI.Expose(since = "1.3.0")
110+
public static void bindEmptyTexture() {
111+
getMinecraft().renderEngine.bindTexture(EMPTY_TEXTURE);
112+
}
113+
98114
/**
99115
* Provides the partial tick between the last and next client tick, in the range of 0 to 1.
100116
* <p>
Loading
Loading
Loading

0 commit comments

Comments
 (0)