From f06946c01b2c8f210b398a16610c260eca093a8b Mon Sep 17 00:00:00 2001 From: Wyvest <45589059+Wyvest@users.noreply.github.com> Date: Thu, 21 Jul 2022 04:04:48 +0900 Subject: HUD Improvements, 1.16 port, fix NanoVG with ARM (#52) * egg 1 * separate Hud from background stuff * 1984 This reverts commit 9ae517d57bbd495d30d35cb1cbfe81a03556e6bd. * hitboxes woo!!!!! * Revert "hitboxes woo!!!!!" This reverts commit 405d32d17df3c83f2e79eddf0de853f7279767a6. * padding * allow position to go slightly off the screen * stop using ints for ABSOLUTELY EVERYTHING, DIAMOND ... fix vigilance compat not setting color * start on new pos system * some stuff * finish new position system * api momento * 1.16.2 fabric port * start on hud gui * temp remove 1.16.2 fabric since it doesn't compile * fix fabric build * hud gui stuff * apiDump * fix fabric build 2 * so true * selecting stuff * scaling + other small things * More protecting * fix nanovg not working with macOS ARM move OneConfig.preLaunch to OneConfigInit * clean up OneUIScreen make kotlin version of TestNanoVGGui * make keybinds have runnable by default * rollback keybind things * merge master into hud-improvements (#55) * Release workflow (#53) * release workflow * update normal version to hash * fix * fix naming * fix some stuff * fix version thing * switch to number from hash * Release workflow (#54) * release workflow * update normal version to hash * fix * fix naming * fix some stuff * fix version thing * switch to number from hash * Maybe epic fixo * gotta love those Java principles * Revert "gotta love those Java principles", wrong branch This reverts commit 333d8b2ad8941790c13c4bfe0777fbd203d463e5. * start on snapping * Finish snapping * stop including mixin by default on legacy versions this breaks builds if the mod itself does not use mixin * merge draw and drawExample * fix gradle publish * Some fixes * Api DUmpidy * Help subcommand impovments (#59) * Made the overall look of the "help" subcommand better + added the ability to change the colour for the command overall + each individual SubCommand * Made the alliases show batter + added support for to show subcommand aliasses * mr deliverer didnt reply but whatever, added a space between command/subcommand and alliasses Co-authored-by: pinkulu * fix file not overwriting toJavaColor * Fix full shadow not scaling correctly Co-authored-by: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Co-authored-by: nxtdaydelivery <12willettsh@gmail.com> Co-authored-by: pinkulu <56201697+pinkulu@users.noreply.github.com> Co-authored-by: pinkulu --- .../internal/mixin/ClientModLoaderMixin.java | 5 ++++- .../internal/mixin/KeyboardListenerMixin.java | 17 ----------------- .../oneconfig/internal/mixin/KeyboardMixin.java | 17 +++++++++++++++++ .../oneconfig/internal/mixin/MouseAccessor.java | 11 +++++++++++ .../internal/mixin/MouseHelperAccessor.java | 11 ----------- .../oneconfig/internal/mixin/MouseHelperMixin.java | 17 ----------------- .../oneconfig/internal/mixin/MouseMixin.java | 17 +++++++++++++++++ .../internal/mixin/TickTimeTrackerMixin.java | 22 ++++++++++++++++++++++ .../oneconfig/internal/mixin/TimeTrackerMixin.java | 22 ---------------------- 9 files changed, 71 insertions(+), 68 deletions(-) delete mode 100644 versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/KeyboardListenerMixin.java create mode 100644 versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/KeyboardMixin.java create mode 100644 versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MouseAccessor.java delete mode 100644 versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MouseHelperAccessor.java delete mode 100644 versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MouseHelperMixin.java create mode 100644 versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MouseMixin.java create mode 100644 versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/TickTimeTrackerMixin.java delete mode 100644 versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/TimeTrackerMixin.java (limited to 'versions/1.16.2-forge/src/main/java') diff --git a/versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/ClientModLoaderMixin.java b/versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/ClientModLoaderMixin.java index a3832d0..08ede6e 100644 --- a/versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/ClientModLoaderMixin.java +++ b/versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/ClientModLoaderMixin.java @@ -1,8 +1,10 @@ +//#if FORGE==1 package cc.polyfrost.oneconfig.internal.mixin; import cc.polyfrost.oneconfig.events.EventManager; import cc.polyfrost.oneconfig.events.event.InitializationEvent; import cc.polyfrost.oneconfig.internal.OneConfig; +import cc.polyfrost.oneconfig.internal.init.OneConfigInit; import net.minecraftforge.fml.client.ClientModLoader; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -13,7 +15,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; public class ClientModLoaderMixin { @Inject(method = "begin", at = @At("HEAD")) private static void onBegin(CallbackInfo ci) { - OneConfig.preLaunch(); + OneConfigInit.initialize(new String[]{}); } @Inject(method = "lambda$finishModLoading$9", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/GameSettings;loadOptions()V", remap = true), remap = false) @@ -22,3 +24,4 @@ public class ClientModLoaderMixin { OneConfig.init(); } } +//#endif \ No newline at end of file diff --git a/versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/KeyboardListenerMixin.java b/versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/KeyboardListenerMixin.java deleted file mode 100644 index c7e6327..0000000 --- a/versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/KeyboardListenerMixin.java +++ /dev/null @@ -1,17 +0,0 @@ -package cc.polyfrost.oneconfig.internal.mixin; - -import cc.polyfrost.oneconfig.events.EventManager; -import cc.polyfrost.oneconfig.events.event.KeyInputEvent; -import net.minecraft.client.KeyboardListener; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(KeyboardListener.class) -public class KeyboardListenerMixin { - @Inject(method = "onKeyEvent", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/client/ForgeHooksClient;fireKeyInput(IIII)V")) - private void onKeyEvent(long windowPointer, int key, int scanCode, int action, int modifiers, CallbackInfo ci) { - EventManager.INSTANCE.post(new KeyInputEvent()); - } -} diff --git a/versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/KeyboardMixin.java b/versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/KeyboardMixin.java new file mode 100644 index 0000000..2a28d66 --- /dev/null +++ b/versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/KeyboardMixin.java @@ -0,0 +1,17 @@ +package cc.polyfrost.oneconfig.internal.mixin; + +import cc.polyfrost.oneconfig.events.EventManager; +import cc.polyfrost.oneconfig.events.event.KeyInputEvent; +import net.minecraft.client.KeyboardListener; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(KeyboardListener.class) +public class KeyboardMixin { + @Inject(method = "onKeyEvent", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/client/ForgeHooksClient;fireKeyInput(IIII)V")) + private void onKeyEvent(long windowPointer, int key, int scanCode, int action, int modifiers, CallbackInfo ci) { + EventManager.INSTANCE.post(new KeyInputEvent()); + } +} diff --git a/versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MouseAccessor.java b/versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MouseAccessor.java new file mode 100644 index 0000000..9cc518d --- /dev/null +++ b/versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MouseAccessor.java @@ -0,0 +1,11 @@ +package cc.polyfrost.oneconfig.internal.mixin; + +import net.minecraft.client.MouseHelper; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +@Mixin(MouseHelper.class) +public interface MouseAccessor { + @Accessor("accumulatedScrollDelta") + double getEventDeltaWheel(); +} diff --git a/versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MouseHelperAccessor.java b/versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MouseHelperAccessor.java deleted file mode 100644 index d04ecb1..0000000 --- a/versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MouseHelperAccessor.java +++ /dev/null @@ -1,11 +0,0 @@ -package cc.polyfrost.oneconfig.internal.mixin; - -import net.minecraft.client.MouseHelper; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -@Mixin(MouseHelper.class) -public interface MouseHelperAccessor { - @Accessor - double getAccumulatedScrollDelta(); -} diff --git a/versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MouseHelperMixin.java b/versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MouseHelperMixin.java deleted file mode 100644 index 42dd283..0000000 --- a/versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MouseHelperMixin.java +++ /dev/null @@ -1,17 +0,0 @@ -package cc.polyfrost.oneconfig.internal.mixin; - -import cc.polyfrost.oneconfig.events.EventManager; -import cc.polyfrost.oneconfig.events.event.MouseInputEvent; -import net.minecraft.client.MouseHelper; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(MouseHelper.class) -public class MouseHelperMixin { - @Inject(method = "mouseButtonCallback", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/client/ForgeHooksClient;fireMouseInput(III)V")) - private void onMouse(long handle, int button, int action, int mods, CallbackInfo ci) { - EventManager.INSTANCE.post(new MouseInputEvent()); - } -} diff --git a/versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MouseMixin.java b/versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MouseMixin.java new file mode 100644 index 0000000..525f187 --- /dev/null +++ b/versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MouseMixin.java @@ -0,0 +1,17 @@ +package cc.polyfrost.oneconfig.internal.mixin; + +import cc.polyfrost.oneconfig.events.EventManager; +import cc.polyfrost.oneconfig.events.event.MouseInputEvent; +import net.minecraft.client.MouseHelper; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(MouseHelper.class) +public class MouseMixin { + @Inject(method = "mouseButtonCallback", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/client/ForgeHooksClient;fireMouseInput(III)V")) + private void onMouse(long handle, int button, int action, int mods, CallbackInfo ci) { + EventManager.INSTANCE.post(new MouseInputEvent()); + } +} diff --git a/versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/TickTimeTrackerMixin.java b/versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/TickTimeTrackerMixin.java new file mode 100644 index 0000000..572076d --- /dev/null +++ b/versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/TickTimeTrackerMixin.java @@ -0,0 +1,22 @@ +package cc.polyfrost.oneconfig.internal.mixin; + +import cc.polyfrost.oneconfig.events.EventManager; +import cc.polyfrost.oneconfig.events.event.ShutdownEvent; +import cc.polyfrost.oneconfig.events.event.StartEvent; +import net.minecraft.profiler.TimeTracker; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import java.util.function.IntSupplier; +import java.util.function.LongSupplier; + +@Mixin(TimeTracker.class) +public class TickTimeTrackerMixin { + @Inject(method = "", at = @At("RETURN")) + private void onStart(LongSupplier longSupplier, IntSupplier intSupplier, CallbackInfo ci) { + EventManager.INSTANCE.post(new StartEvent()); + Runtime.getRuntime().addShutdownHook(new Thread(() -> EventManager.INSTANCE.post(new ShutdownEvent()))); + } +} diff --git a/versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/TimeTrackerMixin.java b/versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/TimeTrackerMixin.java deleted file mode 100644 index dd9920e..0000000 --- a/versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/TimeTrackerMixin.java +++ /dev/null @@ -1,22 +0,0 @@ -package cc.polyfrost.oneconfig.internal.mixin; - -import cc.polyfrost.oneconfig.events.EventManager; -import cc.polyfrost.oneconfig.events.event.ShutdownEvent; -import cc.polyfrost.oneconfig.events.event.StartEvent; -import net.minecraft.profiler.TimeTracker; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import java.util.function.IntSupplier; -import java.util.function.LongSupplier; - -@Mixin(TimeTracker.class) -public class TimeTrackerMixin { - @Inject(method = "", at = @At("RETURN")) - private void onStart(LongSupplier longSupplier, IntSupplier intSupplier, CallbackInfo ci) { - EventManager.INSTANCE.post(new StartEvent()); - Runtime.getRuntime().addShutdownHook(new Thread(() -> EventManager.INSTANCE.post(new ShutdownEvent()))); - } -} -- cgit