From 6300ff493fe90fd06162d2f4ce91339c07a50d11 Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Wed, 30 Jul 2025 17:23:41 +0200 Subject: feat(dev): unpleasant gradient cape --- .../render/IncreaseStackLimitSizeInDrawContext.java | 20 ++++++++++++++++++++ src/main/kotlin/features/macros/MacroUI.kt | 12 ++++++++++-- src/main/kotlin/features/misc/CustomCapes.kt | 7 +++++-- src/main/kotlin/util/mc/CustomRenderPassHelper.kt | 2 +- src/main/kotlin/util/render/CustomRenderLayers.kt | 2 +- src/main/kotlin/util/render/RenderCircleProgress.kt | 2 +- .../assets/firmament/gui/config/macros/combos.xml | 2 +- .../assets/firmament/gui/config/macros/wheel.xml | 2 +- .../firmament/shaders/circle_discard_color.fsh | 7 ++++--- .../firmament/textures/cape/unpleasant_gradient.png | Bin 0 -> 176471 bytes 10 files changed, 44 insertions(+), 12 deletions(-) create mode 100644 src/main/java/moe/nea/firmament/mixins/render/IncreaseStackLimitSizeInDrawContext.java create mode 100644 src/main/resources/assets/firmament/textures/cape/unpleasant_gradient.png (limited to 'src') diff --git a/src/main/java/moe/nea/firmament/mixins/render/IncreaseStackLimitSizeInDrawContext.java b/src/main/java/moe/nea/firmament/mixins/render/IncreaseStackLimitSizeInDrawContext.java new file mode 100644 index 0000000..61ad8a3 --- /dev/null +++ b/src/main/java/moe/nea/firmament/mixins/render/IncreaseStackLimitSizeInDrawContext.java @@ -0,0 +1,20 @@ +package moe.nea.firmament.mixins.render; + +import net.minecraft.client.gui.DrawContext; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyArg; + +@Mixin(DrawContext.class) +public class IncreaseStackLimitSizeInDrawContext { + // [22:00:57] [Render thread/ERROR] (Minecraft) Couldn't compile program for pipeline firmament:gui_textured_overlay_tris_circle: + // net.minecraft.client.gl.ShaderLoader$LoadException: Error encountered when linking program containing + // VS minecraft:core/position_tex_color and FS firmament:circle_discard_color. + // Log output: error: declarations for uniform `ColorModulator` are inside block `DynamicTransforms` and outside a block + @ModifyArg( + method = "(Lnet/minecraft/client/MinecraftClient;Lnet/minecraft/client/gui/render/state/GuiRenderState;)V", + at = @At(value = "INVOKE", target = "Lorg/joml/Matrix3x2fStack;(I)V")) + private static int increaseStackSize(int stackSize) { + return Math.max(stackSize, 48); + } +} diff --git a/src/main/kotlin/features/macros/MacroUI.kt b/src/main/kotlin/features/macros/MacroUI.kt index 8c22c5c..5a7d406 100644 --- a/src/main/kotlin/features/macros/MacroUI.kt +++ b/src/main/kotlin/features/macros/MacroUI.kt @@ -1,7 +1,9 @@ package moe.nea.firmament.features.macros +import io.github.notenoughupdates.moulconfig.common.text.StructuredText import io.github.notenoughupdates.moulconfig.gui.CloseEventListener import io.github.notenoughupdates.moulconfig.observer.ObservableList +import io.github.notenoughupdates.moulconfig.platform.MoulConfigPlatform import io.github.notenoughupdates.moulconfig.xml.Bind import moe.nea.firmament.annotations.Subscribe import moe.nea.firmament.commands.thenExecute @@ -61,6 +63,9 @@ class MacroUI { var text: String, val parent: Wheel, ) { + @Bind + fun textR() = StructuredText.of(text) + @Bind fun delete() { parent.editableCommands.removeIf { it === this } @@ -82,7 +87,7 @@ class MacroUI { } @Bind("keyCombo") - fun text() = binding.format().string + fun text() = MoulConfigPlatform.wrap(binding.format()) @field:Bind("commands") val commands = commands.mapTo(ObservableList(mutableListOf())) { Command(it.command, this) } @@ -246,12 +251,15 @@ class MacroUI { @field:Bind("command") var command: String = (action.action as CommandAction).command + @Bind + fun commandR() = StructuredText.of(command) + @field:Bind("combo") val combo = action.keys.map { KeyBindingEditor(it, this) }.toObservableList() @Bind fun formattedCombo() = - combo.joinToString(" > ") { it.binding.toString() } + StructuredText.of(combo.joinToString(" > ") { it.binding.toString() }) // TODO: this can be joined without .toString() @Bind fun addStep() { diff --git a/src/main/kotlin/features/misc/CustomCapes.kt b/src/main/kotlin/features/misc/CustomCapes.kt index d353b38..77a5c2d 100644 --- a/src/main/kotlin/features/misc/CustomCapes.kt +++ b/src/main/kotlin/features/misc/CustomCapes.kt @@ -121,7 +121,10 @@ object CustomCapes : FirmamentFeature { 110.seconds ) ), - + UNPLEASANT_GRADIENT( + "unpleasant_gradient", + TexturedCapeRenderer(Firmament.identifier("textures/cape/unpleasant_gradient.png")) + ), FURFSKY_STATIC( "FurfSky", TexturedCapeRenderer(Firmament.identifier("textures/cape/fsr_static.png")) @@ -140,7 +143,7 @@ object CustomCapes : FirmamentFeature { val byUuid = listOf( listOf( - Devs.nea to AllCapes.FIRMAMENT_ANIMATED, + Devs.nea to AllCapes.UNPLEASANT_GRADIENT, Devs.kath to AllCapes.FIRMAMENT_STATIC, Devs.jani to AllCapes.FIRMAMENT_ANIMATED, ), diff --git a/src/main/kotlin/util/mc/CustomRenderPassHelper.kt b/src/main/kotlin/util/mc/CustomRenderPassHelper.kt index 1bd1148..12f98e4 100644 --- a/src/main/kotlin/util/mc/CustomRenderPassHelper.kt +++ b/src/main/kotlin/util/mc/CustomRenderPassHelper.kt @@ -109,7 +109,7 @@ class CustomRenderPassHelper( } fun allocateByteBuf(size: Int, init: (Std140Builder) -> Unit): ByteBuffer { - return Std140Builder.intoBuffer( + return Std140Builder.intoBuffer( // TODO: i really dont know about this 16 align? but it seems to be generally correct. ByteBuffer .allocateDirect(MathHelper.roundUpToMultiple(size, 16)) .order(ByteOrder.nativeOrder()) diff --git a/src/main/kotlin/util/render/CustomRenderLayers.kt b/src/main/kotlin/util/render/CustomRenderLayers.kt index 912ffdf..13412ec 100644 --- a/src/main/kotlin/util/render/CustomRenderLayers.kt +++ b/src/main/kotlin/util/render/CustomRenderLayers.kt @@ -45,7 +45,7 @@ object CustomRenderPipelines { RenderPipeline.builder(RenderPipelines.POSITION_TEX_COLOR_SNIPPET) .withVertexFormat(VertexFormats.POSITION_TEXTURE_COLOR, DrawMode.TRIANGLES) .withLocation(Firmament.identifier("gui_textured_overlay_tris_circle")) - .withUniform("InnerCutoutRadius", UniformType.UNIFORM_BUFFER) + .withUniform("CutoutRadius", UniformType.UNIFORM_BUFFER) .withFragmentShader(Firmament.identifier("circle_discard_color")) .withBlend(BlendFunction.TRANSLUCENT) .build() diff --git a/src/main/kotlin/util/render/RenderCircleProgress.kt b/src/main/kotlin/util/render/RenderCircleProgress.kt index bbc4ace..2c837d3 100644 --- a/src/main/kotlin/util/render/RenderCircleProgress.kt +++ b/src/main/kotlin/util/render/RenderCircleProgress.kt @@ -98,7 +98,7 @@ object RenderCircleProgress { ).use { renderPass -> renderPass.uploadVertices(buffer) renderPass.setPipeline(state.layer.pipeline) - renderPass.setUniform("InnerCutoutRadius", 4) { + renderPass.setUniform("CutoutRadius", 4) { it.putFloat(state.innerCutoutRadius) } renderPass.draw() diff --git a/src/main/resources/assets/firmament/gui/config/macros/combos.xml b/src/main/resources/assets/firmament/gui/config/macros/combos.xml index 5141125..91edae3 100644 --- a/src/main/resources/assets/firmament/gui/config/macros/combos.xml +++ b/src/main/resources/assets/firmament/gui/config/macros/combos.xml @@ -11,7 +11,7 @@ - + diff --git a/src/main/resources/assets/firmament/gui/config/macros/wheel.xml b/src/main/resources/assets/firmament/gui/config/macros/wheel.xml index 19922fe..80826c9 100644 --- a/src/main/resources/assets/firmament/gui/config/macros/wheel.xml +++ b/src/main/resources/assets/firmament/gui/config/macros/wheel.xml @@ -24,7 +24,7 @@ - + diff --git a/src/main/resources/assets/firmament/shaders/circle_discard_color.fsh b/src/main/resources/assets/firmament/shaders/circle_discard_color.fsh index ae46059..8fcd99f 100644 --- a/src/main/resources/assets/firmament/shaders/circle_discard_color.fsh +++ b/src/main/resources/assets/firmament/shaders/circle_discard_color.fsh @@ -3,8 +3,9 @@ in vec4 vertexColor; in vec2 texCoord0; -uniform vec4 ColorModulator; -uniform float InnerCutoutRadius; +layout(std140) uniform CutoutRadius { + float InnerCutoutRadius; +}; out vec4 fragColor; @@ -18,5 +19,5 @@ void main() { { discard; } - fragColor = color * ColorModulator; + fragColor = color; } diff --git a/src/main/resources/assets/firmament/textures/cape/unpleasant_gradient.png b/src/main/resources/assets/firmament/textures/cape/unpleasant_gradient.png new file mode 100644 index 0000000..da2eb85 Binary files /dev/null and b/src/main/resources/assets/firmament/textures/cape/unpleasant_gradient.png differ -- cgit