re-add MC 1.21.9 support

This commit is contained in:
James Seibel
2025-10-12 15:04:31 -05:00
parent d158a89592
commit 352d0f4759
25 changed files with 106 additions and 43 deletions
+3 -1
View File
@@ -19,7 +19,9 @@ loom {
"-Dminecraft.api.session.host=https://nope.invalid",
"-Dminecraft.api.services.host=https://nope.invalid",
// https://netty.io/wiki/reference-counted-objects.html#leak-detection-levels
"-Dio.netty.leakDetection.level=advanced"
"-Dio.netty.leakDetection.level=advanced",
"-XX:+UseZGC",
"-XX:+ZGenerational"
)
programArgs("--username", "Dev")
}
@@ -60,7 +60,7 @@ import java.nio.FloatBuffer;
import java.util.HashSet;
import java.util.concurrent.AbstractExecutorService;
#if MC_VER < MC_1_21_10
#if MC_VER < MC_1_21_9
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents;
#endif
@@ -224,7 +224,7 @@ public class FabricClientProxy implements AbstractModInitializer.IEventProxy
//==============//
// TODO wait for fabric to re-add their rendering API
#if MC_VER < MC_1_21_10
#if MC_VER < MC_1_21_9
WorldRenderEvents.AFTER_SETUP.register((renderContext) ->
{
ClientApi.RENDER_STATE.mcProjectionMatrix = McObjectConverter.Convert(renderContext.projectionMatrix());
@@ -19,7 +19,7 @@
package com.seibel.distanthorizons.fabric.mixins.client;
#if MC_VER < MC_1_21_10
#if MC_VER < MC_1_21_9
import net.minecraft.world.entity.Entity;
import org.spongepowered.asm.mixin.Mixin;
@@ -12,7 +12,7 @@ import java.util.List;
@Mixin(DebugScreenOverlay.class)
public class MixinDebugScreenOverlay
{
#if MC_VER < MC_1_21_10
#if MC_VER < MC_1_21_9
@Inject(method = "getSystemInformation", at = @At("RETURN"))
private void addCustomF3(CallbackInfoReturnable<List<String>> cir)
{
@@ -30,7 +30,7 @@ import net.minecraft.client.renderer.RenderType;
import com.mojang.blaze3d.vertex.PoseStack;
import org.joml.Matrix4f;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
#elif MC_VER < MC_1_21_10
#elif MC_VER < MC_1_21_9
import com.mojang.blaze3d.buffers.GpuBufferSlice;
import com.mojang.blaze3d.framegraph.FrameGraphBuilder;
import com.mojang.blaze3d.resource.GraphicsResourceAllocator;
@@ -116,7 +116,7 @@ public class MixinLevelRenderer
method = "Lnet/minecraft/client/renderer/LevelRenderer;renderSectionLayer(Lnet/minecraft/client/renderer/RenderType;DDDLorg/joml/Matrix4f;Lorg/joml/Matrix4f;)V",
cancellable = true)
private void renderChunkLayer(RenderType renderType, double x, double y, double z, Matrix4f projectionMatrix, Matrix4f frustumMatrix, CallbackInfo callback)
#elif MC_VER < MC_1_21_10
#elif MC_VER < MC_1_21_9
@Inject(at = @At("HEAD"), method = "prepareChunkRenders", cancellable = true)
private void prepareChunkRenders(Matrix4fc projectionMatrix, double d, double e, double f, CallbackInfoReturnable<ChunkSectionsToRender> callback)
#else
@@ -141,7 +141,7 @@ public class MixinLevelRenderer
// get the matrices directly from MC
ClientApi.RENDER_STATE.mcModelViewMatrix = McObjectConverter.Convert(modelViewMatrixStack.last().pose());
ClientApi.RENDER_STATE.mcProjectionMatrix = McObjectConverter.Convert(projectionMatrix);
#elif MC_VER < MC_1_21_10
#elif MC_VER < MC_1_21_9
// MC combined the model view and projection matricies
ClientApi.RENDER_STATE.mcModelViewMatrix = McObjectConverter.Convert(projectionMatrix);
ClientApi.RENDER_STATE.mcProjectionMatrix = new Mat4f();
@@ -169,7 +169,7 @@ public class MixinLevelRenderer
{
ClientApi.INSTANCE.renderDeferredLodsForShaders();
}
#elif MC_VER < MC_1_21_10
#elif MC_VER < MC_1_21_9
// rendering handled via Fabric Api render event
#else
// handled here and in MixinChunkSectionsToRender
@@ -178,7 +178,7 @@ public class MixinLevelRenderer
#if MC_VER < MC_1_21_10
#if MC_VER < MC_1_21_9
// rendering handled via Fabric Api render event
#else
@Inject(at = @At("HEAD"), method = "prepareChunkRenders")