Also use the original camera position when Immersive Portals is loaded.

This commit is contained in:
Acuadragon100
2026-05-16 13:24:37 +02:00
parent 1f7cf793c6
commit 4f6d78189b
2 changed files with 7 additions and 17 deletions
@@ -112,23 +112,9 @@ public class ClientLevelModule implements Closeable, IDataSourceUpdateListenerFu
this.ClientRenderStateRef.set(clientRenderState);
}
DhBlockPos2D cameraBlockPos;
IImmersivePortalsAccessor immersivePortalsAccessor = ModAccessorInjector.INSTANCE.get(IImmersivePortalsAccessor.class);
if (immersivePortalsAccessor != null)
{
// since Immersive portals could be rendering multiple levels at once
// the camera position may not be relative to this level,
// but the player position will be (usually)
DhBlockPos playerBlockPos = MC_CLIENT.getPlayerBlockPos();
cameraBlockPos = new DhBlockPos2D(playerBlockPos);
}
else
{
// use camera position instead of player pos so free cam mods work better
Vec3d cameraDoublePos = MC_RENDER.getCameraExactPosition();
cameraBlockPos = new DhBlockPos2D((int)cameraDoublePos.x, (int)cameraDoublePos.z);
}
// use camera position instead of player pos so free cam mods work better
Vec3d cameraDoublePos = MC_RENDER.getCameraExactPosition();
DhBlockPos2D cameraBlockPos = new DhBlockPos2D((int)cameraDoublePos.x, (int)cameraDoublePos.z);
clientRenderState.quadtree.tryTick(cameraBlockPos);
}
@@ -21,6 +21,7 @@ package com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor;
import com.seibel.distanthorizons.core.pos.DhChunkPos;
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos;
import com.seibel.distanthorizons.core.util.math.Vec3d;
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
import org.jetbrains.annotations.Nullable;
@@ -40,4 +41,7 @@ public interface IImmersivePortalsAccessor extends IModAccessor
@Nullable
IClientLevelWrapper getOriginalClientLevelWrapper();
@Nullable
Vec3d getOriginalCameraPos();
}