|
1 | 1 | package galena.oreganized.mixin.client;
|
2 | 2 |
|
| 3 | +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; |
| 4 | +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; |
3 | 5 | import com.llamalad7.mixinextras.sugar.Local;
|
4 | 6 | import galena.oreganized.client.render.gui.OGui;
|
5 | 7 | import galena.oreganized.index.OEffects;
|
|
8 | 10 | import net.minecraft.world.entity.player.Player;
|
9 | 11 | import org.spongepowered.asm.mixin.Mixin;
|
10 | 12 | import org.spongepowered.asm.mixin.injection.At;
|
11 |
| -import org.spongepowered.asm.mixin.injection.Redirect; |
12 | 13 | import org.spongepowered.asm.mixin.injection.Slice;
|
13 | 14 |
|
14 | 15 | @Mixin(Gui.class)
|
15 | 16 | public class GuiMixin {
|
16 | 17 |
|
17 |
| - @Redirect( |
| 18 | + @WrapOperation( |
18 | 19 | method = "renderHearts(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/world/entity/player/Player;IIIIFIIIZ)V",
|
19 | 20 | at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/Gui;renderHeart(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/client/gui/Gui$HeartType;IIIZZ)V"),
|
20 | 21 | slice = @Slice(
|
21 | 22 | from = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/Gui;renderHeart(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/client/gui/Gui$HeartType;IIIZZ)V", ordinal = 1),
|
22 | 23 | to = @At("TAIL")
|
23 | 24 | )
|
24 | 25 | )
|
25 |
| - private void renderStunnedHeart(Gui instance, GuiGraphics graphics, Gui.HeartType type, int x, int y, int v, boolean blinking, boolean half, @Local Player player) { |
26 |
| - var accessor = (GuiAccessor) instance; |
27 |
| - |
| 26 | + private void renderStunnedHeart(Gui instance, GuiGraphics graphics, Gui.HeartType type, int x, int y, int v, boolean blinking, boolean half, Operation<Void> original, @Local Player player) { |
28 | 27 | if (player.hasEffect(OEffects.STUNNING.get()) && (type == Gui.HeartType.NORMAL || type == Gui.HeartType.POISIONED)) {
|
29 | 28 | var u = type.getX(half, blinking);
|
30 | 29 | OGui.renderStunnedHeart(graphics, u - 52, x, y, v / 5);
|
31 | 30 | } else {
|
32 |
| - accessor.callRenderHeart(graphics, type, x, y, v, blinking, half); |
| 31 | + original.call(instance, graphics, type, x, y, v, blinking, half); |
33 | 32 | }
|
34 | 33 | }
|
35 | 34 |
|
|
0 commit comments