Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ dependencies {
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation "com.terraformersmc:modmenu:${project.modmenu_version}"
modApi("me.shedaniel.cloth:cloth-config-fabric:${project.cloth_config_version}") {
modImplementation include(fabricApi.module("fabric-api-base", project.fabric_version))
modImplementation include(fabricApi.module("fabric-rendering-v1", project.fabric_version))
modImplementation include(fabricApi.module("fabric-lifecycle-events-v1", project.fabric_version))

modImplementation include("com.terraformersmc:modmenu:${project.modmenu_version}")
modImplementation include("me.shedaniel.cloth:cloth-config-fabric:${project.cloth_config_version}") {
exclude(group: "net.fabricmc.fabric-api")
}

Expand Down Expand Up @@ -82,4 +85,4 @@ publishing {
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
}
}
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.21.9
yarn_mappings=1.21.9+build.1
minecraft_version=1.21
yarn_mappings=1.21+build.9
loader_version=0.17.3
loom_version=1.11-SNAPSHOT

# Mod Properties
mod_version=2.0.1
mod_version=2.0.2
maven_group=dsns.betterhud
archives_base_name=betterhud

# Dependencies
fabric_version=0.134.0+1.21.9
modmenu_version=15.0.0-beta.3
cloth_config_version=19.0.147
fabric_version=0.102.0+1.21
modmenu_version=14.0.2
cloth_config_version=19.0.147
9 changes: 3 additions & 6 deletions src/main/java/dsns/betterhud/BetterHUD.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.rendering.v1.hud.HudElementRegistry;
import net.minecraft.util.Identifier;
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -39,10 +38,8 @@ public void onInitializeClient() {

BetterHUDGUI betterHUDGUI = new BetterHUDGUI();

HudElementRegistry.addLast(
Identifier.of("betterhud", "hud"),
betterHUDGUI::onHudRender
);
// 1.21 fallback
HudRenderCallback.EVENT.register(betterHUDGUI);
ClientTickEvents.START_CLIENT_TICK.register(betterHUDGUI);
}
}
4 changes: 3 additions & 1 deletion src/main/java/dsns/betterhud/BetterHUDGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import java.util.List;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.RenderTickCounter;

public class BetterHUDGUI implements ClientTickEvents.StartTick {
public class BetterHUDGUI
implements HudRenderCallback, ClientTickEvents.StartTick {

public static int verticalPadding = 4;
public static int horizontalPadding = 4;
Expand Down
Loading