Skip to content
On this page
Common

ClientPostEffectApi

top.katton.apicommon/src/main/kotlin/top/katton/api/ClientPostEffectApi.kt
Register a runtime client post effect from Minecraft 26.x post-effect JSON.

registerClientPostEffect

registerClientPostEffectCommonFunction
kotlin
fun registerClientPostEffect(id: Identifier, postEffectJson: String, fragmentShaders: Map<Identifier, String> = emptyMap(), vertexShaders: Map<Identifier, String> = emptyMap()): Boolean

Register a runtime client post effect from Minecraft 26.x post-effect JSON.

The JSON is the same format used by resource packs at assets/<namespace>/post_effect/<path>.json. Custom shader ids referenced from that JSON can be supplied through [fragmentShaders] and [vertexShaders].

registerClientPostEffect

registerClientPostEffectCommonFunction
kotlin
fun registerClientPostEffect(id: Identifier): Boolean

Register a runtime client post effect by reading assets/<namespace>/post_effect/<path>.json from the active resource packs.

Shader and texture resources referenced by the JSON are also checked. Missing resources are logged as warnings and the post effect JSON must exist for this function to return true.

registerSimpleClientPostEffect

registerSimpleClientPostEffectCommonFunction
kotlin
fun registerSimpleClientPostEffect(id: String, fragmentShaderSource: String, fragmentShaderId: String? = null, uniformsJson: String = "{}"): Boolean

Build and register a simple one-pass full-screen effect.

[fragmentShaderSource] should define a post-processing fragment shader that samples InSampler and writes fragColor. The generated chain renders minecraft:main -> swap -> minecraft:main.