Skip to content

Commit 68fc29b

Browse files
committed
render custom hearts for brain damage effect
1 parent bbc554d commit 68fc29b

20 files changed

+13
-5
lines changed

src/main/java/galena/oreganized/client/OreganizedClient.java

+2
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ private static void registerBlockRenderers() {
8383
render(OBlocks.CRYSTAL_GLASS.get(i), translucent);
8484
render(OBlocks.CRYSTAL_GLASS_PANES.get(i), translucent);
8585
}
86+
87+
render(OBlocks.GROOVED_ICE, translucent);
8688
}
8789

8890
@SubscribeEvent

src/main/java/galena/oreganized/client/render/gui/OGui.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
public class OGui extends ForgeGui {
1515

1616
protected static final ResourceLocation STUNNING_VIGNETTE_LOCATION = Oreganized.modLoc( "textures/misc/stunning_overlay.png");
17-
protected static final ResourceLocation STUNNED_HEARTS = Oreganized.modLoc( "textures/misc/hearts/brain_damaged_full.png");
17+
protected static final ResourceLocation STUNNED_HEARTS = Oreganized.modLoc( "textures/gui/stunned_hearts.png");
1818

1919
private static final IntObjectHashMap<ResourceLocation> STUNNING_OVERLAY_LOCATIONS = new IntObjectHashMap<>();
2020

@@ -45,7 +45,7 @@ public void render(GuiGraphics guiGraphics, float partialTick) {
4545
this.renderTextureOverlay(guiGraphics, STUNNING_VIGNETTE_LOCATION, 1F);
4646
}
4747

48-
public static void renderStunnedHeart(GuiGraphics graphics, int x, int y, int v) {
49-
graphics.blit(STUNNED_HEARTS, x, y, 0, v, 9, 9);
48+
public static void renderStunnedHeart(GuiGraphics graphics, int u, int x, int y, int v) {
49+
graphics.blit(STUNNED_HEARTS, x, y, u - 52, v, 9, 9, 72, 18);
5050
}
5151
}

src/main/java/galena/oreganized/mixin/client/GuiMixin.java

+8-2
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,25 @@
99
import org.spongepowered.asm.mixin.Mixin;
1010
import org.spongepowered.asm.mixin.injection.At;
1111
import org.spongepowered.asm.mixin.injection.Redirect;
12+
import org.spongepowered.asm.mixin.injection.Slice;
1213

1314
@Mixin(Gui.class)
1415
public class GuiMixin {
1516

1617
@Redirect(
1718
method = "renderHearts(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/world/entity/player/Player;IIIIFIIIZ)V",
18-
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/Gui;renderHeart(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/client/gui/Gui$HeartType;IIIZZ)V")
19+
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+
slice = @Slice(
21+
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+
to = @At("TAIL")
23+
)
1924
)
2025
private void renderStunnedHeart(Gui instance, GuiGraphics graphics, Gui.HeartType type, int x, int y, int v, boolean flag1, boolean flag2, @Local Player player) {
2126
var accessor = (GuiAccessor) instance;
2227

2328
if (player.hasEffect(OEffects.STUNNING.get())) {
24-
OGui.renderStunnedHeart(graphics, x, y, v);
29+
var u = type.getX(flag1, flag2);
30+
OGui.renderStunnedHeart(graphics, u - 52, x, y, v / 5);
2531
} else {
2632
accessor.callRenderHeart(graphics, type, x, y, v, flag1, flag2);
2733
}
Loading
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)