From ae0f3c2b3bd21f8e2251602efd41da178b0744ea Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 2 May 2026 12:43:43 -0500 Subject: [PATCH] Add oculus api implementation --- forge/build.gradle | 7 +++-- .../wrappers/modAccessor/OculusAccessor.java | 29 ++++++++++++++----- versionProperties/1.16.5.properties | 2 ++ versionProperties/1.17.1.properties | 2 ++ versionProperties/1.18.2.properties | 4 ++- versionProperties/1.19.2.properties | 2 ++ versionProperties/1.19.4.properties | 2 ++ versionProperties/1.20.1.properties | 2 ++ versionProperties/1.20.2.properties | 2 ++ versionProperties/1.20.4.properties | 2 ++ 10 files changed, 44 insertions(+), 10 deletions(-) diff --git a/forge/build.gradle b/forge/build.gradle index 33ba45e15..39913fb5b 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -18,10 +18,13 @@ def addMod(path, enabled) { dependencies { // TerraForged addMod("curse.maven:TerraForged-363820:${rootProject.terraforged_version}", rootProject.enable_terraforged) - + // TerraFirmaCraft addMod("curse.maven:TerraFirmaCraft-302973:4616004", rootProject.enable_terrafirmacraft) - + + // Oculus (Iris port) + addMod("maven.modrinth:oculus:${rootProject.oculus_version}", rootProject.enable_oculus) + // TODO: Check if this is still needed and if so ensure this code works for MC 26.1+ // (potential) hack fix for MC 1.20.6 and later, force jopt-simple to be exactly 5.0.4 because Mojang ships that version, but some transitive dependencies request 6.0+ def mcParts = rootProject.minecraft_version.split("\\.") diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/wrappers/modAccessor/OculusAccessor.java b/forge/src/main/java/com/seibel/distanthorizons/forge/wrappers/modAccessor/OculusAccessor.java index e0a031b66..adadd2ad8 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/wrappers/modAccessor/OculusAccessor.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/wrappers/modAccessor/OculusAccessor.java @@ -23,35 +23,50 @@ import com.seibel.distanthorizons.core.logging.DhLogger; import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IIrisAccessor; +#if MC_VER == MC_1_20_1 +import net.irisshaders.iris.Iris; +import net.irisshaders.iris.api.v0.IrisApi; +#else +#endif + public class OculusAccessor implements IIrisAccessor { protected static final DhLogger LOGGER = new DhLoggerBuilder().build(); public OculusAccessor() - { - LOGGER.warn("Partial Oculus support enabled. Some DH features may be disabled or behave strangely, use Iris instead if possible."); - } + { LOGGER.warn("Partial Oculus support enabled. Some DH features may be disabled or behave strangely, use Iris instead if possible."); } @Override public String getModName() { - return "oculus"; + #if MC_VER == MC_1_20_1 + return Iris.MODID; + #else + return "iris"; // Oculus doesn't support this MC version + #endif } @Override public boolean isShaderPackInUse() { - // assume shaders are always active - return true; + #if MC_VER == MC_1_20_1 + return IrisApi.getInstance().isShaderPackInUse(); + #else + return true; // Oculus doesn't support this MC version + #endif } @Override public boolean isRenderingShadowPass() { - return false; + #if MC_VER == MC_1_20_1 + return IrisApi.getInstance().isRenderingShadowPass(); + #else + return false; // Oculus doesn't support this MC version + #endif } } diff --git a/versionProperties/1.16.5.properties b/versionProperties/1.16.5.properties index c749e2131..63850b9fb 100644 --- a/versionProperties/1.16.5.properties +++ b/versionProperties/1.16.5.properties @@ -54,6 +54,7 @@ forge_version=36.2.39 # Forge mod versions terraforged_version=4044290 + oculus_version= # Forge mod run # 0 = Don't enable and don't run @@ -62,3 +63,4 @@ forge_version=36.2.39 enable_starlight_forge=0 enable_terraforged=1 enable_terrafirmacraft=0 + enable_oculus=0 diff --git a/versionProperties/1.17.1.properties b/versionProperties/1.17.1.properties index 7414adc27..641d1b160 100644 --- a/versionProperties/1.17.1.properties +++ b/versionProperties/1.17.1.properties @@ -53,6 +53,7 @@ forge_version=37.1.1 # Forge mod versions terraforged_version= + oculus_version= # Forge mod run # 0 = Don't enable and don't run @@ -61,3 +62,4 @@ forge_version=37.1.1 enable_starlight_forge=0 enable_terraforged=0 enable_terrafirmacraft=0 + enable_oculus=0 diff --git a/versionProperties/1.18.2.properties b/versionProperties/1.18.2.properties index d745c474f..31ae756cb 100644 --- a/versionProperties/1.18.2.properties +++ b/versionProperties/1.18.2.properties @@ -62,6 +62,7 @@ forge_version=40.2.10 # Forge mod versions terraforged_version= + oculus_version= # Forge mod run # 0 = Don't enable and don't run @@ -69,4 +70,5 @@ forge_version=40.2.10 # 2 = Can be referenced in code and runs in client enable_starlight_forge=0 enable_terraforged=0 - enable_terrafirmacraft=0 \ No newline at end of file + enable_terrafirmacraft=0 + enable_oculus=0 diff --git a/versionProperties/1.19.2.properties b/versionProperties/1.19.2.properties index e50c5e617..2761724fc 100644 --- a/versionProperties/1.19.2.properties +++ b/versionProperties/1.19.2.properties @@ -52,6 +52,7 @@ forge_version=43.3.2 # Forge mod versions terraforged_version= + oculus_version= # Forge mod run # 0 = Don't enable and don't run @@ -60,3 +61,4 @@ forge_version=43.3.2 enable_starlight_forge=0 enable_terraforged=0 enable_terrafirmacraft=0 + enable_oculus=0 diff --git a/versionProperties/1.19.4.properties b/versionProperties/1.19.4.properties index 3945a43f9..ca7a31037 100644 --- a/versionProperties/1.19.4.properties +++ b/versionProperties/1.19.4.properties @@ -51,6 +51,7 @@ forge_version=45.2.4 # Forge mod versions terraforged_version= + oculus_version= # Forge mod run # 0 = Don't enable and don't run @@ -59,3 +60,4 @@ forge_version=45.2.4 enable_starlight_forge=0 enable_terraforged=0 enable_terrafirmacraft=0 + enable_oculus=0 diff --git a/versionProperties/1.20.1.properties b/versionProperties/1.20.1.properties index af43eb93b..d5e08040f 100644 --- a/versionProperties/1.20.1.properties +++ b/versionProperties/1.20.1.properties @@ -51,6 +51,7 @@ forge_version=47.2.1 # Forge mod versions terraforged_version= + oculus_version=1.20.1-1.8.0 # Forge mod run # 0 = Don't enable and don't run @@ -59,3 +60,4 @@ forge_version=47.2.1 enable_starlight_forge=0 enable_terraforged=0 enable_terrafirmacraft=0 + enable_oculus=1 diff --git a/versionProperties/1.20.2.properties b/versionProperties/1.20.2.properties index 1adff5e3b..3cc8c641b 100644 --- a/versionProperties/1.20.2.properties +++ b/versionProperties/1.20.2.properties @@ -51,6 +51,7 @@ forge_version=48.0.13 # Forge mod versions terraforged_version= + oculus_version= # Forge mod run # 0 = Don't enable and don't run @@ -59,3 +60,4 @@ forge_version=48.0.13 enable_starlight_forge=0 enable_terraforged=0 enable_terrafirmacraft=0 + enable_oculus=0 diff --git a/versionProperties/1.20.4.properties b/versionProperties/1.20.4.properties index 7d74fe957..907afb57d 100644 --- a/versionProperties/1.20.4.properties +++ b/versionProperties/1.20.4.properties @@ -52,6 +52,7 @@ neoforge_version= # Forge mod versions terraforged_version= + oculus_version= # Forge mod run # 0 = Don't enable and don't run @@ -60,3 +61,4 @@ neoforge_version= enable_starlight_forge=0 enable_terraforged=0 enable_terrafirmacraft=0 + enable_oculus=0