From dc556efe0b01735411abe51f3eefb438728985f5 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 23 Jul 2023 15:32:40 -0500 Subject: [PATCH 1/3] Fix blocking the server thread in 1.20.1 world generation --- .../wrappers/worldGeneration/mimicObject/ChunkLoader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java index 0ba7c462e..4e45f7ddb 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java @@ -247,7 +247,7 @@ public class ChunkLoader if (chunkType == ChunkStatus.ChunkType.PROTOCHUNK && (blendingData == null || !blendingData.oldNoise())) return null; #else - if (chunkType == ChunkStatus.ChunkType.PROTOCHUNK && (blendingData == null || level.getChunk(chunkPos.getMiddleBlockX(),chunkPos.getMiddleBlockZ()).isOldNoiseGeneration())) + if (chunkType == ChunkStatus.ChunkType.PROTOCHUNK && blendingData == null) return null; #endif #endif From d1283db78659c8ce9d319aa7e866a0f9a79b3d6e Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 23 Jul 2023 17:35:33 -0500 Subject: [PATCH 2/3] Add a config to disable multiverse networking --- coreSubProjects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreSubProjects b/coreSubProjects index a00cfbb7d..af5bb351e 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit a00cfbb7dea9b8c6dc08c831498eb8a739f37b04 +Subproject commit af5bb351e8a99344321ec2c0ebb0fd9dcffb35d6 From b0937fd9d04b6b6df52351daca32d15ec2e459ad Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 23 Jul 2023 18:21:01 -0500 Subject: [PATCH 3/3] Fix a native code crash in MC 1.20 when using seamless overdraw --- .../common/rendering/SeamlessOverdraw.java | 15 ++++++++------- .../distanthorizons/fabric/FabricClientProxy.java | 6 +++--- .../forge/mixins/client/MixinLevelRenderer.java | 6 +++--- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/rendering/SeamlessOverdraw.java b/common/src/main/java/com/seibel/distanthorizons/common/rendering/SeamlessOverdraw.java index d55b5bf89..1d851dfe4 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/rendering/SeamlessOverdraw.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/rendering/SeamlessOverdraw.java @@ -16,18 +16,20 @@ public class SeamlessOverdraw * Proof-of-concept experimental option, not intended for normal use.
* (Poorly) replaces Minecraft's far clip plane so it lines up with DH's near clip plane. */ - public static FloatBuffer overwriteMinecraftNearFarClipPlanes(Matrix4f minecraftProjectionMatrix, float previousPartialTicks) + public static float[] overwriteMinecraftNearFarClipPlanes(Matrix4f minecraftProjectionMatrix, float previousPartialTicks) { - FloatBuffer matrixFloatBuffer = FloatBuffer.allocate(16); + float[] matrixFloatArray; #if PRE_MC_1_19_4 + FloatBuffer matrixFloatBuffer = FloatBuffer.allocate(16); minecraftProjectionMatrix.store(matrixFloatBuffer); + matrixFloatArray = matrixFloatBuffer.array(); #else - minecraftProjectionMatrix.get(matrixFloatBuffer); + // Passing float buffers in caused native code crashes, so we are passing in a float array instead + matrixFloatArray = new float[16]; + minecraftProjectionMatrix.get(matrixFloatArray); #endif - float[] matrixFloatArray = matrixFloatBuffer.array(); - float dhFarClipPlane = RenderUtil.getNearClipPlaneDistanceInBlocks(previousPartialTicks); float farClip = dhFarClipPlane * 5.1f; // magic number found via trial and error, James has no idea what it represents, except that it makes the seam between DH and vanilla rendering pretty close float nearClip = 0.5f; // this causes issues with some vanilla rendering, specifically the wireframe around selected blocks is slightly off. Unfortunately the ratio between the near and far clip plane can't be easily modified without completely screwing up the rendering. @@ -36,8 +38,7 @@ public class SeamlessOverdraw matrixFloatArray[10] = -((farClip + nearClip) / (farClip - nearClip)); // near clip plane matrixFloatArray[11] = -((2 * farClip * nearClip) / (farClip - nearClip)); // far clip plane - matrixFloatBuffer = FloatBuffer.wrap(matrixFloatArray); - return matrixFloatBuffer; + return matrixFloatArray; } } diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java index 337485551..c4af050fe 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java @@ -207,12 +207,12 @@ public class FabricClientProxy // experimental proof-of-concept option if (Config.Client.Advanced.Graphics.AdvancedGraphics.seamlessOverdraw.get()) { - FloatBuffer modifiedMatrixBuffer = SeamlessOverdraw.overwriteMinecraftNearFarClipPlanes(renderContext.projectionMatrix(), renderContext.tickDelta()); + float[] matrixFloatArray = SeamlessOverdraw.overwriteMinecraftNearFarClipPlanes(renderContext.projectionMatrix(), renderContext.tickDelta()); #if PRE_MC_1_19_4 - renderContext.projectionMatrix().load(modifiedMatrixBuffer); + renderContext.projectionMatrix().load(FloatBuffer.wrap(matrixFloatArray)); #else - renderContext.projectionMatrix().set(modifiedMatrixBuffer); + renderContext.projectionMatrix().set(matrixFloatArray); #endif } } diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java index 29dc9d376..da55ba536 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/mixins/client/MixinLevelRenderer.java @@ -137,12 +137,12 @@ public class MixinLevelRenderer // experimental proof-of-concept option if (Config.Client.Advanced.Graphics.AdvancedGraphics.seamlessOverdraw.get()) { - FloatBuffer modifiedMatrixBuffer = SeamlessOverdraw.overwriteMinecraftNearFarClipPlanes(projectionMatrix, previousPartialTicks); + float[] matrixFloatArray = SeamlessOverdraw.overwriteMinecraftNearFarClipPlanes(projectionMatrix, previousPartialTicks); #if PRE_MC_1_19_4 - projectionMatrix.load(modifiedMatrixBuffer); + projectionMatrix.load(FloatBuffer.wrap(matrixFloatArray)); #else - projectionMatrix.set(modifiedMatrixBuffer); + projectionMatrix.set(matrixFloatArray); #endif } }