From c625a76ebd1780d229683897f914a025406bc465 Mon Sep 17 00:00:00 2001 From: Acuadragon100 <30689683+Acuadragon100@users.noreply.github.com> Date: Sun, 19 Apr 2026 19:17:28 +0200 Subject: [PATCH 1/4] Update loom and loader so we can use the latest version of MixinExtras in dev. We don't really need to bundle it anymore either. --- build.gradle | 7 +------ gradle.properties | 3 +-- gradle/wrapper/gradle-wrapper.properties | 2 +- imm_ptl_core/src/main/resources/fabric.mod.json | 3 --- 4 files changed, 3 insertions(+), 12 deletions(-) diff --git a/build.gradle b/build.gradle index 70de9e992..79a6faeaf 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java-library' - id 'fabric-loom' version '1.6-SNAPSHOT' apply(false) + id 'fabric-loom' version '1.13-SNAPSHOT' apply(false) // uses qouteall's fork of fabric loom, see settings.gradle id 'maven-publish' @@ -108,9 +108,6 @@ allprojects { modCompileOnly("com.github.qouteall:GravityChanger:${gravity_changer_version}") { exclude(group: "net.fabricmc.fabric-api") } - - implementation("com.github.llamalad7.mixinextras:mixinextras-fabric:${mixin_extras_version}") - annotationProcessor("com.github.llamalad7.mixinextras:mixinextras-fabric:${mixin_extras_version}") } processResources { @@ -178,8 +175,6 @@ publishing { dependencies { include "me.shedaniel.cloth:cloth-config-fabric:${cloth_config_version}" - include("com.github.llamalad7.mixinextras:mixinextras-fabric:${mixin_extras_version}") - modLocalRuntime "maven.modrinth:modmenu:${modmenu_version}" if (project.enable_sodium.equals('true')) { diff --git a/gradle.properties b/gradle.properties index ccfea51b3..94358b78d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,7 +10,6 @@ archives_base_name=immersive-portals modmenu_version=7.0.1 cloth_config_version=11.0.99 -mixin_extras_version=0.2.0-beta.9 sodium_path=maven.modrinth:sodium:mc1.20.1-0.5.13-fabric iris_path=maven.modrinth:iris:1.7.6+1.20.1 gravity_changer_version=v1.1.1-mc1.20.1 @@ -24,7 +23,7 @@ enable_geckolib=false minecraft_version=1.20.1 yarn_mappings=1.20.1+build.10 -loader_version=0.14.22 +loader_version=0.18.6 #Fabric api fabric_version=0.88.1+1.20.1 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 509c4a29b..3c44eb1b6 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/imm_ptl_core/src/main/resources/fabric.mod.json b/imm_ptl_core/src/main/resources/fabric.mod.json index 3be93ebb0..d3cdf2705 100644 --- a/imm_ptl_core/src/main/resources/fabric.mod.json +++ b/imm_ptl_core/src/main/resources/fabric.mod.json @@ -19,9 +19,6 @@ "icon": "assets/immersive_portals/icon.png", "environment": "*", "entrypoints": { - "preLaunch": [ - "com.llamalad7.mixinextras.MixinExtrasBootstrap::init" - ], "main": [ "qouteall.imm_ptl.core.platform_specific.IPModEntry" ], From 880d3aa9e52e443d03df63adfcc60cedaea36521 Mon Sep 17 00:00:00 2001 From: Acuadragon100 <30689683+Acuadragon100@users.noreply.github.com> Date: Sun, 19 Apr 2026 19:17:42 +0200 Subject: [PATCH 2/4] Support for MixinExtras expressions. --- imm_ptl_core/src/main/resources/imm_ptl.mixins.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/imm_ptl_core/src/main/resources/imm_ptl.mixins.json b/imm_ptl_core/src/main/resources/imm_ptl.mixins.json index a741e31bd..77bc4e3e5 100644 --- a/imm_ptl_core/src/main/resources/imm_ptl.mixins.json +++ b/imm_ptl_core/src/main/resources/imm_ptl.mixins.json @@ -128,5 +128,8 @@ ], "injectors": { "defaultRequire": 1 + }, + "mixinextras": { + "minVersion": "0.5.0" } } From 3d77189cdd3512a5da5a5942b795c9c3c8e64505 Mon Sep 17 00:00:00 2001 From: Acuadragon100 <30689683+Acuadragon100@users.noreply.github.com> Date: Sun, 19 Apr 2026 19:17:48 +0200 Subject: [PATCH 3/4] Rewrite MixinFrustum_FixDeadLoop::offsetToFullyIncludeCameraCube using MixinExtras to fix crash with Valkyrien Skies 2.4.11. --- .../render/MixinFrustum_FixDeadLoop.java | 90 ++++++++----------- 1 file changed, 37 insertions(+), 53 deletions(-) diff --git a/imm_ptl_core/src/main/java/qouteall/imm_ptl/core/mixin/client/render/MixinFrustum_FixDeadLoop.java b/imm_ptl_core/src/main/java/qouteall/imm_ptl/core/mixin/client/render/MixinFrustum_FixDeadLoop.java index 4f494cf08..ade150902 100644 --- a/imm_ptl_core/src/main/java/qouteall/imm_ptl/core/mixin/client/render/MixinFrustum_FixDeadLoop.java +++ b/imm_ptl_core/src/main/java/qouteall/imm_ptl/core/mixin/client/render/MixinFrustum_FixDeadLoop.java @@ -1,71 +1,55 @@ package qouteall.imm_ptl.core.mixin.client.render; +import com.llamalad7.mixinextras.expression.Definition; +import com.llamalad7.mixinextras.expression.Expression; +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; +import com.llamalad7.mixinextras.sugar.Share; +import com.llamalad7.mixinextras.sugar.ref.LocalIntRef; import net.minecraft.client.renderer.culling.Frustum; -import org.joml.FrustumIntersection; -import org.joml.Vector4f; -import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; -import org.spongepowered.asm.mixin.Shadow; -import qouteall.imm_ptl.core.miscellaneous.IPVanillaCopy; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import qouteall.imm_ptl.core.render.TransformationManager; import qouteall.q_misc_util.Helper; import qouteall.q_misc_util.my_util.LimitedLogger; @Mixin(Frustum.class) public abstract class MixinFrustum_FixDeadLoop { - @Shadow - private double camX; - - @Shadow - private double camY; - - @Shadow - private double camZ; - - @Shadow - private Vector4f viewVector; - - @Shadow @Final private FrustumIntersection intersection; - private static LimitedLogger limitedLogger = new LimitedLogger(10); - + + @Unique + private static final LimitedLogger limitedLogger = new LimitedLogger(10); + /** * Make it to not deadloop when using isometric view. - * Also make it to not deadloop even if the projection matrix is broken. (In normal cases the projection should not be broken.) - * - * @author qouteall - * @reason Hard to do by injection or redirection */ - @Overwrite - @IPVanillaCopy - public Frustum offsetToFullyIncludeCameraCube(int gridSize) { + @Inject(method = "offsetToFullyIncludeCameraCube", at = @At("HEAD"), cancellable = true) + public void initButSkipIfIsometric(int i, CallbackInfoReturnable cir, @Share("countLimit") LocalIntRef countLimit) { if (TransformationManager.isIsometricView) { - return (Frustum) (Object) this; + cir.setReturnValue((Frustum) (Object) this); } - - double minX = Math.floor(this.camX / (double) gridSize) * (double) gridSize; - double minY = Math.floor(this.camY / (double) gridSize) * (double) gridSize; - double minZ = Math.floor(this.camZ / (double) gridSize) * (double) gridSize; - double maxX = Math.ceil(this.camX / (double) gridSize) * (double) gridSize; - double maxY = Math.ceil(this.camY / (double) gridSize) * (double) gridSize; - double maxZ = Math.ceil(this.camZ / (double) gridSize) * (double) gridSize; - - int countLimit = 10; // limit the loop count - - while (this.intersection.intersectAab((float) (minX - this.camX), (float) (minY - this.camY), (float) (minZ - this.camZ), (float) (maxX - this.camX), (float) (maxY - this.camY), (float) (maxZ - this.camZ))!= -2) { - this.camX -= (double) (this.viewVector.x() * 4.0F); - this.camY -= (double) (this.viewVector.y() * 4.0F); - this.camZ -= (double) (this.viewVector.z() * 4.0F); - countLimit--; - if (countLimit <= 0) { - limitedLogger.invoke(() -> { - Helper.err("the projection matrix and the frustum are abnormal"); - new Throwable().printStackTrace(); - }); - break; - } + countLimit.set(10+1); + } + + /** + * Also make it to not deadloop even if the projection matrix is broken. (In normal cases the projection should not be broken.) + */ + @Definition(id = "intersectAab", method = "Lorg/joml/FrustumIntersection;intersectAab(FFFFFF)I") + @Expression("?.intersectAab(?, ?, ?, ?, ?, ?) != ?") + @ModifyExpressionValue( + method = "offsetToFullyIncludeCameraCube", + at = @At("MIXINEXTRAS:EXPRESSION") + ) + public boolean decrementFrustumLoopCount(boolean shouldContinue, @Share("countLimit") LocalIntRef countLimit) { + countLimit.set(countLimit.get()-1); + if (countLimit.get() <= 0) { + limitedLogger.invoke(() -> { + Helper.err("the projection matrix and the frustum are abnormal"); + new Throwable().printStackTrace(); + }); + return false; } - - return (Frustum) (Object) this; + return shouldContinue; } } From 34ec5efff187fc178badddd800cfc819d5fb88f5 Mon Sep 17 00:00:00 2001 From: Acuadragon100 <30689683+Acuadragon100@users.noreply.github.com> Date: Sun, 19 Apr 2026 19:30:49 +0200 Subject: [PATCH 4/4] Set the required Fabric Loader version to 0.17 since we need Mixin Extras version 0.5.0. --- imm_ptl_core/src/main/resources/fabric.mod.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imm_ptl_core/src/main/resources/fabric.mod.json b/imm_ptl_core/src/main/resources/fabric.mod.json index d3cdf2705..850b52468 100644 --- a/imm_ptl_core/src/main/resources/fabric.mod.json +++ b/imm_ptl_core/src/main/resources/fabric.mod.json @@ -38,7 +38,7 @@ "imm_ptl_compat.mixins.json" ], "depends": { - "fabricloader": ">=0.7.4", + "fabricloader": ">=0.17.0", "fabric": ">=0.28.1" }, "breaks": {