|
1 | 1 | package net.betterhorses.fabric.platform.events; |
2 | 2 |
|
3 | | -import net.betterhorses.common.BetterHorses; |
4 | 3 | import net.betterhorses.common.ui.HorseStatsHud; |
5 | | -import net.fabricmc.fabric.api.client.rendering.v1.HudLayerRegistrationCallback; |
6 | | -import net.fabricmc.fabric.api.client.rendering.v1.IdentifiedLayer; |
| 4 | +import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback; |
7 | 5 | import net.minecraft.client.MinecraftClient; |
8 | 6 | import net.minecraft.client.gui.DrawContext; |
9 | | -import net.minecraft.client.render.RenderTickCounter; |
10 | 7 | import net.minecraft.entity.passive.HorseEntity; |
11 | | -import net.minecraft.util.Identifier; |
12 | 8 |
|
13 | 9 | public class FabricPlatformClientEvents { |
14 | | - private static final Identifier STATS_LAYER = Identifier.of(BetterHorses.MOD_ID, "hud_stats_layer"); |
15 | 10 |
|
16 | 11 | public static void init() { |
17 | 12 | initHudRenderEvent(); |
18 | 13 | } |
19 | 14 |
|
20 | 15 | private static void initHudRenderEvent() { |
21 | | - HudLayerRegistrationCallback.EVENT.register(layeredDrawer -> |
22 | | - layeredDrawer.attachLayerBefore(IdentifiedLayer.CHAT, STATS_LAYER, FabricPlatformClientEvents::renderHud) |
23 | | - ); |
| 16 | + HudRenderCallback.EVENT.register((drawContext, tickDelta) -> { |
| 17 | + renderHud(drawContext); |
| 18 | + }); |
24 | 19 | } |
25 | 20 |
|
26 | | - private static void renderHud(DrawContext context, RenderTickCounter tickCounter) { |
| 21 | + private static void renderHud(DrawContext context) { |
27 | 22 | MinecraftClient client = MinecraftClient.getInstance(); |
28 | 23 |
|
29 | 24 | if (client.player == null || !client.player.hasVehicle() || !(client.player.getVehicle() instanceof HorseEntity horse)) { |
|
0 commit comments