aboutsummaryrefslogtreecommitdiff
path: root/versions/src/main/java/cc/polyfrost/oneconfig/platform
diff options
context:
space:
mode:
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