Fix 1.19 and 1.20 compiling
This commit is contained in:
+10
@@ -1,6 +1,10 @@
|
||||
package com.seibel.distanthorizons.common.rendering;
|
||||
|
||||
#if PRE_MC_1_19_4
|
||||
import com.mojang.math.Matrix4f;
|
||||
#else
|
||||
import org.joml.Matrix4f;
|
||||
#endif
|
||||
import com.seibel.distanthorizons.core.config.Config;
|
||||
import com.seibel.distanthorizons.core.util.RenderUtil;
|
||||
|
||||
@@ -15,7 +19,13 @@ public class SeamlessOverdraw
|
||||
public static FloatBuffer overwriteMinecraftNearFarClipPlanes(Matrix4f minecraftProjectionMatrix, float previousPartialTicks)
|
||||
{
|
||||
FloatBuffer matrixFloatBuffer = FloatBuffer.allocate(16);
|
||||
|
||||
#if PRE_MC_1_19_4
|
||||
minecraftProjectionMatrix.store(matrixFloatBuffer);
|
||||
#else
|
||||
minecraftProjectionMatrix.get(matrixFloatBuffer);
|
||||
#endif
|
||||
|
||||
float[] matrixFloatArray = matrixFloatBuffer.array();
|
||||
|
||||
float dhFarClipPlane = RenderUtil.getNearClipPlaneDistanceInBlocks(previousPartialTicks);
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
package com.seibel.distanthorizons.fabric;
|
||||
|
||||
import com.mojang.math.Matrix4f;
|
||||
import com.seibel.distanthorizons.common.rendering.SeamlessOverdraw;
|
||||
import com.seibel.distanthorizons.common.wrappers.McObjectConverter;
|
||||
import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper;
|
||||
@@ -204,7 +203,12 @@ public class FabricClientProxy
|
||||
if (Config.Client.Advanced.Graphics.AdvancedGraphics.seamlessOverdraw.get())
|
||||
{
|
||||
FloatBuffer modifiedMatrixBuffer = SeamlessOverdraw.overwriteMinecraftNearFarClipPlanes(renderContext.projectionMatrix(), renderContext.tickDelta());
|
||||
|
||||
#if PRE_MC_1_19_4
|
||||
renderContext.projectionMatrix().load(modifiedMatrixBuffer);
|
||||
#else
|
||||
renderContext.projectionMatrix().set(modifiedMatrixBuffer);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -3,6 +3,7 @@ package com.seibel.distanthorizons.fabric.mixins.client;
|
||||
import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper;
|
||||
import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper;
|
||||
import com.seibel.distanthorizons.core.api.internal.ClientApi;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.client.multiplayer.ClientPacketListener;
|
||||
import net.minecraft.world.level.chunk.LevelChunk;
|
||||
@@ -58,7 +59,7 @@ public class MixinClientPacketListener
|
||||
@Inject(method = "enableChunkLight", at = @At("TAIL"))
|
||||
void onEnableChunkLight(LevelChunk chunk, int x, int z, CallbackInfo ci)
|
||||
{
|
||||
ClientLevelWrapper clientLevel = ClientLevelWrapper.getWrapper((ClientLevel) chunk.getLevel());
|
||||
IClientLevelWrapper clientLevel = ClientLevelWrapper.getWrapper((ClientLevel) chunk.getLevel());
|
||||
ClientApi.INSTANCE.clientChunkLoadEvent(new ChunkWrapper(chunk, chunk.getLevel(), clientLevel), clientLevel);
|
||||
}
|
||||
|
||||
|
||||
+5
@@ -139,7 +139,12 @@ public class MixinLevelRenderer
|
||||
if (Config.Client.Advanced.Graphics.AdvancedGraphics.seamlessOverdraw.get())
|
||||
{
|
||||
FloatBuffer modifiedMatrixBuffer = SeamlessOverdraw.overwriteMinecraftNearFarClipPlanes(projectionMatrix, previousPartialTicks);
|
||||
|
||||
#if PRE_MC_1_19_4
|
||||
projectionMatrix.load(modifiedMatrixBuffer);
|
||||
#else
|
||||
projectionMatrix.set(modifiedMatrixBuffer);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user