diff options
author | Linnea Gräf <nea@nea.moe> | 2024-09-07 14:44:43 +0200 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-09-07 14:44:43 +0200 |
commit | 26461deda4dc8695dacedefe50d976eb5e3d7714 (patch) | |
tree | c079a8c2330df05037f944d6d7068b9ea39ebc24 /src/main/java/moe/nea/firmament | |
parent | 9cdc30e024fac9fe04eeeccb15dfd46f4aa648cb (diff) | |
download | firmament-26461deda4dc8695dacedefe50d976eb5e3d7714.tar.gz firmament-26461deda4dc8695dacedefe50d976eb5e3d7714.tar.bz2 firmament-26461deda4dc8695dacedefe50d976eb5e3d7714.zip |
Add shader loading functionality
[no changelog]
Diffstat (limited to 'src/main/java/moe/nea/firmament')
-rw-r--r-- | src/main/java/moe/nea/firmament/mixins/InjectCustomShaderPrograms.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/main/java/moe/nea/firmament/mixins/InjectCustomShaderPrograms.java b/src/main/java/moe/nea/firmament/mixins/InjectCustomShaderPrograms.java new file mode 100644 index 0000000..5306e42 --- /dev/null +++ b/src/main/java/moe/nea/firmament/mixins/InjectCustomShaderPrograms.java @@ -0,0 +1,31 @@ +package moe.nea.firmament.mixins; + +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; +import com.llamalad7.mixinextras.sugar.Local; +import com.mojang.datafixers.util.Pair; +import moe.nea.firmament.events.RegisterCustomShadersEvent; +import net.minecraft.client.gl.ShaderProgram; +import net.minecraft.client.render.GameRenderer; +import net.minecraft.resource.ResourceFactory; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import java.util.List; +import java.util.function.Consumer; + +@Mixin(GameRenderer.class) +public class InjectCustomShaderPrograms { + + @Inject(method = "loadPrograms", + at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/GameRenderer;loadBlurPostProcessor(Lnet/minecraft/resource/ResourceFactory;)V", + shift = At.Shift.AFTER)) + void addFirmamentShaders( + ResourceFactory resourceFactory, CallbackInfo ci, + @Local(index = 3) List<Pair<ShaderProgram, Consumer<ShaderProgram>>> list + ) { + var event = new RegisterCustomShadersEvent(list, resourceFactory); + RegisterCustomShadersEvent.Companion.publish(event); + } +} |