Skip to content
This repository was archived by the owner on Apr 21, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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')) {
Expand Down
3 changes: 1 addition & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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<Frustum> 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;
}
}
5 changes: 1 addition & 4 deletions imm_ptl_core/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
],
Expand All @@ -41,7 +38,7 @@
"imm_ptl_compat.mixins.json"
],
"depends": {
"fabricloader": ">=0.7.4",
"fabricloader": ">=0.17.0",
"fabric": ">=0.28.1"
},
"breaks": {
Expand Down
3 changes: 3 additions & 0 deletions imm_ptl_core/src/main/resources/imm_ptl.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,8 @@
],
"injectors": {
"defaultRequire": 1
},
"mixinextras": {
"minVersion": "0.5.0"
}
}