Don't throw actual exception when custom tex color shader fails to load
This commit is contained in:
parent
64d5f1b336
commit
0754cf55eb
@ -12,6 +12,7 @@ import net.minecraft.client.renderer.ShaderInstance
|
|||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite
|
||||||
import net.minecraft.resources.ResourceLocation
|
import net.minecraft.resources.ResourceLocation
|
||||||
import net.minecraft.server.packs.resources.ResourceProvider
|
import net.minecraft.server.packs.resources.ResourceProvider
|
||||||
|
import org.apache.logging.log4j.LogManager
|
||||||
import org.joml.Matrix4f
|
import org.joml.Matrix4f
|
||||||
import org.lwjgl.opengl.GL11.GL_ALWAYS
|
import org.lwjgl.opengl.GL11.GL_ALWAYS
|
||||||
import org.lwjgl.opengl.GL11.GL_LESS
|
import org.lwjgl.opengl.GL11.GL_LESS
|
||||||
@ -39,11 +40,16 @@ var lockBlendFunc = false
|
|||||||
|
|
||||||
private val defaultUV = UVCoords(0f, 0f, 1f, 1f)
|
private val defaultUV = UVCoords(0f, 0f, 1f, 1f)
|
||||||
|
|
||||||
|
private val LOGGER = LogManager.getLogger()
|
||||||
var customTexColorShader: ShaderInstance by Delegates.notNull()
|
var customTexColorShader: ShaderInstance by Delegates.notNull()
|
||||||
private set
|
private set
|
||||||
|
|
||||||
fun reloadShaders(provider: ResourceProvider) {
|
fun reloadShaders(provider: ResourceProvider) {
|
||||||
customTexColorShader = ShaderInstance(provider, ResourceLocation(OverdriveThatMatters.MOD_ID, "position_tex_color"), DefaultVertexFormat.POSITION_TEX_COLOR)
|
try {
|
||||||
|
customTexColorShader = ShaderInstance(provider, ResourceLocation(OverdriveThatMatters.MOD_ID, "position_tex_color"), DefaultVertexFormat.POSITION_TEX_COLOR)
|
||||||
|
} catch (err: Throwable) {
|
||||||
|
LOGGER.error("Failed to load custom tex color shader, this gonna result in uninitialized property exception later", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun renderRect(
|
fun renderRect(
|
||||||
|
Loading…
Reference in New Issue
Block a user