aboutsummaryrefslogtreecommitdiff
path: root/versions
diff options
context:
space:
mode:
authorWyvest <45589059+Wyvest@users.noreply.github.com>2022-07-21 04:04:48 +0900
committerGitHub <noreply@github.com>2022-07-20 20:04:48 +0100
commitf06946c01b2c8f210b398a16610c260eca093a8b (patch)
tree22bda7a5e9b0a1e7370ff2b1e74fc7c9e4035379 /versions
parentff2ead62333e90b61e05c8cb6a91f692fcf30805 (diff)
downloadOneConfig-f06946c01b2c8f210b398a16610c260eca093a8b.tar.gz
OneConfig-f06946c01b2c8f210b398a16610c260eca093a8b.tar.bz2
OneConfig-f06946c01b2c8f210b398a16610c260eca093a8b.zip
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 <pinkulumc@gmail.com> * 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 <pinkulumc@gmail.com>
Diffstat (limited to 'versions')
-rw-r--r--versions/1.12.2-1.16.2.txt4
-rw-r--r--versions/1.12.2-forge/api/1.12.2-forge.api20
-rw-r--r--versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MinecraftMixin.java5
-rw-r--r--versions/1.16.2-fabric/api/1.16.2-fabric.api122
-rw-r--r--versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/hook/FramebufferHook.java6
-rw-r--r--versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/FramebufferMixin.java62
-rw-r--r--versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/GameRendererAccessor.java12
-rw-r--r--versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/GuiIngameForgeMixin.java19
-rw-r--r--versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/KeyboardMixin.java20
-rw-r--r--versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MinecraftMixin.java60
-rw-r--r--versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MouseAccessor.java17
-rw-r--r--versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MouseMixin.java20
-rw-r--r--versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetHandlerPlayClientMixin.java25
-rw-r--r--versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetworkManagerMixin.java42
-rw-r--r--versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/TickTimeTrackerMixin.java24
-rw-r--r--versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/WorldClientMixin.java24
-rw-r--r--versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/plugin/OneConfigPreLaunch.java11
-rw-r--r--versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/utils/commands/PlatformCommandManagerImpl.java122
-rw-r--r--versions/1.16.2-forge/api/1.16.2-forge.api20
-rw-r--r--versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/ClientModLoaderMixin.java5
-rw-r--r--versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/KeyboardMixin.java (renamed from versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/KeyboardListenerMixin.java)2
-rw-r--r--versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MouseAccessor.java (renamed from versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MouseHelperAccessor.java)6
-rw-r--r--versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MouseMixin.java (renamed from versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MouseHelperMixin.java)2
-rw-r--r--versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/TickTimeTrackerMixin.java (renamed from versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/TimeTrackerMixin.java)2
-rw-r--r--versions/1.8.9-forge/api/1.8.9-forge.api20
-rw-r--r--versions/build.gradle.kts158
-rw-r--r--versions/root.gradle.kts4
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java23
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/internal/eggs/TechnobladeCrownRenderer.java39
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/internal/gui/impl/BlurHandlerImpl.java7
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MinecraftMixin.java5
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/RenderPigMixin.java25
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/internal/plugin/OneConfigMixinPlugin.java15
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/GLPlatformImpl.java10
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/GuiPlatformImpl.java1
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/I18nPlatformImpl.java1
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/LoaderPlatformImpl.java29
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/MousePlatformImpl.java17
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/NanoVGPlatformImpl.java88
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/PlatformImpl.java10
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/ServerPlatformImpl.java1
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/test/TestBasicHud_Test.java23
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/test/TestConfig_Test.java6
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/test/TestHud_Test.java2
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/test/TestKotlinNanoVGGui_Test.kt45
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/test/TestMultilineHud_Test.java3
-rw-r--r--versions/src/main/java/cc/polyfrost/oneconfig/test/TestNanoVGGui_Test.java30
-rw-r--r--versions/src/main/resources/META-INF/services/cc.polyfrost.oneconfig.platform.NanoVGPlatform1
-rw-r--r--versions/src/main/resources/fabric.mod.json35
-rw-r--r--versions/src/main/resources/mixins.oneconfig.json1
50 files changed, 1079 insertions, 172 deletions
diff --git a/versions/1.12.2-1.16.2.txt b/versions/1.12.2-1.16.2.txt
index 5d0f09b..68a6805 100644
--- a/versions/1.12.2-1.16.2.txt
+++ b/versions/1.12.2-1.16.2.txt
@@ -27,4 +27,6 @@ org.spongepowered.asm.lib.tree.FieldInsnNode org.objectweb.asm.tree.FieldInsnNod
org.spongepowered.asm.lib.tree.MethodInsnNode org.objectweb.asm.tree.MethodInsnNode
org.spongepowered.asm.lib.tree.InsnList org.objectweb.asm.tree.InsnList
org.spongepowered.asm.lib.tree.InsnNode org.objectweb.asm.tree.InsnNode
-org.spongepowered.asm.lib.tree.JumpInsnNode org.objectweb.asm.tree.JumpInsnNode \ No newline at end of file
+org.spongepowered.asm.lib.tree.JumpInsnNode org.objectweb.asm.tree.JumpInsnNode
+
+org.lwjgl.nanovg.NanoVGGL2 org.lwjgl.nanovg.NanoVGGL3 \ No newline at end of file
diff --git a/versions/1.12.2-forge/api/1.12.2-forge.api b/versions/1.12.2-forge/api/1.12.2-forge.api
index b073db3..a948ea0 100644
--- a/versions/1.12.2-forge/api/1.12.2-forge.api
+++ b/versions/1.12.2-forge/api/1.12.2-forge.api
@@ -64,8 +64,28 @@ public class cc/polyfrost/oneconfig/platform/impl/MousePlatformImpl : cc/polyfro
public fun isButtonDown (I)Z
}
+public class cc/polyfrost/oneconfig/platform/impl/NanoVGPlatformImpl : cc/polyfrost/oneconfig/platform/NanoVGPlatform {
+ public fun <init> ()V
+ public fun nnvgCreate (I)J
+ public fun nnvgDelete (J)V
+ public fun nnvglCreateImageFromHandle (JIIII)I
+ public fun nnvglImageHandle (JI)I
+ public fun nnvgluBindFramebuffer (JJ)V
+ public fun nnvgluCreateFramebuffer (JIII)J
+ public fun nnvgluDeleteFramebuffer (JJ)V
+ public fun nvgCreate (I)J
+ public fun nvgDelete (J)V
+ public fun nvglCreateImageFromHandle (JIIII)I
+ public fun nvglImageHandle (JI)I
+ public fun nvgluBindFramebuffer (JLorg/lwjgl/nanovg/NVGLUFramebuffer;)V
+ public fun nvgluCreateFramebuffer (JIII)Lorg/lwjgl/nanovg/NVGLUFramebuffer;
+ public fun nvgluDeleteFramebuffer (JLorg/lwjgl/nanovg/NVGLUFramebuffer;)V
+ public fun triggerStaticInitialization ()V
+}
+
public class cc/polyfrost/oneconfig/platform/impl/PlatformImpl : cc/polyfrost/oneconfig/platform/Platform {
public fun <init> ()V
+ public fun getLoader ()Lcc/polyfrost/oneconfig/platform/Platform$Loader;
public fun getMinecraftVersion ()I
public fun isCallingFromMinecraftThread ()Z
}
diff --git a/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MinecraftMixin.java b/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MinecraftMixin.java
index 9492238..e318ba1 100644
--- a/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MinecraftMixin.java
+++ b/versions/1.12.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MinecraftMixin.java
@@ -32,11 +32,6 @@ public class MinecraftMixin {
Runtime.getRuntime().addShutdownHook(new Thread(() -> EventManager.INSTANCE.post(new ShutdownEvent())));
}
- @Inject(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/client/FMLClientHandler;beginMinecraftLoading(Lnet/minecraft/client/Minecraft;Ljava/util/List;Lnet/minecraft/client/resources/IReloadableResourceManager;Lnet/minecraft/client/resources/data/MetadataSerializer;)V", remap = false), remap = true)
- private void onPreLaunch(CallbackInfo ci) {
- OneConfig.preLaunch();
- }
-
@Inject(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/client/FMLClientHandler;onInitializationComplete()V", shift = At.Shift.AFTER, remap = false), remap = true)
private void onInit(CallbackInfo ci) {
EventManager.INSTANCE.post(new InitializationEvent());
diff --git a/versions/1.16.2-fabric/api/1.16.2-fabric.api b/versions/1.16.2-fabric/api/1.16.2-fabric.api
new file mode 100644
index 0000000..51e5d73
--- /dev/null
+++ b/versions/1.16.2-fabric/api/1.16.2-fabric.api
@@ -0,0 +1,122 @@
+public class cc/polyfrost/oneconfig/events/event/ChatReceiveEvent : cc/polyfrost/oneconfig/events/event/CancellableEvent {
+ public final field message Lnet/minecraft/text/Text;
+ public fun <init> (Lnet/minecraft/text/Text;)V
+ public fun getFullyUnformattedMessage ()Ljava/lang/String;
+}
+
+public class cc/polyfrost/oneconfig/events/event/ReceivePacketEvent : cc/polyfrost/oneconfig/events/event/CancellableEvent {
+ public final field packet Lnet/minecraft/network/Packet;
+ public fun <init> (Lnet/minecraft/network/Packet;)V
+}
+
+public class cc/polyfrost/oneconfig/events/event/ScreenOpenEvent : cc/polyfrost/oneconfig/events/event/CancellableEvent {
+ public final field screen Lnet/minecraft/client/gui/screen/Screen;
+ public fun <init> (Lnet/minecraft/client/gui/screen/Screen;)V
+}
+
+public class cc/polyfrost/oneconfig/events/event/SendPacketEvent : cc/polyfrost/oneconfig/events/event/CancellableEvent {
+ public final field packet Lnet/minecraft/network/Packet;
+ public fun <init> (Lnet/minecraft/network/Packet;)V
+}
+
+public class cc/polyfrost/oneconfig/events/event/TimerUpdateEvent {
+ public final field timer Lnet/minecraft/client/render/RenderTickCounter;
+ public final field updatedDeltaTicks Z
+ public fun <init> (Lnet/minecraft/client/render/RenderTickCounter;Z)V
+}
+
+public class cc/polyfrost/oneconfig/platform/impl/GLPlatformImpl : cc/polyfrost/oneconfig/platform/GLPlatform {
+ public fun <init> ()V
+ public fun drawRect (FFFFI)V
+ public fun drawText (Lcc/polyfrost/oneconfig/libs/universal/UMatrixStack;Ljava/lang/String;FFIZ)F
+ public fun enableStencil ()V
+ public fun getStringWidth (Ljava/lang/String;)I
+}
+
+public class cc/polyfrost/oneconfig/platform/impl/GuiPlatformImpl : cc/polyfrost/oneconfig/platform/GuiPlatform {
+ public fun <init> ()V
+ public fun getCurrentScreen ()Ljava/lang/Object;
+ public fun isInChat ()Z
+ public fun isInDebug ()Z
+ public fun setCurrentScreen (Ljava/lang/Object;)V
+}
+
+public class cc/polyfrost/oneconfig/platform/impl/I18nPlatformImpl : cc/polyfrost/oneconfig/platform/I18nPlatform {
+ public fun <init> ()V
+ public fun format (Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
+}
+
+public class cc/polyfrost/oneconfig/platform/impl/LoaderPlatformImpl : cc/polyfrost/oneconfig/platform/LoaderPlatform {
+ public fun <init> ()V
+ public fun getActiveModContainer ()Lcc/polyfrost/oneconfig/platform/LoaderPlatform$ActiveMod;
+ public fun hasActiveModContainer ()Z
+ public fun isModLoaded (Ljava/lang/String;)Z
+}
+
+public class cc/polyfrost/oneconfig/platform/impl/MousePlatformImpl : cc/polyfrost/oneconfig/platform/MousePlatform {
+ public fun <init> ()V
+ public fun getButtonState (I)I
+ public fun getDWheel ()D
+ public fun getMouseDX ()D
+ public fun getMouseDY ()D
+ public fun getMouseX ()D
+ public fun getMouseY ()D
+ public fun isButtonDown (I)Z
+}
+
+public class cc/polyfrost/oneconfig/platform/impl/NanoVGPlatformImpl : cc/polyfrost/oneconfig/platform/NanoVGPlatform {
+ public fun <init> ()V
+ public fun nnvgCreate (I)J
+ public fun nnvgDelete (J)V
+ public fun nnvglCreateImageFromHandle (JIIII)I
+ public fun nnvglImageHandle (JI)I
+ public fun nnvgluBindFramebuffer (JJ)V
+ public fun nnvgluCreateFramebuffer (JIII)J
+ public fun nnvgluDeleteFramebuffer (JJ)V
+ public fun nvgCreate (I)J
+ public fun nvgDelete (J)V
+ public fun nvglCreateImageFromHandle (JIIII)I
+ public fun nvglImageHandle (JI)I
+ public fun nvgluBindFramebuffer (JLorg/lwjgl/nanovg/NVGLUFramebuffer;)V
+ public fun nvgluCreateFramebuffer (JIII)Lorg/lwjgl/nanovg/NVGLUFramebuffer;
+ public fun nvgluDeleteFramebuffer (JLorg/lwjgl/nanovg/NVGLUFramebuffer;)V
+ public fun triggerStaticInitialization ()V
+}
+
+public class cc/polyfrost/oneconfig/platform/impl/PlatformImpl : cc/polyfrost/oneconfig/platform/Platform {
+ public fun <init> ()V
+ public fun getLoader ()Lcc/polyfrost/oneconfig/platform/Platform$Loader;
+ public fun getMinecraftVersion ()I
+ public fun isCallingFromMinecraftThread ()Z
+}
+
+public class cc/polyfrost/oneconfig/platform/impl/ServerPlatformImpl : cc/polyfrost/oneconfig/platform/ServerPlatform {
+ public fun <init> ()V
+ public fun getServerBrand ()Ljava/lang/String;
+ public fun inMultiplayer ()Z
+}
+
+public class cc/polyfrost/oneconfig/utils/commands/PlatformCommandManagerImpl : cc/polyfrost/oneconfig/utils/commands/PlatformCommandManager {
+ public fun <init> ()V
+ public fun handleNewParser (Lcc/polyfrost/oneconfig/utils/commands/arguments/ArgumentParser;Ljava/lang/Class;)V
+}
+
+public final class cc/polyfrost/oneconfig/utils/dsl/DSLsKt {
+ public static final fun getMc ()Lnet/minecraft/client/MinecraftClient;
+}
+
+public final class cc/polyfrost/oneconfig/utils/dsl/GuiUtilsDSLKt {
+ public static final fun openScreen (Lnet/minecraft/client/gui/screen/Screen;I)V
+ public static synthetic fun openScreen$default (Lnet/minecraft/client/gui/screen/Screen;IILjava/lang/Object;)V
+}
+
+public final class cc/polyfrost/oneconfig/utils/gui/GuiUtils {
+ public fun <init> ()V
+ public static fun closeScreen ()V
+ public static fun displayScreen (Ljava/lang/Object;)V
+ public static fun displayScreen (Lnet/minecraft/client/gui/screen/Screen;)V
+ public static fun displayScreen (Lnet/minecraft/client/gui/screen/Screen;I)V
+ public static fun getDeltaTime ()F
+ public static fun getScreenQueue ()Ljava/util/Deque;
+}
+
diff --git a/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/hook/FramebufferHook.java b/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/hook/FramebufferHook.java
new file mode 100644
index 0000000..d0125ea
--- /dev/null
+++ b/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/hook/FramebufferHook.java
@@ -0,0 +1,6 @@
+package cc.polyfrost.oneconfig.internal.hook;
+
+public interface FramebufferHook {
+ boolean isStencilEnabled();
+ void enableStencil();
+}
diff --git a/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/FramebufferMixin.java b/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/FramebufferMixin.java
new file mode 100644
index 0000000..5f182c5
--- /dev/null
+++ b/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/FramebufferMixin.java
@@ -0,0 +1,62 @@
+package cc.polyfrost.oneconfig.internal.mixin;
+
+import cc.polyfrost.oneconfig.internal.hook.FramebufferHook;
+import com.mojang.blaze3d.platform.FramebufferInfo;
+import com.mojang.blaze3d.platform.GlStateManager;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.gl.Framebuffer;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Shadow;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Redirect;
+
+import java.nio.IntBuffer;
+
+/**
+ * Modified from MinecraftForge
+ * <a href="https://github.com/MinecraftForge/MinecraftForge/blob/1.19.x/LICENSE.txt">...</a>
+ */
+@Mixin(Framebuffer.class)
+public abstract class FramebufferMixin implements FramebufferHook {
+ @Shadow public int textureWidth;
+ @Shadow public int textureHeight;
+ @Shadow private int depthAttachment;
+
+ @Shadow public abstract void resize(int width, int height, boolean getError);
+
+ @Shadow public int viewportWidth;
+ @Shadow public int viewportHeight;
+ private boolean stencilEnabled = false;
+
+ @Redirect(method = "initFbo", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/platform/GlStateManager;texImage2D(IIIIIIIILjava/nio/IntBuffer;)V", ordinal = 0))
+ private void stencilSupport(int target, int level, int internalFormat, int width, int height, int border, int format, int type, IntBuffer pixels) {
+ if (stencilEnabled) {
+ GlStateManager.texImage2D(3553, 0, 36013, textureWidth, textureHeight, 0, 34041, 36269, null);
+ } else {
+ GlStateManager.texImage2D(3553, 0, 6402, textureWidth, textureHeight, 0, 6402, 5126, null);
+ }
+ }
+
+ @Redirect(method = "initFbo", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/platform/GlStateManager;framebufferTexture2D(IIIII)V", ordinal = 1))
+ private void stencilSupport(int target, int attachment, int textureTarget, int texture, int level) {
+ if (stencilEnabled) {
+ GlStateManager.framebufferTexture2D(FramebufferInfo.FRAME_BUFFER, 36096, 3553, depthAttachment, 0);
+ GlStateManager.framebufferTexture2D(FramebufferInfo.FRAME_BUFFER, 36128, 3553, depthAttachment, 0);
+ } else {
+ GlStateManager.framebufferTexture2D(FramebufferInfo.FRAME_BUFFER, FramebufferInfo.DEPTH_ATTACHMENT, 3553, depthAttachment, 0);
+ }
+ }
+
+ @Override
+ public boolean isStencilEnabled() {
+ return stencilEnabled;
+ }
+
+ @Override
+ public void enableStencil() {
+ if (!this.stencilEnabled) {
+ this.stencilEnabled = true;
+ resize(viewportWidth, viewportHeight, MinecraftClient.IS_SYSTEM_MAC);
+ }
+ }
+}
diff --git a/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/GameRendererAccessor.java b/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/GameRendererAccessor.java
new file mode 100644
index 0000000..0ebe121
--- /dev/null
+++ b/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/GameRendererAccessor.java
@@ -0,0 +1,12 @@
+package cc.polyfrost.oneconfig.internal.mixin;
+
+import net.minecraft.client.render.GameRenderer;
+import net.minecraft.util.Identifier;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.gen.Invoker;
+
+@Mixin(GameRenderer.class)
+public interface GameRendererAccessor {
+ @Invoker
+ void invokeLoadShader(Identifier identifier);
+}
diff --git a/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/GuiIngameForgeMixin.java b/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/GuiIngameForgeMixin.java
new file mode 100644
index 0000000..6a8d283
--- /dev/null
+++ b/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/GuiIngameForgeMixin.java
@@ -0,0 +1,19 @@
+package cc.polyfrost.oneconfig.internal.mixin;
+
+import cc.polyfrost.oneconfig.events.EventManager;
+import cc.polyfrost.oneconfig.events.event.HudRenderEvent;
+import cc.polyfrost.oneconfig.libs.universal.UMatrixStack;
+import net.minecraft.client.gui.hud.InGameHud;
+import net.minecraft.client.util.math.MatrixStack;
+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(InGameHud.class)
+public class GuiIngameForgeMixin {
+ @Inject(method = "render", at = @At("TAIL"))
+ private void onRenderGameOverlay(MatrixStack matrices, float tickDelta, CallbackInfo ci) {
+ EventManager.INSTANCE.post(new HudRenderEvent(new UMatrixStack(matrices), tickDelta));
+ }
+} \ No newline at end of file
diff --git a/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/KeyboardMixin.java b/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/KeyboardMixin.java
new file mode 100644
index 0000000..7d0a33f
--- /dev/null
+++ b/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/KeyboardMixin.java
@@ -0,0 +1,20 @@
+package cc.polyfrost.oneconfig.internal.mixin;
+
+import cc.polyfrost.oneconfig.events.EventManager;
+import cc.polyfrost.oneconfig.events.event.KeyInputEvent;
+import net.minecraft.client.Keyboard;
+import net.minecraft.client.MinecraftClient;
+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(Keyboard.class)
+public class KeyboardMixin {
+ @Inject(method = "onKey", at = @At("TAIL"))
+ private void onKeyEvent(long windowPointer, int key, int scanCode, int action, int modifiers, CallbackInfo ci) {
+ if (windowPointer == MinecraftClient.getInstance().getWindow().getHandle()) {
+ EventManager.INSTANCE.post(new KeyInputEvent());
+ }
+ }
+}
diff --git a/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MinecraftMixin.java b/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MinecraftMixin.java
new file mode 100644
index 0000000..0acb015
--- /dev/null
+++ b/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MinecraftMixin.java
@@ -0,0 +1,60 @@
+package cc.polyfrost.oneconfig.internal.mixin;
+
+import cc.polyfrost.oneconfig.events.EventManager;
+import cc.polyfrost.oneconfig.events.event.*;
+
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.gui.screen.Screen;
+import net.minecraft.client.render.RenderTickCounter;
+import org.spongepowered.asm.mixin.Final;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Shadow;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+
+@Mixin(MinecraftClient.class)
+public class MinecraftMixin {
+ @Final
+ @Shadow
+ private RenderTickCounter renderTickCounter;
+
+ @Inject(method = "stop", at = @At("HEAD"))
+ private void onShutdown(CallbackInfo ci) {
+ EventManager.INSTANCE.post(new PreShutdownEvent());
+ }
+
+ @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", ordinal = 0))
+ private void onRenderTickStart(CallbackInfo ci) {
+ EventManager.INSTANCE.post(new RenderEvent(Stage.START, renderTickCounter.tickDelta));
+ }
+
+ @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;pop()V", shift = At.Shift.AFTER, ordinal = 4))
+ private void onRenderTickEnd(CallbackInfo ci) {
+ EventManager.INSTANCE.post(new RenderEvent(Stage.END, renderTickCounter.tickDelta));
+ }
+
+ @Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;push(Ljava/lang/String;)V", ordinal = 0))
+ private void onClientTickStart(CallbackInfo ci) {
+ EventManager.INSTANCE.post(new TickEvent(Stage.START));
+ }
+
+ @Inject(method = "tick", at = @At("TAIL"))
+ private void onClientTickEnd(CallbackInfo ci) {
+ EventManager.INSTANCE.post(new TickEvent(Stage.END));
+ }
+
+ @Inject(method = "openScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;requestRespawn()V", shift = At.Shift.BY, by = 2), cancellable = true)
+ private void onGuiOpenEvent(Screen screen, CallbackInfo ci) {
+ ScreenOpenEvent event = new ScreenOpenEvent(screen);
+ EventManager.INSTANCE.post(event);
+ if (event.isCancelled) {
+ ci.cancel();
+ }
+ }
+
+ @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/RenderTickCounter;beginRenderTick(J)I", shift = At.Shift.AFTER))
+ private void onDeltaTickTimerUpdate(CallbackInfo ci) {
+ EventManager.INSTANCE.post(new TimerUpdateEvent(renderTickCounter, true));
+ }
+} \ No newline at end of file
diff --git a/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MouseAccessor.java b/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MouseAccessor.java
new file mode 100644
index 0000000..2765b3a
--- /dev/null
+++ b/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MouseAccessor.java
@@ -0,0 +1,17 @@
+package cc.polyfrost.oneconfig.internal.mixin;
+
+import net.minecraft.client.Mouse;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.gen.Accessor;
+
+@Mixin(Mouse.class)
+public interface MouseAccessor {
+ @Accessor("eventDeltaWheel")
+ double getEventDeltaWheel();
+
+ @Accessor
+ double getCursorDeltaX();
+
+ @Accessor
+ double getCursorDeltaY();
+}
diff --git a/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MouseMixin.java b/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MouseMixin.java
new file mode 100644
index 0000000..c088c32
--- /dev/null
+++ b/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MouseMixin.java
@@ -0,0 +1,20 @@
+package cc.polyfrost.oneconfig.internal.mixin;
+
+import cc.polyfrost.oneconfig.events.EventManager;
+import cc.polyfrost.oneconfig.events.event.MouseInputEvent;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.Mouse;
+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(Mouse.class)
+public class MouseMixin {
+ @Inject(method = "onMouseButton", at = @At("TAIL"))
+ private void onMouse(long handle, int button, int action, int mods, CallbackInfo ci) {
+ if (handle == MinecraftClient.getInstance().getWindow().getHandle()) {
+ EventManager.INSTANCE.post(new MouseInputEvent());
+ }
+ }
+}
diff --git a/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetHandlerPlayClientMixin.java b/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetHandlerPlayClientMixin.java
new file mode 100644
index 0000000..cdd673a
--- /dev/null
+++ b/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetHandlerPlayClientMixin.java
@@ -0,0 +1,25 @@
+package cc.polyfrost.oneconfig.internal.mixin;
+
+import cc.polyfrost.oneconfig.events.EventManager;
+import cc.polyfrost.oneconfig.events.event.ChatReceiveEvent;
+import net.minecraft.client.network.ClientPlayNetworkHandler;
+import net.minecraft.network.packet.s2c.play.GameMessageS2CPacket;
+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(value = ClientPlayNetworkHandler.class, priority = Integer.MAX_VALUE)
+public class NetHandlerPlayClientMixin {
+
+ @Inject(method = "onGameMessage", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;addChatMessage(Lnet/minecraft/network/MessageType;Lnet/minecraft/text/Text;Ljava/util/UUID;)V"), cancellable = true)
+ private void onClientChat(GameMessageS2CPacket packet, CallbackInfo ci) {
+ if (packet.getLocation().getId() == 0) {
+ ChatReceiveEvent event = new ChatReceiveEvent(packet.getMessage());
+ EventManager.INSTANCE.post(event);
+ if (event.isCancelled) {
+ ci.cancel();
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetworkManagerMixin.java b/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetworkManagerMixin.java
new file mode 100644
index 0000000..825effa
--- /dev/null
+++ b/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/NetworkManagerMixin.java
@@ -0,0 +1,42 @@
+package cc.polyfrost.oneconfig.internal.mixin;
+
+import cc.polyfrost.oneconfig.events.EventManager;
+import cc.polyfrost.oneconfig.events.event.ReceivePacketEvent;
+import cc.polyfrost.oneconfig.events.event.SendPacketEvent;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.util.concurrent.Future;
+import io.netty.util.concurrent.GenericFutureListener;
+import net.minecraft.network.ClientConnection;
+import net.minecraft.network.Packet;
+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(value = ClientConnection.class, priority = Integer.MAX_VALUE)
+public class NetworkManagerMixin {
+
+ @Inject(method = "send(Lnet/minecraft/network/Packet;Lio/netty/util/concurrent/GenericFutureListener;)V", at = @At("HEAD"), cancellable = true)
+ private void onSendPacket(Packet<?> packet, GenericFutureListener<? extends Future<? super Void>> callback, CallbackInfo ci) {
+ onSendPacket(packet, ci);
+ }
+
+ @Inject(method = "send(Lnet/minecraft/network/Packet;)V", at = @At("HEAD"), cancellable = true)
+ private void onSendPacket(Packet<?> packet, CallbackInfo ci) {
+ SendPacketEvent event = new SendPacketEvent(packet);
+ EventManager.INSTANCE.post(event);
+ if (event.isCancelled) {
+ ci.cancel();
+ }
+ }
+
+
+ @Inject(method = "channelRead0(Lio/netty/channel/ChannelHandlerContext;Lnet/minecraft/network/Packet;)V", at = @At("HEAD"), cancellable = true)
+ private void onReceivePacket(ChannelHandlerContext channelHandlerContext, Packet<?> packet, CallbackInfo ci) {
+ ReceivePacketEvent event = new ReceivePacketEvent(packet);
+ EventManager.INSTANCE.post(event);
+ if (event.isCancelled) {
+ ci.cancel();
+ }
+ }
+} \ No newline at end of file
diff --git a/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/TickTimeTrackerMixin.java b/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/TickTimeTrackerMixin.java
new file mode 100644
index 0000000..8b655d8
--- /dev/null
+++ b/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/TickTimeTrackerMixin.java
@@ -0,0 +1,24 @@
+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.util.profiler.TickTimeTracker;
+import cc.polyfrost.oneconfig.internal.OneConfig;
+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(TickTimeTracker.class)
+public class TickTimeTrackerMixin {
+ @Inject(method = "<init>", at = @At("RETURN"))
+ private void onStart(LongSupplier longSupplier, IntSupplier intSupplier, CallbackInfo ci) {
+ OneConfig.init();
+ EventManager.INSTANCE.post(new StartEvent());
+ Runtime.getRuntime().addShutdownHook(new Thread(() -> EventManager.INSTANCE.post(new ShutdownEvent())));
+ }
+}
diff --git a/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/WorldClientMixin.java b/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/WorldClientMixin.java
new file mode 100644
index 0000000..4fc4ba5
--- /dev/null
+++ b/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/mixin/WorldClientMixin.java
@@ -0,0 +1,24 @@
+package cc.polyfrost.oneconfig.internal.mixin;
+
+import cc.polyfrost.oneconfig.events.EventManager;
+import cc.polyfrost.oneconfig.events.event.WorldLoadEvent;
+import net.minecraft.client.network.ClientPlayNetworkHandler;
+import net.minecraft.client.render.WorldRenderer;
+import net.minecraft.client.world.ClientWorld;
+import net.minecraft.util.registry.RegistryKey;
+import net.minecraft.world.World;
+import net.minecraft.world.dimension.DimensionType;
+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.Supplier;
+
+@Mixin(ClientWorld.class)
+public class WorldClientMixin {
+ @Inject(method = "<init>", at = @At("RETURN"))
+ private void onWorldLoad(ClientPlayNetworkHandler clientPlayNetworkHandler, ClientWorld.Properties properties, RegistryKey<World> registryKey, DimensionType dimensionType, int i, Supplier<World> supplier, WorldRenderer worldRenderer, boolean bl, long l, CallbackInfo ci) {
+ EventManager.INSTANCE.post(new WorldLoadEvent());
+ }
+} \ No newline at end of file
diff --git a/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/plugin/OneConfigPreLaunch.java b/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/plugin/OneConfigPreLaunch.java
new file mode 100644
index 0000000..ca57970
--- /dev/null
+++ b/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/internal/plugin/OneConfigPreLaunch.java
@@ -0,0 +1,11 @@
+package cc.polyfrost.oneconfig.internal.plugin;
+
+import cc.polyfrost.oneconfig.internal.init.OneConfigInit;
+import net.fabricmc.loader.api.entrypoint.PreLaunchEntrypoint;
+
+public class OneConfigPreLaunch implements PreLaunchEntrypoint {
+ @Override
+ public void onPreLaunch() {
+ OneConfigInit.initialize(new String[]{});
+ }
+}
diff --git a/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/utils/commands/PlatformCommandManagerImpl.java b/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/utils/commands/PlatformCommandManagerImpl.java
new file mode 100644
index 0000000..674d7b9
--- /dev/null
+++ b/versions/1.16.2-fabric/src/main/java/cc/polyfrost/oneconfig/utils/commands/PlatformCommandManagerImpl.java
@@ -0,0 +1,122 @@
+package cc.polyfrost.oneconfig.utils.commands;
+
+import cc.polyfrost.oneconfig.libs.universal.ChatColor;
+import cc.polyfrost.oneconfig.libs.universal.UChat;
+import cc.polyfrost.oneconfig.utils.commands.annotations.Command;
+import cc.polyfrost.oneconfig.utils.commands.annotations.Greedy;
+import cc.polyfrost.oneconfig.utils.commands.arguments.ArgumentParser;
+import cc.polyfrost.oneconfig.utils.commands.arguments.Arguments;
+import com.mojang.brigadier.StringReader;
+import com.mojang.brigadier.arguments.ArgumentType;
+import com.mojang.brigadier.builder.LiteralArgumentBuilder;
+import com.mojang.brigadier.context.CommandContext;
+import com.mojang.brigadier.suggestion.Suggestions;
+import com.mojang.brigadier.suggestion.SuggestionsBuilder;
+import net.minecraft.server.command.ServerCommandSource;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.commons.lang3.tuple.Pair;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Parameter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.concurrent.CompletableFuture;
+
+import static cc.polyfrost.oneconfig.utils.commands.CommandManager.METHOD_RUN_ERROR;
+
+public class PlatformCommandManagerImpl extends PlatformCommandManager {
+
+ final HashMap<Class<?>, Pair<ArgumentType<Object>, ArgumentType<Object>>> parsers = new HashMap<>(); // non-greedy, greedy
+
+ @Override
+ void createCommand(CommandManager.InternalCommand root, Command annotation) {
+ LiteralArgumentBuilder<ServerCommandSource> builder = net.minecraft.server.command.CommandManager.literal(annotation.value());
+ if (!root.invokers.isEmpty()) {
+ builder.executes((context ->
+ {
+ try {
+ root.invokers.get(0).method.invoke(null);
+ return 1;
+ } catch (IllegalAccessException | InvocationTargetException | IllegalArgumentException |
+ ExceptionInInitializerError e) {
+ UChat.chat(ChatColor.RED.toString() + ChatColor.BOLD + METHOD_RUN_ERROR);
+ return 0;
+ }
+ }));
+ }
+ if (annotation.helpCommand()) {
+ builder.then(net.minecraft.server.command.CommandManager.literal("help").executes((context ->
+ {
+ UChat.chat(sendHelpCommand(root));
+ return 1;
+ })));
+ }
+ for (CommandManager.InternalCommand command : root.children) {
+ loopThroughChildren(command, builder, null);
+ }
+ }
+
+ private void loopThroughChildren(CommandManager.InternalCommand command, LiteralArgumentBuilder<ServerCommandSource> root, LiteralArgumentBuilder<ServerCommandSource> builder) {
+ if (command.invokers.isEmpty() || command.children.isEmpty()) return;
+ if (builder == null) {
+ builder = root.then(net.minecraft.server.command.CommandManager.literal(command.name));
+ } else {
+ builder = builder.then(net.minecraft.server.command.CommandManager.literal(command.name));
+ }
+ for (CommandManager.InternalCommand.InternalCommandInvoker invoker : command.invokers) {
+ for (Parameter parameter : invoker.method.getParameters()) {
+ Pair<ArgumentType<Object>, ArgumentType<Object>> pair = parsers.get(parameter.getType());
+ builder.then(net.minecraft.server.command.CommandManager.argument(parameter.getName(), parameter.isAnnotationPresent(Greedy.class) ? pair.getRight() : pair.getLeft()));
+ }
+ builder.executes((context ->
+ {
+ try {
+ ArrayList<Object> args = new ArrayList<>(invoker.method.getParameterCount());
+ for (Parameter parameter: invoker.method.getParameters()) {
+ args.add(context.getArgument(parameter.getName(), Object.class));
+ }
+ invoker.method.invoke(null, args);
+ return 1;
+ } catch (Exception e) {
+ e.printStackTrace();
+ UChat.chat(ChatColor.RED.toString() + ChatColor.BOLD + METHOD_RUN_ERROR);
+ return 0;
+ }
+ }));
+ }
+ for (CommandManager.InternalCommand child : command.children) {
+ loopThroughChildren(child, root, builder);
+ }
+ }
+
+ @Override
+ public void handleNewParser(ArgumentParser<?> parser, Class<?> clazz) {
+ parsers.put(clazz, new ImmutablePair<ArgumentType<Object>, ArgumentType<Object>>(new ArgumentType() {
+
+ @Override
+ public Object parse(StringReader reader) {
+ final String text = reader.getRemaining();
+ reader.setCursor(reader.getTotalLength());
+ return parser.parse(new Arguments(text.split("\\s+"), false));
+ }
+
+ @Override
+ public CompletableFuture<Suggestions> listSuggestions(CommandContext context, SuggestionsBuilder builder) {
+ return ArgumentType.super.listSuggestions(context, builder);
+ }
+ }, new ArgumentType() {
+
+ @Override
+ public Object parse(StringReader reader) {
+ final String text = reader.getRemaining();
+ reader.setCursor(reader.getTotalLength());
+ return parser.parse(new Arguments(text.split("\\s+"), true));
+ }
+
+ @Override
+ public CompletableFuture<Suggestions> listSuggestions(CommandContext context, SuggestionsBuilder builder) {
+ return ArgumentType.super.listSuggestions(context, builder);
+ }
+ }));
+ }
+}
diff --git a/versions/1.16.2-forge/api/1.16.2-forge.api b/versions/1.16.2-forge/api/1.16.2-forge.api
index fae79fb..cbd559e 100644
--- a/versions/1.16.2-forge/api/1.16.2-forge.api
+++ b/versions/1.16.2-forge/api/1.16.2-forge.api
@@ -64,8 +64,28 @@ public class cc/polyfrost/oneconfig/platform/impl/MousePlatformImpl : cc/polyfro
public fun isButtonDown (I)Z
}
+public class cc/polyfrost/oneconfig/platform/impl/NanoVGPlatformImpl : cc/polyfrost/oneconfig/platform/NanoVGPlatform {
+ public fun <init> ()V
+ public fun nnvgCreate (I)J
+ public fun nnvgDelete (J)V
+ public fun nnvglCreateImageFromHandle (JIIII)I
+ public fun nnvglImageHandle (JI)I
+ public fun nnvgluBindFramebuffer (JJ)V
+ public fun nnvgluCreateFramebuffer (JIII)J
+ public fun nnvgluDeleteFramebuffer (JJ)V
+ public fun nvgCreate (I)J
+ public fun nvgDelete (J)V
+ public fun nvglCreateImageFromHandle (JIIII)I
+ public fun nvglImageHandle (JI)I
+ public fun nvgluBindFramebuffer (JLorg/lwjgl/nanovg/NVGLUFramebuffer;)V
+ public fun nvgluCreateFramebuffer (JIII)Lorg/lwjgl/nanovg/NVGLUFramebuffer;
+ public fun nvgluDeleteFramebuffer (JLorg/lwjgl/nanovg/NVGLUFramebuffer;)V
+ public fun triggerStaticInitialization ()V
+}
+
public class cc/polyfrost/oneconfig/platform/impl/PlatformImpl : cc/polyfrost/oneconfig/platform/Platform {
public fun <init> ()V
+ public fun getLoader ()Lcc/polyfrost/oneconfig/platform/Platform$Loader;
public fun getMinecraftVersion ()I
public fun isCallingFromMinecraftThread ()Z
}
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/KeyboardMixin.java
index c7e6327..2a28d66 100644
--- 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/KeyboardMixin.java
@@ -9,7 +9,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(KeyboardListener.class)
-public class KeyboardListenerMixin {
+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/MouseHelperAccessor.java b/versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MouseAccessor.java
index d04ecb1..9cc518d 100644
--- 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/MouseAccessor.java
@@ -5,7 +5,7 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(MouseHelper.class)
-public interface MouseHelperAccessor {
- @Accessor
- double getAccumulatedScrollDelta();
+public interface MouseAccessor {
+ @Accessor("accumulatedScrollDelta")
+ double getEventDeltaWheel();
}
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/MouseMixin.java
index 42dd283..525f187 100644
--- 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/MouseMixin.java
@@ -9,7 +9,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(MouseHelper.class)
-public class MouseHelperMixin {
+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/TimeTrackerMixin.java b/versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/TickTimeTrackerMixin.java
index dd9920e..572076d 100644
--- 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/TickTimeTrackerMixin.java
@@ -13,7 +13,7 @@ import java.util.function.IntSupplier;
import java.util.function.LongSupplier;
@Mixin(TimeTracker.class)
-public class TimeTrackerMixin {
+public class TickTimeTrackerMixin {
@Inject(method = "<init>", at = @At("RETURN"))
private void onStart(LongSupplier longSupplier, IntSupplier intSupplier, CallbackInfo ci) {
EventManager.INSTANCE.post(new StartEvent());
diff --git a/versions/1.8.9-forge/api/1.8.9-forge.api b/versions/1.8.9-forge/api/1.8.9-forge.api
index da98be5..44cd883 100644
--- a/versions/1.8.9-forge/api/1.8.9-forge.api
+++ b/versions/1.8.9-forge/api/1.8.9-forge.api
@@ -64,8 +64,28 @@ public class cc/polyfrost/oneconfig/platform/impl/MousePlatformImpl : cc/polyfro
public fun isButtonDown (I)Z
}
+public class cc/polyfrost/oneconfig/platform/impl/NanoVGPlatformImpl : cc/polyfrost/oneconfig/platform/NanoVGPlatform {
+ public fun <init> ()V
+ public fun nnvgCreate (I)J
+ public fun nnvgDelete (J)V
+ public fun nnvglCreateImageFromHandle (JIIII)I
+ public fun nnvglImageHandle (JI)I
+ public fun nnvgluBindFramebuffer (JJ)V
+ public fun nnvgluCreateFramebuffer (JIII)J
+ public fun nnvgluDeleteFramebuffer (JJ)V
+ public fun nvgCreate (I)J
+ public fun nvgDelete (J)V
+ public fun nvglCreateImageFromHandle (JIIII)I
+ public fun nvglImageHandle (JI)I
+ public fun nvgluBindFramebuffer (JLorg/lwjgl/nanovg/NVGLUFramebuffer;)V
+ public fun nvgluCreateFramebuffer (JIII)Lorg/lwjgl/nanovg/NVGLUFramebuffer;
+ public fun nvgluDeleteFramebuffer (JLorg/lwjgl/nanovg/NVGLUFramebuffer;)V
+ public fun triggerStaticInitialization ()V
+}
+
public class cc/polyfrost/oneconfig/platform/impl/PlatformImpl : cc/polyfrost/oneconfig/platform/Platform {
public fun <init> ()V
+ public fun getLoader ()Lcc/polyfrost/oneconfig/platform/Platform$Loader;
public fun getMinecraftVersion ()I
public fun isCallingFromMinecraftThread ()Z
}
diff --git a/versions/build.gradle.kts b/versions/build.gradle.kts
index e8c161d..87c6b64 100644
--- a/versions/build.gradle.kts
+++ b/versions/build.gradle.kts
@@ -1,6 +1,5 @@
import gg.essential.gradle.util.RelocationTransform.Companion.registerRelocationAttribute
import gg.essential.gradle.util.noServerRunConfigs
-import gg.essential.gradle.util.prebundle
import net.fabricmc.loom.task.RemapSourcesJarTask
import java.text.SimpleDateFormat
@@ -105,7 +104,6 @@ val shade: Configuration by configurations.creating {
configurations.api.get().extendsFrom(this)
}
-val shadeNoPom: Configuration by configurations.creating
val shadeNoPom2: Configuration by configurations.creating
sourceSets {
@@ -121,53 +119,43 @@ dependencies {
isTransitive = false
}
- shadeRelocated("gg.essential:universalcraft-$platform:211") {
- isTransitive = false
- }
+ include("gg.essential:universalcraft-$platform:211", relocate = true, transitive = false, mod = true)
- shadeRelocated("com.github.KevinPriv:keventbus:c52e0a2ea0") {
- isTransitive = false
- }
+ include("com.github.KevinPriv:keventbus:c52e0a2ea0", relocate = true, transitive = false)
- @Suppress("GradlePackageUpdate") shadeRelocated("com.github.ben-manes.caffeine:caffeine:2.9.3")
+ @Suppress("GradlePackageUpdate") include("com.github.ben-manes.caffeine:caffeine:2.9.3", relocate = true)
// for other mods and universalcraft
val kotlinVersion: String by project
val coroutinesVersion: String by project
val serializationVersion: String by project
val atomicfuVersion: String by project
- shade("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion")
- shade("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion")
- shade("org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion")
- shade("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion")
-
- shade("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
- shade("org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:$coroutinesVersion")
- shade("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:$coroutinesVersion")
- shade("org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:$serializationVersion")
- shade("org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:$serializationVersion")
- shade("org.jetbrains.kotlinx:kotlinx-serialization-cbor-jvm:$serializationVersion")
- shade("org.jetbrains.kotlinx:atomicfu-jvm:$atomicfuVersion")
+ include("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion")
+ include("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion")
+ include("org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion")
+ include("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion")
+
+ include("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
+ include("org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:$coroutinesVersion")
+ include("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:$coroutinesVersion")
+ include("org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:$serializationVersion")
+ include("org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:$serializationVersion")
+ include("org.jetbrains.kotlinx:kotlinx-serialization-cbor-jvm:$serializationVersion")
+ include("org.jetbrains.kotlinx:atomicfu-jvm:$atomicfuVersion")
if (platform.isLegacyForge) {
- shade("org.spongepowered:mixin:0.7.11-SNAPSHOT") {
- isTransitive = false
- }
+ include("org.spongepowered:mixin:0.7.11-SNAPSHOT", pom = false, transitive = false)
}
shadeProject(project(":")) {
isTransitive = false
}
- shade("cc.polyfrost:lwjgl-$platform:1.0.0-alpha5")
- val prebundled = prebundle(shadeRelocated)
- modCompileOnly(prebundled)
- modRuntimeOnly(prebundled)
- shadeNoPom2(prebundled)
+ include("cc.polyfrost:lwjgl-$platform:1.0.0-alpha8")
dokkaHtmlPlugin("org.jetbrains.dokka:kotlin-as-java-plugin:1.6.21")
- configurations.named(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME) { extendsFrom(shadeNoPom); extendsFrom(shadeProject) }
- configurations.named(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME) { extendsFrom(shadeNoPom); extendsFrom(shadeProject) }
+ configurations.named(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME) { extendsFrom(shadeProject) }
+ configurations.named(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME) { extendsFrom(shadeProject) }
}
tasks {
@@ -233,7 +221,7 @@ tasks {
val shadowJar = named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
archiveClassifier.set("full-dev")
- configurations = listOf(shade, shadeNoPom, shadeNoPom2, shadeProject)
+ configurations = listOf(shade, shadeNoPom2, shadeProject, shadeRelocated)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
dependsOn(jar)
}
@@ -248,8 +236,8 @@ tasks {
}
jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
- dependsOn(shadeNoPom, shadeNoPom2, shadeProject)
- from(ArrayList<File>().run { addAll(shadeNoPom); addAll(shadeNoPom2); addAll(shadeProject); this }
+ dependsOn(shadeNoPom2, shadeProject, shadeRelocated)
+ from(ArrayList<File>().run { addAll(shadeNoPom2); addAll(shadeProject); addAll(shadeRelocated); this }
.map { if (it.isDirectory) it else zipTree(it) })
manifest {
attributes(
@@ -319,6 +307,9 @@ tasks {
archiveClassifier.set("sources")
}
doLast {
+ archiveFile.orNull?.asFile?.let {
+ it.copyTo(File(it.parentFile, it.nameWithoutExtension + "-dev" + it.extension.let { if (it.isBlank()) "" else ".$it" }), overwrite = true)
+ }
archiveClassifier.set("sources")
}
}
@@ -366,4 +357,103 @@ publishing {
}
}
}
+}
+
+fun DependencyHandlerScope.include(dependency: Any, pom: Boolean = true, mod: Boolean = false) {
+ if (platform.isForge) {
+ if (pom) {
+ shade(dependency)
+ } else {
+ shadeNoPom2(dependency)
+ compileOnly(dependency)
+ runtimeOnly(dependency)
+ }
+ } else {
+ if (pom) {
+ if (mod) {
+ modApi(dependency)
+ } else {
+ api(dependency)
+ }
+ } else {
+ if (mod) {
+ modCompileOnly(dependency)
+ modRuntimeOnly(dependency)
+ } else {
+ compileOnly(dependency)
+ runtimeOnly(dependency)
+ }
+ }
+ "include"(dependency)
+ }
+}
+
+fun DependencyHandlerScope.include(dependency: ModuleDependency, pom: Boolean = true, mod: Boolean = false, relocate: Boolean = false, transitive: Boolean = true) {
+ if (platform.isForge) {
+ if (relocate) {
+ shadeRelocated(dependency) { isTransitive = transitive }
+ compileOnly(dependency) { isTransitive = transitive; attributes { attribute(relocated, true) } }
+ runtimeOnly(dependency) { isTransitive = transitive; attributes { attribute(relocated, true) } }
+ } else {
+ if (pom) {
+ shade(dependency) { isTransitive = transitive }
+ } else {
+ shadeNoPom2(dependency) { isTransitive = transitive }
+ compileOnly(dependency) { isTransitive = transitive }
+ runtimeOnly(dependency) { isTransitive = transitive }
+ }
+ }
+ } else {
+ if (pom && !relocate) {
+ if (mod) {
+ modApi(dependency) { isTransitive = transitive }
+ } else {
+ api(dependency) { isTransitive = transitive }
+ }
+ } else {
+ if (mod) {
+ modCompileOnly(dependency) { isTransitive = transitive; if (relocate) attributes { attribute(relocated, true) } }
+ modRuntimeOnly(dependency) { isTransitive = transitive; if (relocate) attributes { attribute(relocated, true) } }
+ } else {
+ compileOnly(dependency) { isTransitive = transitive; if (relocate) attributes { attribute(relocated, true) } }
+ runtimeOnly(dependency) { isTransitive = transitive; if (relocate) attributes { attribute(relocated, true) } }
+ }
+ }
+ "include"(dependency) { isTransitive = transitive; if (relocate) attributes { attribute(relocated, true) } }
+ }
+}
+
+fun DependencyHandlerScope.include(dependency: String, pom: Boolean = true, mod: Boolean = false, relocate: Boolean = false, transitive: Boolean = true) {
+ if (platform.isForge) {
+ if (relocate) {
+ shadeRelocated(dependency) { isTransitive = transitive }
+ compileOnly(dependency) { isTransitive = transitive; attributes { attribute(relocated, true) } }
+ runtimeOnly(dependency) { isTransitive = transitive; attributes { attribute(relocated, true) } }
+ } else {
+ if (pom) {
+ shade(dependency) { isTransitive = transitive }
+ } else {
+ shadeNoPom2(dependency) { isTransitive = transitive }
+ compileOnly(dependency) { isTransitive = transitive }
+ runtimeOnly(dependency) { isTransitive = transitive }
+ }
+ }
+ } else {
+ if (pom && !relocate) {
+ if (mod) {
+ modApi(dependency) { isTransitive = transitive }
+ } else {
+ api(dependency) { isTransitive = transitive }
+ }
+ } else {
+ if (mod) {
+ modCompileOnly(dependency) { isTransitive = transitive; if (relocate) attributes { attribute(relocated, true) } }
+ modRuntimeOnly(dependency) { isTransitive = transitive; if (relocate) attributes { attribute(relocated, true) } }
+ } else {
+ compileOnly(dependency) { isTransitive = transitive; if (relocate) attributes { attribute(relocated, true) } }
+ runtimeOnly(dependency) { isTransitive = transitive; if (relocate) attributes { attribute(relocated, true) } }
+ }
+ }
+ "include"(dependency) { isTransitive = transitive; if (relocate) attributes { attribute(relocated, true) } }
+ }
} \ No newline at end of file
diff --git a/versions/root.gradle.kts b/versions/root.gradle.kts
index 6a09be5..0b57e5a 100644
--- a/versions/root.gradle.kts
+++ b/versions/root.gradle.kts
@@ -10,7 +10,9 @@ plugins {
preprocess {
"1.8.9-forge"(10809, "srg") {
"1.12.2-forge"(11202, "srg", file("1.8.9-1.12.2.txt")) {
- "1.16.2-forge"(11602, "srg", file("1.12.2-1.16.2.txt"))
+ "1.16.2-forge"(11602, "srg", file("1.12.2-1.16.2.txt")) {
+ "1.16.2-fabric"(11602, "yarn")
+ }
}
}
} \ No newline at end of file
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java b/versions/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java
index 4f73198..7eb5ef9 100644
--- a/versions/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java
@@ -24,43 +24,32 @@ import java.io.File;
//#if MC<=11202
@net.minecraftforge.fml.common.Mod(modid = "@ID@", name = "@NAME@", version = "@VER@")
//#else
+//#if FORGE==1
//$$ @net.minecraftforge.fml.common.Mod("@ID@")
//#endif
+//#endif
public class OneConfig {
public OneConfig() {
EventManager.INSTANCE.register(this);
}
- public static final File oneConfigDir = new File("./OneConfig");
public static final Logger LOGGER = LogManager.getLogger("@NAME@");
- private static boolean preLaunched = false;
private static boolean initialized = false;
/**
- * Called before mods are loaded.
+ * Called after mods are loaded.
* <p><b>SHOULD NOT BE CALLED!</b></p>
*/
- public static void preLaunch() {
- if (preLaunched) return;
- oneConfigDir.mkdirs();
- new File(oneConfigDir, "profiles").mkdirs();
+ @SuppressWarnings("ResultOfMethodCallIgnored")
+ public static void init() {
+ if (initialized) return;
if (OneConfigConfig.getInstance() == null) {
OneConfigConfig.getInstance();
}
if (Preferences.getInstance() == null) {
Preferences.getInstance();
}
- preLaunched = true;
- }
-
- /**
- * Called after mods are loaded.
- * <p><b>SHOULD NOT BE CALLED!</b></p>
- */
- @SuppressWarnings("ResultOfMethodCallIgnored")
- public static void init() {
- if (initialized) return;
GuiUtils.getDeltaTime(); // called to make sure static initializer is called
try {
EventManager.INSTANCE.register(BlurHandler.INSTANCE);
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/internal/eggs/TechnobladeCrownRenderer.java b/versions/src/main/java/cc/polyfrost/oneconfig/internal/eggs/TechnobladeCrownRenderer.java
deleted file mode 100644
index f5e7bed..0000000
--- a/versions/src/main/java/cc/polyfrost/oneconfig/internal/eggs/TechnobladeCrownRenderer.java
+++ /dev/null
@@ -1,39 +0,0 @@
-//#if MC<=11202
-package cc.polyfrost.oneconfig.internal.eggs;
-
-import cc.polyfrost.oneconfig.internal.config.Preferences;
-import net.minecraft.client.model.ModelPig;
-import net.minecraft.client.renderer.entity.RenderPig;
-import net.minecraft.client.renderer.entity.layers.LayerRenderer;
-import net.minecraft.entity.passive.EntityPig;
-import net.minecraft.util.ResourceLocation;
-
-/**
- * Adapted from technomodel under MIT
- * <a href="https://github.com/thecolonel63/technomodel/blob/master/LICENSE">...</a>
- */
-public class TechnobladeCrownRenderer<T extends EntityPig> implements LayerRenderer<T> {
-
- private static final ResourceLocation CROWN_TEXTURE = new ResourceLocation("oneconfig", "textures/entity/pig/technocrown.png");
- private final RenderPig renderer;
- private final ModelPig pigModel = new ModelPig(0.5F);
-
- public TechnobladeCrownRenderer(RenderPig renderPig) {
- renderer = renderPig;
- }
-
- @Override
- public void doRenderLayer(T entitylivingbaseIn, float f, float g, float partialTicks, float h, float i, float j, float scale) {
- if (Preferences.easterEgg1 && entitylivingbaseIn.hasCustomName() && entitylivingbaseIn.getCustomNameTag().equals("Technoblade")) {
- this.renderer.bindTexture(CROWN_TEXTURE);
- this.pigModel.setModelAttributes(renderer.getMainModel());
- this.pigModel.render(entitylivingbaseIn, f, g, h, i, j, scale);
- }
- }
-
- @Override
- public boolean shouldCombineTextures() {
- return true;
- }
-}
-//#endif \ No newline at end of file
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/internal/gui/impl/BlurHandlerImpl.java b/versions/src/main/java/cc/polyfrost/oneconfig/internal/gui/impl/BlurHandlerImpl.java
index 3424d2b..f4d15a4 100644
--- a/versions/src/main/java/cc/polyfrost/oneconfig/internal/gui/impl/BlurHandlerImpl.java
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/internal/gui/impl/BlurHandlerImpl.java
@@ -7,6 +7,9 @@ import cc.polyfrost.oneconfig.gui.OneConfigGui;
import cc.polyfrost.oneconfig.internal.config.Preferences;
import cc.polyfrost.oneconfig.internal.gui.BlurHandler;
import cc.polyfrost.oneconfig.internal.mixin.ShaderGroupAccessor;
+//#if FABRIC==1
+//$$ import cc.polyfrost.oneconfig.internal.mixin.GameRendererAccessor;
+//#endif
import cc.polyfrost.oneconfig.libs.eventbus.Subscribe;
import cc.polyfrost.oneconfig.libs.universal.UMinecraft;
import cc.polyfrost.oneconfig.libs.universal.UScreen;
@@ -102,7 +105,11 @@ public class BlurHandlerImpl implements BlurHandler {
// a one of ours, we should load our own blur!
if (!isShaderActive() && gui instanceof OneConfigGui && Preferences.enableBlur) {
+ //#if FABRIC==1
+ //$$ ((GameRendererAccessor) UMinecraft.getMinecraft().gameRenderer).invokeLoadShader(this.blurShader);
+ //#else
UMinecraft.getMinecraft().entityRenderer.loadShader(this.blurShader);
+ //#endif
this.start = System.currentTimeMillis();
this.progress = 0;
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MinecraftMixin.java b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MinecraftMixin.java
index 23d7d84..d49ea5d 100644
--- a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MinecraftMixin.java
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MinecraftMixin.java
@@ -32,11 +32,6 @@ public class MinecraftMixin {
Runtime.getRuntime().addShutdownHook(new Thread(() -> EventManager.INSTANCE.post(new ShutdownEvent())));
}
- @Inject(method = "startGame", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/client/FMLClientHandler;beginMinecraftLoading(Lnet/minecraft/client/Minecraft;Ljava/util/List;Lnet/minecraft/client/resources/IReloadableResourceManager;)V", remap = false), remap = true)
- private void onPreLaunch(CallbackInfo ci) {
- OneConfig.preLaunch();
- }
-
@Inject(method = "startGame", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/client/FMLClientHandler;onInitializationComplete()V", shift = At.Shift.AFTER, remap = false), remap = true)
private void onInit(CallbackInfo ci) {
EventManager.INSTANCE.post(new InitializationEvent());
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/RenderPigMixin.java b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/RenderPigMixin.java
deleted file mode 100644
index 1bd1fae..0000000
--- a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/RenderPigMixin.java
+++ /dev/null
@@ -1,25 +0,0 @@
-//#if MC<=11202
-package cc.polyfrost.oneconfig.internal.mixin;
-
-import cc.polyfrost.oneconfig.internal.eggs.TechnobladeCrownRenderer;
-import net.minecraft.client.model.ModelBase;
-import net.minecraft.client.renderer.entity.RenderLiving;
-import net.minecraft.client.renderer.entity.RenderManager;
-import net.minecraft.client.renderer.entity.RenderPig;
-import net.minecraft.entity.passive.EntityPig;
-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(RenderPig.class)
-public abstract class RenderPigMixin extends RenderLiving<EntityPig> {
- public RenderPigMixin(RenderManager renderManager, ModelBase modelBase, float f) {
- super(renderManager, modelBase, f);
- }
- @Inject(method = "<init>", at = @At("TAIL"))
- private void addCrown(RenderManager renderManager, ModelBase modelBase, float f, CallbackInfo ci) {
- addLayer(new TechnobladeCrownRenderer<>((RenderPig) (Object) this));
- }
-}
-//#endif \ No newline at end of file
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/internal/plugin/OneConfigMixinPlugin.java b/versions/src/main/java/cc/polyfrost/oneconfig/internal/plugin/OneConfigMixinPlugin.java
index 6a76a09..0ef5414 100644
--- a/versions/src/main/java/cc/polyfrost/oneconfig/internal/plugin/OneConfigMixinPlugin.java
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/internal/plugin/OneConfigMixinPlugin.java
@@ -43,11 +43,16 @@ public class OneConfigMixinPlugin implements IMixinConfigPlugin {
public List<String> getMixins() {
if (Platform.getInstance().getMinecraftVersion() >= 11600) {
ArrayList<String> mixins = new ArrayList<>();
- mixins.add("ClientModLoaderMixin");
- mixins.add("KeyboardListenerMixin");
- mixins.add("MouseHelperAccessor");
- mixins.add("MouseHelperMixin");
- mixins.add("TimeTrackerMixin");
+ if (Platform.getInstance().getLoader() == Platform.Loader.FORGE) {
+ mixins.add("ClientModLoaderMixin");
+ } else {
+ mixins.add("FramebufferMixin");
+ mixins.add("GameRendererAccessor");
+ }
+ mixins.add("KeyboardMixin");
+ mixins.add("MouseAccessor");
+ mixins.add("MouseMixin");
+ mixins.add("TickTimeTrackerMixin");
return mixins;
} else {
return null;
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/GLPlatformImpl.java b/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/GLPlatformImpl.java
index b53b357..16ff25c 100644
--- a/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/GLPlatformImpl.java
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/GLPlatformImpl.java
@@ -7,9 +7,13 @@ import cc.polyfrost.oneconfig.platform.GLPlatform;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
+
+//#if FORGE==1
import net.minecraft.client.shader.Framebuffer;
+//#else
+//$$ import cc.polyfrost.oneconfig.internal.hook.FramebufferHook;
+//#endif
-@SuppressWarnings("unused")
public class GLPlatformImpl implements GLPlatform {
@Override
@@ -48,7 +52,11 @@ public class GLPlatformImpl implements GLPlatform {
@Override
public void enableStencil() {
+ //#if FORGE==1
Framebuffer framebuffer = UMinecraft.getMinecraft().getFramebuffer();
+ //#else
+ //$$ FramebufferHook framebuffer = ((FramebufferHook) UMinecraft.getMinecraft().getFramebuffer());
+ //#endif
if (!framebuffer.isStencilEnabled()) {
framebuffer.enableStencil();
}
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/GuiPlatformImpl.java b/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/GuiPlatformImpl.java
index 6ea3c03..e4628c1 100644
--- a/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/GuiPlatformImpl.java
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/GuiPlatformImpl.java
@@ -6,7 +6,6 @@ import cc.polyfrost.oneconfig.platform.GuiPlatform;
import net.minecraft.client.gui.GuiChat;
import net.minecraft.client.gui.GuiScreen;
-@SuppressWarnings("unused")
public class GuiPlatformImpl implements GuiPlatform {
@Override
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/I18nPlatformImpl.java b/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/I18nPlatformImpl.java
index 1913238..6245bc4 100644
--- a/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/I18nPlatformImpl.java
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/I18nPlatformImpl.java
@@ -3,7 +3,6 @@ package cc.polyfrost.oneconfig.platform.impl;
import cc.polyfrost.oneconfig.platform.I18nPlatform;
import net.minecraft.client.resources.I18n;
-@SuppressWarnings("unused")
public class I18nPlatformImpl implements I18nPlatform {
@Override
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/LoaderPlatformImpl.java b/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/LoaderPlatformImpl.java
index c984ac3..f4a78ac 100644
--- a/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/LoaderPlatformImpl.java
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/LoaderPlatformImpl.java
@@ -2,17 +2,26 @@ package cc.polyfrost.oneconfig.platform.impl;
import cc.polyfrost.oneconfig.platform.LoaderPlatform;
//#if MC>=11600
-//$$ import net.minecraftforge.fml.ModList;
+ //#if FORGE==1
+ //$$ import net.minecraftforge.fml.ModList;
+ //#else
+ //$$ import net.fabricmc.loader.api.FabricLoader;
+ //#endif
//#endif
+//#if FORGE==1
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.ModContainer;
+//#endif
-@SuppressWarnings("unused")
public class LoaderPlatformImpl implements LoaderPlatform {
@Override
public boolean isModLoaded(String id) {
//#if MC>=11600
- //$$ return ModList.get().isLoaded(id);
+ //#if FORGE==1
+ //$$ return ModList.get().isLoaded(id);
+ //#else
+ //$$ return FabricLoader.getInstance().isModLoaded(id);
+ //#endif
//#else
return Loader.isModLoaded(id);
//#endif
@@ -20,17 +29,25 @@ public class LoaderPlatformImpl implements LoaderPlatform {
@Override
public boolean hasActiveModContainer() {
+ //#if FORGE==1
return Loader.instance().activeModContainer() != null;
+ //#else
+ //$$ return false;
+ //#endif
}
@Override
public ActiveMod getActiveModContainer() {
+ //#if FORGE==1
ModContainer container = Loader.instance().activeModContainer();
if (container == null) return null;
- //#if MC==11202
- return new ActiveMod(container.getName(), container.getModId(), container.getVersion());
+ //#if MC==11202
+ return new ActiveMod(container.getName(), container.getModId(), container.getVersion());
+ //#else
+ //$$ return new ActiveMod(container.getModInfo().getDisplayName(), container.getModId(), container.getModInfo().getVersion().getQualifier());
+ //#endif
//#else
- //$$ return new ActiveMod(container.getModInfo().getDisplayName(), container.getModId(), container.getModInfo().getVersion().getQualifier());
+ //$$ return null;
//#endif
}
}
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/MousePlatformImpl.java b/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/MousePlatformImpl.java
index e368a91..74fdd04 100644
--- a/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/MousePlatformImpl.java
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/MousePlatformImpl.java
@@ -3,13 +3,12 @@ package cc.polyfrost.oneconfig.platform.impl;
import cc.polyfrost.oneconfig.platform.MousePlatform;
//#if MC>=11600
//$$ import cc.polyfrost.oneconfig.libs.universal.UMinecraft;
-//$$ import cc.polyfrost.oneconfig.internal.mixin.MouseHelperAccessor;
+//$$ import cc.polyfrost.oneconfig.internal.mixin.MouseAccessor;
//$$ import org.lwjgl.glfw.GLFW;
//#else
import org.lwjgl.input.Mouse;
//#endif
-@SuppressWarnings("unused")
public class MousePlatformImpl implements MousePlatform {
//#if MC>11600
@@ -37,7 +36,7 @@ public class MousePlatformImpl implements MousePlatform {
@Override
public double getDWheel() {
//#if MC>=11600
- //$$ double scrollDelta = ((MouseHelperAccessor) UMinecraft.getMinecraft().mouseHelper).getAccumulatedScrollDelta();
+ //$$ double scrollDelta = ((MouseAccessor) UMinecraft.getMinecraft().mouseHelper).getEventDeltaWheel();
//$$ double amount = scrollDelta - prevScroll;
//$$ prevScroll = scrollDelta;
//$$ return amount;
@@ -49,7 +48,11 @@ public class MousePlatformImpl implements MousePlatform {
@Override
public double getMouseDX() {
//#if MC>=11600
- //$$ return UMinecraft.getMinecraft().mouseHelper.getXVelocity();
+ //#if FORGE==1
+ //$$ return UMinecraft.getMinecraft().mouseHelper.getXVelocity();
+ //#else
+ //$$ return ((MouseAccessor) UMinecraft.getMinecraft().mouse).getCursorDeltaX();
+ //#endif
//#else
return Mouse.getDX();
//#endif
@@ -58,7 +61,11 @@ public class MousePlatformImpl implements MousePlatform {
@Override
public double getMouseDY() {
//#if MC>=11600
- //$$ return UMinecraft.getMinecraft().mouseHelper.getYVelocity();
+ //#if FORGE==1
+ //$$ return UMinecraft.getMinecraft().mouseHelper.getYVelocity();
+ //#else
+ //$$ return ((MouseAccessor) UMinecraft.getMinecraft().mouse).getCursorDeltaY();
+ //#endif
//#else
return Mouse.getDY();
//#endif
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/NanoVGPlatformImpl.java b/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/NanoVGPlatformImpl.java
new file mode 100644
index 0000000..8469fcc
--- /dev/null
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/NanoVGPlatformImpl.java
@@ -0,0 +1,88 @@
+package cc.polyfrost.oneconfig.platform.impl;
+
+import cc.polyfrost.oneconfig.platform.NanoVGPlatform;
+import org.jetbrains.annotations.Nullable;
+import org.lwjgl.nanovg.NVGLUFramebuffer;
+import org.lwjgl.nanovg.NanoVGGL2;
+
+public class NanoVGPlatformImpl implements NanoVGPlatform {
+ @Override
+ public int nnvglCreateImageFromHandle(long var0, int var2, int var3, int var4, int var5) {
+ return NanoVGGL2.nnvglCreateImageFromHandle(var0, var2, var3, var4, var5);
+ }
+
+ @Override
+ public int nvglCreateImageFromHandle(long ctx, int textureId, int w, int h, int flags) {
+ return NanoVGGL2.nvglCreateImageFromHandle(ctx, textureId, w, h, flags);
+ }
+
+ @Override
+ public int nnvglImageHandle(long var0, int var2) {
+ return NanoVGGL2.nnvglImageHandle(var0, var2);
+ }
+
+ @Override
+ public int nvglImageHandle(long ctx, int image) {
+ return NanoVGGL2.nvglImageHandle(ctx, image);
+ }
+
+ @Override
+ public long nnvgCreate(int var0) {
+ return NanoVGGL2.nnvgCreate(var0);
+ }
+
+ @Override
+ public long nvgCreate(int flags) {
+ return NanoVGGL2.nvgCreate(flags);
+ }
+
+ @Override
+ public void nnvgDelete(long var0) {
+ NanoVGGL2.nnvgDelete(var0);
+ }
+
+ @Override
+ public void nvgDelete(long ctx) {
+ NanoVGGL2.nvgDelete(ctx);
+ }
+
+ @Override
+ public long nnvgluCreateFramebuffer(long var0, int var2, int var3, int var4) {
+ return NanoVGGL2.nnvgluCreateFramebuffer(var0, var2, var3, var4);
+ }
+
+ @Nullable
+ @Override
+ public NVGLUFramebuffer nvgluCreateFramebuffer(long ctx, int w, int h, int imageFlags) {
+ return NanoVGGL2.nvgluCreateFramebuffer(ctx, w, h, imageFlags);
+ }
+
+ @Override
+ public void nnvgluBindFramebuffer(long var0, long var2) {
+ NanoVGGL2.nnvgluBindFramebuffer(var0, var2);
+ }
+
+ @Override
+ public void nvgluBindFramebuffer(long ctx, @Nullable NVGLUFramebuffer fb) {
+ NanoVGGL2.nvgluBindFramebuffer(ctx, fb);
+ }
+
+ @Override
+ public void nnvgluDeleteFramebuffer(long var0, long var2) {
+ NanoVGGL2.nnvgluDeleteFramebuffer(var0, var2);
+ }
+
+ @Override
+ public void nvgluDeleteFramebuffer(long ctx, NVGLUFramebuffer fb) {
+ NanoVGGL2.nvgluDeleteFramebuffer(ctx, fb);
+ }
+
+ @Override
+ public void triggerStaticInitialization() {
+ try {
+ Class.forName(NanoVGGL2.class.getName());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/PlatformImpl.java b/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/PlatformImpl.java
index 91edc53..ef22285 100644
--- a/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/PlatformImpl.java
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/PlatformImpl.java
@@ -3,7 +3,6 @@ package cc.polyfrost.oneconfig.platform.impl;
import cc.polyfrost.oneconfig.platform.Platform;
import net.minecraft.client.Minecraft;
-@SuppressWarnings("unused")
public class PlatformImpl implements Platform {
@Override
public boolean isCallingFromMinecraftThread() {
@@ -38,4 +37,13 @@ public class PlatformImpl implements Platform {
return 10800;
//#endif
}
+
+ @Override
+ public Loader getLoader() {
+ //#if FORGE==1
+ return Loader.FORGE;
+ //#else
+ //$$ return Loader.FABRIC;
+ //#endif
+ }
}
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/ServerPlatformImpl.java b/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/ServerPlatformImpl.java
index 81454b0..8f145d3 100644
--- a/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/ServerPlatformImpl.java
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/platform/impl/ServerPlatformImpl.java
@@ -4,7 +4,6 @@ import cc.polyfrost.oneconfig.libs.universal.UMinecraft;
import cc.polyfrost.oneconfig.platform.ServerPlatform;
import net.minecraft.client.entity.EntityPlayerSP;
-@SuppressWarnings("unused")
public class ServerPlatformImpl implements ServerPlatform {
@Override
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/test/TestBasicHud_Test.java b/versions/src/main/java/cc/polyfrost/oneconfig/test/TestBasicHud_Test.java
new file mode 100644
index 0000000..805937f
--- /dev/null
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/test/TestBasicHud_Test.java
@@ -0,0 +1,23 @@
+package cc.polyfrost.oneconfig.test;
+
+import cc.polyfrost.oneconfig.hud.BasicHud;
+import cc.polyfrost.oneconfig.internal.assets.Images;
+import cc.polyfrost.oneconfig.libs.universal.UMatrixStack;
+import cc.polyfrost.oneconfig.renderer.RenderManager;
+
+public class TestBasicHud_Test extends BasicHud {
+ @Override
+ protected void draw(UMatrixStack matrices, float x, float y, float scale, boolean example) {
+ RenderManager.setupAndDraw(true, vg -> RenderManager.drawImage(vg, Images.HUE_GRADIENT, x, y, 50 * scale, 50f * scale));
+ }
+
+ @Override
+ protected float getWidth(float scale, boolean example) {
+ return 50 * scale;
+ }
+
+ @Override
+ protected float getHeight(float scale, boolean example) {
+ return 50 * scale;
+ }
+}
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/test/TestConfig_Test.java b/versions/src/main/java/cc/polyfrost/oneconfig/test/TestConfig_Test.java
index 772bba7..09b3fe5 100644
--- a/versions/src/main/java/cc/polyfrost/oneconfig/test/TestConfig_Test.java
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/test/TestConfig_Test.java
@@ -126,6 +126,12 @@ public class TestConfig_Test extends Config {
)
public TestMultilineHud_Test multilineHud = new TestMultilineHud_Test();
+ @HUD(
+ name = "Test Basic HUD",
+ category = "HUD"
+ )
+ public TestBasicHud_Test basicHud = new TestBasicHud_Test();
+
public TestConfig_Test() {
super(new Mod("Test Mod", ModType.UTIL_QOL, new VigilanceMigrator("./config/testConfig.toml")), "hacksConfig.json");
initialize();
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/test/TestHud_Test.java b/versions/src/main/java/cc/polyfrost/oneconfig/test/TestHud_Test.java
index ae557c7..4b380ca 100644
--- a/versions/src/main/java/cc/polyfrost/oneconfig/test/TestHud_Test.java
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/test/TestHud_Test.java
@@ -15,7 +15,7 @@ public class TestHud_Test extends SingleTextHud {
}
@Override
- public String getText() {
+ public String getText(boolean example) {
times++;
return String.valueOf(times);
}
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/test/TestKotlinNanoVGGui_Test.kt b/versions/src/main/java/cc/polyfrost/oneconfig/test/TestKotlinNanoVGGui_Test.kt
new file mode 100644
index 0000000..fd6df6b
--- /dev/null
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/test/TestKotlinNanoVGGui_Test.kt
@@ -0,0 +1,45 @@
+package cc.polyfrost.oneconfig.test
+
+import cc.polyfrost.oneconfig.renderer.font.Fonts
+import cc.polyfrost.oneconfig.utils.dsl.*
+import cc.polyfrost.oneconfig.utils.gui.OneUIScreen
+import java.awt.Color
+import kotlin.system.measureTimeMillis
+
+/**
+ * A kotlinified version of [TestNanoVGGui_Test].
+ * Uses OneConfig's Kotlin DSL to render instead of RenderManager
+ *
+ * @see nanoVG
+ * @see TestNanoVGGui_Test
+ */
+class TestKotlinNanoVGGui_Test : OneUIScreen() {
+
+ override fun draw(vg: Long, partialTicks: Float) {
+ nanoVG(vg) {
+ val millis = measureTimeMillis {
+ drawRect(0f, 0f, 100f, 100f, Color.BLUE.rgb)
+ drawRoundedRect(
+ 305f, 305f, 100f, 100f, 8f, Color.YELLOW.rgb
+ )
+ drawText(
+ "Hello!", 100f, 100f, Color.WHITE.rgb, 50f, Fonts.BOLD
+ )
+ drawLine(
+ 0f, 0f, 100f, 100f, 7f, Color.PINK.rgb
+ )
+ drawCircle(
+ 200f, 200f, 50f, Color.WHITE.rgb
+ )
+ }
+ drawText(
+ millis.toString() + "ms",
+ 500f,
+ 500f,
+ Color.WHITE.rgb,
+ 100f,
+ Fonts.BOLD
+ )
+ }
+ }
+} \ No newline at end of file
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/test/TestMultilineHud_Test.java b/versions/src/main/java/cc/polyfrost/oneconfig/test/TestMultilineHud_Test.java
index 1665062..f71b01d 100644
--- a/versions/src/main/java/cc/polyfrost/oneconfig/test/TestMultilineHud_Test.java
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/test/TestMultilineHud_Test.java
@@ -10,7 +10,8 @@ public class TestMultilineHud_Test extends TextHud {
}
@Override
- protected void getLines(List<String> lines) {
+ protected void getLines(List<String> lines, boolean example) {
lines.add(String.valueOf(System.currentTimeMillis()));
+ lines.add("HEY!");
}
}
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/test/TestNanoVGGui_Test.java b/versions/src/main/java/cc/polyfrost/oneconfig/test/TestNanoVGGui_Test.java
index e8b6b91..4182bb6 100644
--- a/versions/src/main/java/cc/polyfrost/oneconfig/test/TestNanoVGGui_Test.java
+++ b/versions/src/main/java/cc/polyfrost/oneconfig/test/TestNanoVGGui_Test.java
@@ -2,25 +2,27 @@ package cc.polyfrost.oneconfig.test;
import cc.polyfrost.oneconfig.renderer.RenderManager;
import cc.polyfrost.oneconfig.renderer.font.Fonts;
-import cc.polyfrost.oneconfig.libs.universal.UMatrixStack;
-import cc.polyfrost.oneconfig.libs.universal.UScreen;
-import org.jetbrains.annotations.NotNull;
+import cc.polyfrost.oneconfig.utils.gui.OneUIScreen;
import java.awt.*;
-public class TestNanoVGGui_Test extends UScreen {
+/**
+ * A GUI that uses RenderManager, NanoVG, and OneUIScreen to render a simple GUI.
+ *
+ * @see OneUIScreen
+ * @see TestKotlinNanoVGGui_Test
+ * @see RenderManager
+ */
+public class TestNanoVGGui_Test extends OneUIScreen {
@Override
- public void onDrawScreen(@NotNull UMatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
- super.onDrawScreen(matrixStack, mouseX, mouseY, partialTicks);
+ public void draw(long vg, float partialTicks) {
long startTime = System.nanoTime();
- RenderManager.setupAndDraw((vg) -> {
- RenderManager.drawRect(vg, 0, 0, 100, 100, Color.BLUE.getRGB());
- RenderManager.drawRoundedRect(vg, 305, 305, 100, 100, Color.YELLOW.getRGB(), 8);
- RenderManager.drawText(vg, "Hello!", 100, 100, Color.WHITE.getRGB(), 50, Fonts.BOLD);
- RenderManager.drawLine(vg, 0, 0, 100, 100, 7, Color.PINK.getRGB());
- RenderManager.drawCircle(vg, 200, 200, 50, Color.WHITE.getRGB());
- RenderManager.drawText(vg, (float) (System.nanoTime() - startTime) / 1000000f + "ms", 500, 500, Color.WHITE.getRGB(), 100, Fonts.BOLD);
- });
+ RenderManager.drawRect(vg, 0, 0, 100, 100, Color.BLUE.getRGB());
+ RenderManager.drawRoundedRect(vg, 305, 305, 100, 100, Color.YELLOW.getRGB(), 8);
+ RenderManager.drawText(vg, "Hello!", 100, 100, Color.WHITE.getRGB(), 50, Fonts.BOLD);
+ RenderManager.drawLine(vg, 0, 0, 100, 100, 7, Color.PINK.getRGB());
+ RenderManager.drawCircle(vg, 200, 200, 50, Color.WHITE.getRGB());
+ RenderManager.drawText(vg, (float) (System.nanoTime() - startTime) / 1000000f + "ms", 500, 500, Color.WHITE.getRGB(), 100, Fonts.BOLD);
}
}
diff --git a/versions/src/main/resources/META-INF/services/cc.polyfrost.oneconfig.platform.NanoVGPlatform b/versions/src/main/resources/META-INF/services/cc.polyfrost.oneconfig.platform.NanoVGPlatform
new file mode 100644
index 0000000..7d256b7
--- /dev/null
+++ b/versions/src/main/resources/META-INF/services/cc.polyfrost.oneconfig.platform.NanoVGPlatform
@@ -0,0 +1 @@
+cc.polyfrost.oneconfig.platform.impl.NanoVGPlatformImpl \ No newline at end of file
diff --git a/versions/src/main/resources/fabric.mod.json b/versions/src/main/resources/fabric.mod.json
new file mode 100644
index 0000000..23d8e97
--- /dev/null
+++ b/versions/src/main/resources/fabric.mod.json
@@ -0,0 +1,35 @@
+{
+ "schemaVersion": 1,
+ "id": "${id}",
+ "name": "${name}",
+ "version": "${version}",
+ "description": "OneConfig",
+ "authors": [
+ "Polyfrost"
+ ],
+ "contact": {
+ "homepage": "https://polyfrost.cc",
+ "sources": "https://github.com/Polyfrost/OneConfig",
+ "issues": "https://inv.wtf/polyfrost"
+ },
+ "license": "LGPL-3.0",
+ "environment": "client",
+ "mixins": [
+ "mixins.oneconfig.json"
+ ],
+ "entrypoints": {
+ "preLaunch": [
+ "cc.polyfrost.oneconfig.internal.plugin.OneConfigPreLaunch"
+ ]
+ },
+ "depends": {
+ "fabricloader": ">=0.12.0",
+ "minecraft": "${mcVersionStr}",
+ "java": ">=${java}"
+ },
+ "custom": {
+ "modmenu": {
+ "badges": [ "library" ]
+ }
+ }
+} \ No newline at end of file
diff --git a/versions/src/main/resources/mixins.oneconfig.json b/versions/src/main/resources/mixins.oneconfig.json
index 1486c9d..4a03fd0 100644
--- a/versions/src/main/resources/mixins.oneconfig.json
+++ b/versions/src/main/resources/mixins.oneconfig.json
@@ -14,7 +14,6 @@
"NetHandlerPlayClientMixin",
"NetworkManagerMixin",
"OptifineConfigMixin",
- "RenderPigMixin",
"ShaderGroupAccessor",
"VigilantMixin",
"WorldClientMixin"