aboutsummaryrefslogtreecommitdiff
path: root/versions/src/main/java/cc/polyfrost/oneconfig/platform
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/src/main/java/cc/polyfrost/oneconfig/platform
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/src/main/java/cc/polyfrost/oneconfig/platform')
-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
8 files changed, 141 insertions, 16 deletions
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