Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d191686
An attempt to 1.21.11
tanishisherewithhh Feb 26, 2026
a4e8174
Fixed dynamicHUD button position
tanishisherewithhh Apr 10, 2026
823921e
Finally got rounded rectangles to work.
tanishisherewithhh Apr 12, 2026
4ca5a1d
Refactor GlobalConfig.get().getScale()
tanishisherewithhh Apr 12, 2026
a546a2f
Better animations to context menu
tanishisherewithhh Jun 16, 2026
a2a9665
Replaced ListOption and EnumOption with CycleOption
tanishisherewithhh Jun 17, 2026
a00b327
Added Local Widget and ContextMenu scaling
tanishisherewithhh Jun 18, 2026
2c5ae72
OptionGroup animation in ModernSkin
tanishisherewithhh Jun 20, 2026
20ebf28
Added search to ModernSkin
tanishisherewithhh Jun 20, 2026
5bb20b9
SearchBox in ModernSkin redesigned to match the theme.
tanishisherewithhh Jun 21, 2026
c8f8edf
Fix jitter when scrolling
tanishisherewithhh Jun 22, 2026
84bbd48
remove debug msg
tanishisherewithhh Jun 22, 2026
135dfa0
Add search to MinecraftSkin
tanishisherewithhh Jun 22, 2026
4dbf697
Fixed an issue when trying to open contextmenu when multiple widgets …
tanishisherewithhh Jun 22, 2026
199d19a
Improve spline rendering of GraphWidget and position of Y-Axs values
tanishisherewithhh Jun 25, 2026
aaf22a1
More improvements to GraphWidget and now alphaHandleY syncs with alph…
tanishisherewithhh Jun 25, 2026
d0462cb
Added snap alignment guidelines
tanishisherewithhh Jun 25, 2026
8ff9f76
Use better animation pattern
tanishisherewithhh Jun 25, 2026
4aa77ae
Patch some more issues
tanishisherewithhh Jun 25, 2026
60511ff
Added ColorPicker back
tanishisherewithhh Jun 26, 2026
fe1214d
Final improvements before release
tanishisherewithhh Jun 26, 2026
682471d
Bump to 4.0.0
tanishisherewithhh Jun 26, 2026
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
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.10-SNAPSHOT'
id 'net.fabricmc.fabric-loom-remap' version "${loom_version}"
id 'maven-publish'
}

