@@ -21,12 +21,20 @@ import net.minecraft.util.ResourceLocation
2121// $$ import com.mojang.blaze3d.vertex.VertexFormatElement
2222// $$ import com.mojang.blaze3d.pipeline.BlendFunction
2323// $$ import com.mojang.blaze3d.pipeline.RenderPipeline
24+ // #if MC >= 26.1
25+ // $$ import com.mojang.blaze3d.pipeline.ColorTargetState
26+ // $$ import com.mojang.blaze3d.pipeline.DepthStencilState
27+ // $$ import com.mojang.blaze3d.platform.CompareOp
28+ // #else
2429// $$ import com.mojang.blaze3d.platform.DepthTestFunction
2530// $$ import com.mojang.blaze3d.platform.LogicOp
31+ // #endif
2632// $$ import com.mojang.blaze3d.shaders.ShaderType
2733// $$ import com.mojang.blaze3d.systems.RenderPass
2834// $$ import gg.essential.universal.shader.ShaderTransformer
35+ // #if MC < 26.1
2936// $$ import net.minecraft.client.gl.GlResourceManager
37+ // #endif
3038// $$ import net.minecraft.client.gl.UniformType
3139// $$ import net.minecraft.client.render.BuiltBuffer
3240// $$ import org.apache.commons.codec.digest.DigestUtils
@@ -324,6 +332,7 @@ class URenderPipeline private constructor(
324332 interface BuilderProps {
325333 var depthTest: DepthTest
326334 var culling: Boolean
335+ @Deprecated(" Unsupported as of Minecraft 26.1" )
327336 var colorLogic: ColorLogic
328337 var blendState: BlendState
329338 var colorMask: Pair < /* rgb*/ Boolean , /* alpha*/ Boolean >
@@ -338,6 +347,7 @@ class URenderPipeline private constructor(
338347 private data class BuilderPropsImpl (
339348 override var depthTest : DepthTest ,
340349 override var culling : Boolean ,
350+ @Deprecated(" Unsupported as of Minecraft 26.1" )
341351 override var colorLogic : ColorLogic ,
342352 override var blendState : BlendState ,
343353 override var colorMask : Pair <Boolean , Boolean >,
@@ -425,6 +435,18 @@ class URenderPipeline private constructor(
425435 // $$ shader.uniforms.forEach { withUniform(it.key, it.value) }
426436 // $$ }
427437 // $$ }
438+ // #if MC >= 26.1
439+ // $$ if (depthTest != DepthTest.Disabled) {
440+ // $$ withDepthStencilState(DepthStencilState(when (depthTest) {
441+ // $$ DepthTest.Disabled -> throw AssertionError("unreachable")
442+ // $$ DepthTest.Always -> CompareOp.ALWAYS_PASS
443+ // $$ DepthTest.Equal -> CompareOp.EQUAL
444+ // $$ DepthTest.LessOrEqual -> CompareOp.LESS_THAN_OR_EQUAL
445+ // $$ DepthTest.Less -> CompareOp.LESS_THAN
446+ // $$ DepthTest.Greater -> CompareOp.GREATER_THAN
447+ // $$ }, depthMask, polygonOffset.first, polygonOffset.second))
448+ // $$ }
449+ // #else
428450 // $$ withDepthTestFunction(when (depthTest) {
429451 // $$ DepthTest.Disabled -> DepthTestFunction.NO_DEPTH_TEST
430452 // $$ DepthTest.Always -> DepthTestFunction.NO_DEPTH_TEST // implemented via raw GlStateManager below
@@ -433,7 +455,29 @@ class URenderPipeline private constructor(
433455 // $$ DepthTest.Less -> DepthTestFunction.LESS_DEPTH_TEST
434456 // $$ DepthTest.Greater -> DepthTestFunction.GREATER_DEPTH_TEST
435457 // $$ })
458+ // $$ withDepthWrite(depthMask)
459+ // $$ polygonOffset.let { (factor, units) ->
460+ // $$ withDepthBias(factor, units)
461+ // $$ }
462+ // #endif
436463 // $$ withCull(culling)
464+ // #if MC >= 26.1
465+ // $$ withColorTargetState(ColorTargetState(
466+ // $$ java.util.Optional.ofNullable(if (blendState.enabled) BlendFunction(
467+ // $$ blendState.srcRgb.mcSourceFactor,
468+ // $$ blendState.dstRgb.mcDestFactor,
469+ // $$ blendState.srcAlpha.mcSourceFactor,
470+ // $$ blendState.dstAlpha.mcDestFactor,
471+ // $$ ) else null),
472+ // $$ colorMask.let { (colorMask, alphaMask) ->
473+ // $$ var flags = 0
474+ // $$ if (colorMask) flags += ColorTargetState.WRITE_COLOR
475+ // $$ if (alphaMask) flags += ColorTargetState.WRITE_ALPHA
476+ // $$ flags
477+ // $$ }
478+ // $$ ))
479+ // #else
480+ // $$ @Suppress("DEPRECATION")
437481 // $$ withColorLogic(when (colorLogic) {
438482 // $$ ColorLogic.None -> LogicOp.NONE
439483 // $$ ColorLogic.OrReverse -> LogicOp.OR_REVERSE
@@ -452,12 +496,10 @@ class URenderPipeline private constructor(
452496 // $$ colorMask.let { (colorMask, alphaMask) ->
453497 // $$ withColorWrite(colorMask, alphaMask)
454498 // $$ }
455- // $$ withDepthWrite(depthMask)
456- // $$ polygonOffset.let { (factor, units) ->
457- // $$ withDepthBias(factor, units)
458- // $$ }
499+ // #endif
459500 // $$ }.build()
460501 // $$
502+ // #if MC < 26.1
461503 // $$ if (depthTest == DepthTest.Always) {
462504 // $$ abstract class CustomRenderPipeline(inner: RenderPipeline) : RenderPipeline(
463505 // $$ inner.location, inner.vertexShader, inner.fragmentShader, inner.shaderDefines, inner.samplers, inner.uniforms, inner.blendFunction, inner.depthTestFunction, inner.polygonMode, inner.isCull, inner.isWriteColor, inner.isWriteAlpha, inner.isWriteDepth, inner.colorLogic, inner.vertexFormat, inner.vertexFormatMode, inner.depthBiasScaleFactor, inner.depthBiasConstant,
@@ -476,6 +518,7 @@ class URenderPipeline private constructor(
476518 // $$ }
477519 // $$ }
478520 // $$ }
521+ // #endif
479522 // $$
480523 // $$ return URenderPipeline(
481524 // $$ id,
@@ -502,8 +545,8 @@ class URenderPipeline private constructor(
502545 DepthTest .Greater -> GL11 .GL_GREATER
503546 },
504547 culling = culling,
505- colorLogicOp = colorLogic != ColorLogic .None ,
506- colorLogicOpMode = when (colorLogic) {
548+ colorLogicOp = @Suppress( " DEPRECATION " ) colorLogic != ColorLogic .None ,
549+ colorLogicOpMode = @Suppress( " DEPRECATION " ) when (colorLogic) {
507550 ColorLogic .None -> GL11 .GL_COPY
508551 ColorLogic .OrReverse -> GL11 .GL_OR_REVERSE
509552 },
@@ -603,7 +646,13 @@ class URenderPipeline private constructor(
603646 // $$ ?: throw IllegalArgumentException("No default shader for $format.")
604647 // #if MC>=12105
605648 // $$ val shaderId = Identifier.ofVanilla(shader)
606- // $$ val samplers = List(format.mc.elements.count { it.usage == VertexFormatElement.Usage.UV }) { i -> "Sampler$i" }
649+ // $$ val samplers = List(format.mc.elements.count {
650+ // #if MC >= 26.1
651+ // $$ it == VertexFormatElement.UV0 || it == VertexFormatElement.UV1 || it == VertexFormatElement.UV2
652+ // #else
653+ // $$ it.usage == VertexFormatElement.Usage.UV
654+ // #endif
655+ // $$ }) { i -> "Sampler$i" }
607656 // $$ val uniforms = mapOf(
608657 // #if MC>=12106
609658 // $$ "DynamicTransforms" to UniformType.UNIFORM_BUFFER,
0 commit comments