Skip to content

Commit

Permalink
Fix CoreShaderRegistrationCallback mixin (#3886)
Browse files Browse the repository at this point in the history
  • Loading branch information
modmuss50 authored Jun 25, 2024
1 parent 716be68 commit 5a8c785
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@
import java.util.List;
import java.util.function.Consumer;

import com.llamalad7.mixinextras.sugar.Local;
import com.mojang.datafixers.util.Pair;
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.Slice;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;

import net.minecraft.client.gl.ShaderProgram;
import net.minecraft.client.render.GameRenderer;
Expand All @@ -42,11 +41,9 @@
abstract class GameRendererMixin {
@Inject(
method = "loadPrograms",
at = @At(value = "INVOKE", target = "Ljava/util/List;add(Ljava/lang/Object;)Z", remap = false, shift = At.Shift.AFTER),
slice = @Slice(from = @At(value = "NEW", target = "net/minecraft/client/gl/ShaderProgram", ordinal = 0)),
locals = LocalCapture.CAPTURE_FAILHARD
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/GameRenderer;loadBlurPostProcessor(Lnet/minecraft/resource/ResourceFactory;)V")
)
private void registerShaders(ResourceFactory factory, CallbackInfo info, List<?> shaderStages, List<Pair<ShaderProgram, Consumer<ShaderProgram>>> programs) throws IOException {
private void registerShaders(ResourceFactory factory, CallbackInfo info, @Local(ordinal = 0) List<?> shaderStages, @Local(ordinal = 1) List<Pair<ShaderProgram, Consumer<ShaderProgram>>> programs) throws IOException {
CoreShaderRegistrationCallback.RegistrationContext context = (id, vertexFormat, loadCallback) -> {
ShaderProgram program = new FabricShaderProgram(factory, id, vertexFormat);
programs.add(Pair.of(program, loadCallback));
Expand Down

0 comments on commit 5a8c785

Please sign in to comment.