Expand All @@ -13,8 +13,6 @@ base {
allprojects {
apply plugin: "java"
apply plugin: "maven-publish"

archivesBaseName = rootProject.archives_base_name
}

repositories {
Expand All @@ -33,11 +31,14 @@ repositories {
dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
mappings loom.officialMojangMappings()
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

modImplementation "dev.isxander:yet-another-config-lib:${project.yacl_version}"

//fuzzyscore
implementation 'org.apache.commons:commons-text:1.12.0'
}

processResources {
Expand All @@ -64,7 +65,6 @@ java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21

archivesBaseName = project.archives_base_name
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
Expand Down
15 changes: 9 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@
org.gradle.jvmargs=-Xmx1G
org.gradle.parallel=true

# IntelliJ IDEA is not yet fully compatible with configuration cache, see: https://github.com/FabricMC/fabric-loom/issues/1349
org.gradle.configuration-cache=false

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.21.5
yarn_mappings=1.21.5+build.1
loader_version=0.16.10
minecraft_version=1.21.11
loader_version=0.18.2
loom_version=1.14-SNAPSHOT

# Mod Properties
# need versioning system
mod_version = 3.1.0
mod_version = 4.0.0
maven_group = com.tanishisherewith
archives_base_name = dynamichud

# Dependencies
fabric_version=0.119.5+1.21.5
yacl_version=3.6.6+1.21.5-fabric
fabric_version=0.139.4+1.21.11
yacl_version=3.8.2+1.21.11-fabric
5 changes: 3 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStorePath=wrapper/dists
53 changes: 46 additions & 7 deletions src/main/java/com/tanishisherewith/dynamichud/DynamicHUD.java
Original file line number Diff line number Diff line change
@@ -1,25 +1,41 @@
package com.tanishisherewith.dynamichud;

import com.mojang.blaze3d.platform.InputConstants;
import com.tanishisherewith.dynamichud.config.GlobalConfig;
import com.tanishisherewith.dynamichud.helpers.MouseColorQuery;
import com.tanishisherewith.dynamichud.integration.IntegrationManager;
import com.tanishisherewith.dynamichud.widget.WidgetRenderer;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.rendering.v1.HudLayerRegistrationCallback;
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
import net.minecraft.client.MinecraftClient;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.fabricmc.fabric.api.client.rendering.v1.hud.HudElementRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.hud.VanillaHudElements;
import net.fabricmc.fabric.impl.client.rendering.hud.HudElementRegistryImpl;
import net.minecraft.client.KeyMapping;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.rendertype.RenderType;
import net.minecraft.client.renderer.rendertype.RenderTypes;
import net.minecraft.resources.Identifier;
import org.lwjgl.glfw.GLFW;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Environment(EnvType.CLIENT)
public class DynamicHUD implements ClientModInitializer {
public static MinecraftClient MC = MinecraftClient.getInstance();
public static Minecraft MC = Minecraft.getInstance();
public static final Logger logger = LoggerFactory.getLogger("DynamicHud");
public static String MOD_ID = "dynamichud";

static KeyMapping EDITOR_SCREEN_KEYBIND = KeyBindingHelper.registerKeyBinding(new KeyMapping(
"DynamicHud Editor Screen",
InputConstants.Type.KEYSYM,
GLFW.GLFW_KEY_RIGHT_SHIFT,
KeyMapping.Category.register(Identifier.fromNamespaceAndPath("dynamichud", "editor_screen"))
));

public static void printInfo(String msg) {
logger.info(msg);
}
Expand All @@ -28,17 +44,40 @@ public static void printWarn(String msg) {
logger.warn(msg);
}


@Override
public void onInitializeClient() {
printInfo("Initialising DynamicHUD");

//YACL load
GlobalConfig.HANDLER.load();

IntegrationManager.integrate();
ClientLifecycleEvents.CLIENT_STARTED.register((minecraft)-> IntegrationManager.integrate());


//In game screen render.
HudLayerRegistrationCallback.EVENT.register(new HudRender());
/*
* Using the fabric event {@link HudElementRegistry} to render widgets in the game HUD.
* Mouse positions are passed in the negatives even though theoretically it's in the centre of the screen.
*/
HudElementRegistryImpl.attachElementBefore(VanillaHudElements.MISC_OVERLAYS,
Identifier.fromNamespaceAndPath("dynamichud","hudrender_callback"),
(graphics, tickCounter) -> {
for (WidgetRenderer widgetRenderer : IntegrationManager.getWidgetRenderers()) {
widgetRenderer.renderWidgets(graphics, -120, -120);
}
});

ClientTickEvents.END_CLIENT_TICK.register(mc-> MouseColorQuery.processIfPending());
}

/**
* Get applied scale on all widgets, modified by YACL.
* <br>
* From {@link GlobalConfig#getScale()}
* @return scale in float
*/
public static float getGlobalScale() {
return GlobalConfig.get().getScale();
}
}
30 changes: 0 additions & 30 deletions src/main/java/com/tanishisherewith/dynamichud/HudRender.java

This file was deleted.

36 changes: 24 additions & 12 deletions src/main/java/com/tanishisherewith/dynamichud/IntegrationTest.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
package com.tanishisherewith.dynamichud;

import com.mojang.blaze3d.platform.InputConstants;
import com.tanishisherewith.dynamichud.integration.DynamicHudConfigurator;
import com.tanishisherewith.dynamichud.integration.DynamicHudIntegration;
import com.tanishisherewith.dynamichud.screens.AbstractMoveableScreen;
import com.tanishisherewith.dynamichud.utils.DynamicValueRegistry;
import com.tanishisherewith.dynamichud.widget.Widget;
import com.tanishisherewith.dynamichud.widgets.GraphWidget;
import com.tanishisherewith.dynamichud.widgets.TextWidget;
import net.minecraft.client.gui.screen.TitleScreen;
import net.minecraft.text.Text;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.minecraft.client.KeyMapping;
import net.minecraft.client.gui.screens.TitleScreen;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.Identifier;
import org.lwjgl.glfw.GLFW;

import java.awt.*;

Expand All @@ -23,13 +28,13 @@ public class IntegrationTest implements DynamicHudIntegration {
public void init() {
//Global registry
// We recommend using the syntax "modid:key_name" for easier debugging and to prevent data conflicts in global registries.
DynamicValueRegistry.registerGlobal("dynamichud:FPS", () -> "FPS: " + DynamicHUD.MC.getCurrentFps());
DynamicValueRegistry.registerGlobal("dynamichud:FPS", () -> "FPS: " + DynamicHUD.MC.getFps());

//Local registry
registry = new DynamicValueRegistry(DynamicHUD.MOD_ID);
registry.registerLocal("Hello", () -> "Hello " + DynamicHUD.MC.getSession().getUsername() + "!");
registry.registerLocal("Hello", () -> "Hello " + DynamicHUD.MC.getGameProfile().name() + "!");
registry.registerLocal("DynamicHUD", () -> "DynamicHUD");
registry.registerLocal("FPS", () -> DynamicHUD.MC.getCurrentFps());
registry.registerLocal("FPS", () -> DynamicHUD.MC.getFps());

FPSWidget = new TextWidget.Builder()
.setX(250)
Expand Down Expand Up @@ -69,22 +74,24 @@ public void init() {
.setY(100)
.label("FPS Chart")
.graphColor(Color.CYAN)
.anchor(Widget.Anchor.CENTER)
.height(100)
.width(150)
.anchor(Widget.Anchor._default())
.gWidth(100)
.gHeight(60)
.gridLines(10)
.backgroundColor(Color.DARK_GRAY)
.lineThickness(1f)
.backgroundColor(Color.BLACK)
.lineThickness(0.6f)
.maxDataPoints(100)
.maxValue(120)
.minValue(30)
.setModID(DynamicHUD.MOD_ID)
.setDraggable(true)
.setDisplay(true)
.setIsVisible(true)
.showGrid(true)
.shouldScale(true)
.registryKey("FPS")
.registryID(registry.getId())
.build()
.setSampleInterval(120)
.autoUpdateRange();
}

Expand All @@ -99,7 +106,7 @@ public DynamicHudConfigurator configure(DynamicHudConfigurator configurator) {
//renderer.shouldRenderInGameHud(true);
renderer.addScreen(TitleScreen.class);
})
.withMoveableScreen(config -> new AbstractMoveableScreen(Text.literal("Editor Screen"), config.getRenderer()) {});
.withMoveableScreen(config -> new AbstractMoveableScreen(Component.literal("Editor Screen"), config.getRenderer()) {});

return configurator;
}
Expand All @@ -108,4 +115,9 @@ public DynamicHudConfigurator configure(DynamicHudConfigurator configurator) {
public void registerCustomWidgets() {
//WidgetManager.addWidgetData(MyWidget.DATA);
}

@Override
public KeyMapping getKeyBind() {
return DynamicHUD.EDITOR_SCREEN_KEYBIND;
}
}
Loading
Loading