-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix custom ShaderInstance class crash
- Loading branch information
Showing
3 changed files
with
30 additions
and
24 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
src/main/java/xyz/bluspring/kilt/forgeinjects/client/renderer/GameRendererInject.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package xyz.bluspring.kilt.forgeinjects.client.renderer; | ||
|
||
import com.llamalad7.mixinextras.sugar.Local; | ||
import com.mojang.datafixers.util.Pair; | ||
import net.minecraft.client.renderer.GameRenderer; | ||
import net.minecraft.client.renderer.ShaderInstance; | ||
import net.minecraft.server.packs.resources.ResourceProvider; | ||
import net.minecraftforge.client.event.RegisterShadersEvent; | ||
import net.minecraftforge.fml.ModLoader; | ||
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 java.util.List; | ||
import java.util.function.Consumer; | ||
|
||
@Mixin(GameRenderer.class) | ||
public abstract class GameRendererInject { | ||
@Inject( | ||
method = "reloadShaders", | ||
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 = "(Lnet/minecraft/server/packs/resources/ResourceProvider;Ljava/lang/String;Lcom/mojang/blaze3d/vertex/VertexFormat;)Lnet/minecraft/client/renderer/ShaderInstance;", ordinal = 0)) | ||
) | ||
private void registerShaders(ResourceProvider resourceProvider, CallbackInfo ci, @Local(ordinal = 1) List<Pair<ShaderInstance, Consumer<ShaderInstance>>> list) { | ||
ModLoader.get().postEvent(new RegisterShadersEvent(resourceProvider, list)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters