forked from maruohon/malilib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ Adjusted RenderEventHandler to be added to layeredDrawer
- Loading branch information
1 parent
0b4935c
commit 28de853
Showing
1 changed file
with
20 additions
and
12 deletions.
There are no files selected for viewing
32 changes: 20 additions & 12 deletions
32
src/main/java/fi/dy/masa/malilib/mixin/MixinInGameHud.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 |
---|---|---|
@@ -1,25 +1,33 @@ | ||
package fi.dy.masa.malilib.mixin; | ||
|
||
import fi.dy.masa.malilib.event.RenderEventHandler; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.client.gui.DrawContext; | ||
import net.minecraft.client.gui.LayeredDrawer; | ||
import net.minecraft.client.gui.hud.InGameHud; | ||
import net.minecraft.client.render.RenderTickCounter; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.client.gui.DrawContext; | ||
import net.minecraft.client.gui.hud.InGameHud; | ||
import net.minecraft.client.render.RenderTickCounter; | ||
import fi.dy.masa.malilib.event.RenderEventHandler; | ||
|
||
@Mixin(InGameHud.class) | ||
public abstract class MixinInGameHud | ||
{ | ||
@Shadow @Final private MinecraftClient client; | ||
@Mixin(value = InGameHud.class) | ||
public abstract class MixinInGameHud { | ||
@Shadow | ||
@Final | ||
private MinecraftClient client; | ||
@Shadow | ||
@Final | ||
private LayeredDrawer layeredDrawer; | ||
|
||
@Inject(method = "<init>", at = @At("TAIL")) | ||
private void onInit(CallbackInfo info) { | ||
this.layeredDrawer.addLayer(this::renderChatOverwrite); | ||
} | ||
|
||
@Inject(method = "render", at = @At("RETURN")) | ||
private void onGameOverlayPost(DrawContext context, RenderTickCounter tickCounter, CallbackInfo ci) | ||
{ | ||
private void renderChatOverwrite(DrawContext context, RenderTickCounter tickCounter) { | ||
((RenderEventHandler) RenderEventHandler.getInstance()).onRenderGameOverlayPost(context, this.client, tickCounter.getTickDelta(false)); | ||
} | ||
} |