HTTPS
https://git.nageyqma.icu/nageyqma/odin_next.git
SSH
git@git.nageyqma.icu:nageyqma/odin_next.git
HTTPS 链接可直接 git clone;推送代码请使用 SSH。
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
package com.odtheking.odin.utils
import com.mojang.renderpearl.api.pipeline.RenderPipeline
import com.odtheking.odin.utils.render.CustomRenderType
import net.fabricmc.loader.api.FabricLoader
import net.irisshaders.iris.api.v0.IrisApi
import net.irisshaders.iris.api.v0.IrisProgram
import net.minecraft.client.renderer.rendertype.RenderType
/**
* Created by @j10a1n15
*/
interface IrisCompatability {
fun registerPipeline(pipeline: RenderPipeline, shaderType: IrisShaderType) {}
fun registerRenderType(pipeline: RenderType, shaderType: IrisShaderType) {
registerPipeline(pipeline.pipeline(), shaderType)
}
companion object : IrisCompatability by resolve() {
init {
registerRenderType(CustomRenderType.LINES_ESP, IrisShaderType.LINES)
registerRenderType(CustomRenderType.LINES_TRANSLUCENT_ESP, IrisShaderType.LINES)
registerRenderType(CustomRenderType.QUADS_ESP, IrisShaderType.BASIC)
}
}
}
enum class IrisShaderType {
LINES,
BASIC,
}
internal object IrisCompatImpl : IrisCompatability {
private val instance by lazy { IrisApi.getInstance() }
override fun registerPipeline(pipeline: RenderPipeline, shaderType: IrisShaderType) {
val type = when (shaderType) {
IrisShaderType.BASIC -> IrisProgram.BASIC
IrisShaderType.LINES -> IrisProgram.LINES
}
instance.assignPipeline(pipeline, type)
}
}
internal object IrisCompatNoOp : IrisCompatability
internal fun resolve(): IrisCompatability = if (FabricLoader.getInstance().isModLoaded("iris")) IrisCompatImpl else IrisCompatNoOp