Merge branch 'Vulkan'

This commit is contained in:
James Seibel
2026-05-15 22:25:14 -05:00
32 changed files with 436 additions and 507 deletions
@@ -327,10 +327,11 @@ public class FabricClientProxy implements AbstractModInitializer.IEventProxy
// FIXME: Use better hooks so it doesn't trigger key press events in text boxes
ClientTickEvents.END_CLIENT_TICK.register(client ->
{
if (client.player != null && !(Minecraft.getInstance().screen instanceof TitleScreen))
{
this.onKeyInput();
}
// TODO
//if (client.player != null && !(Minecraft.getInstance().screen instanceof TitleScreen))
//{
// this.onKeyInput();
//}
});
//endregion
@@ -93,7 +93,10 @@ public class MixinChunkSectionsToRender
@Inject(at = @At("HEAD"), method = "renderGroup", order = 800)
private void renderDeferredLayerHead(ChunkSectionLayerGroup chunkSectionLayerGroup, GpuSampler gpuSampler, CallbackInfo ci)
{
#if MC_VER <= MC_26_1_2
ClientApi.RENDER_STATE.clientLevelWrapper = ClientLevelWrapper.getWrapperIfDifferent(ClientApi.RENDER_STATE.clientLevelWrapper, Minecraft.getInstance().levelRenderer.level);
#else
#endif
ClientApi.RENDER_STATE.canRenderOrThrow();
@@ -29,8 +29,11 @@ public class MixinGameRenderer {}
#else
import com.mojang.blaze3d.vertex.PoseStack;
import com.seibel.distanthorizons.common.wrappers.McObjectConverter;
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapper;
import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper;
import com.seibel.distanthorizons.core.api.internal.ClientApi;
import net.minecraft.client.DeltaTracker;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.client.renderer.state.OptionsRenderState;
@@ -71,6 +74,16 @@ public class MixinGameRenderer
final Matrix4f projectionMatrix,
final PoseStack poseStack)
{
#if MC_VER <= MC_26_1_2
#else
ClientApi.RENDER_STATE.clientLevelWrapper = ClientLevelWrapper.getWrapperIfDifferent(ClientApi.RENDER_STATE.clientLevelWrapper, (ClientLevel)player.level());
ClientApi.RENDER_STATE.mcModelViewMatrix = McObjectConverter.Convert(modelViewMatrix);
ClientApi.RENDER_STATE.partialTickTime = MinecraftRenderWrapper.INSTANCE.getPartialTickTime();
#endif
ClientApi.RENDER_STATE.mcProjectionMatrix = McObjectConverter.Convert(projectionMatrix);
}
}
@@ -94,8 +94,11 @@ import com.seibel.distanthorizons.core.logging.DhLogger;
@Mixin(LevelRenderer.class)
public class MixinLevelRenderer
{
#if MC_VER <= MC_26_1_2
@Shadow
private ClientLevel level;
#else
#endif
@Unique
private static final DhLogger LOGGER = new DhLoggerBuilder().build();
@@ -220,12 +223,14 @@ public class MixinLevelRenderer
#if MC_VER <= MC_1_21_11
#else
#if MC_VER <= MC_26_1_2
@Inject(at = @At("HEAD"), method = "prepareChunkRenders")
private void prepareChunkRenders(final Matrix4fc modelViewMatrix, CallbackInfoReturnable<ChunkSectionsToRender> callback)
{
ClientApi.RENDER_STATE.clientLevelWrapper = ClientLevelWrapper.getWrapperIfDifferent(ClientApi.RENDER_STATE.clientLevelWrapper, this.level);
}
@Inject(at = @At("HEAD"), method = "renderLevel")
public void renderLevel(
final GraphicsResourceAllocator resourceAllocator, final DeltaTracker deltaTracker,
@@ -241,6 +246,9 @@ public class MixinLevelRenderer
}
#else
#endif
#endif
//endregion
@@ -112,9 +112,10 @@ public class MixinLightTexture
GlTexture glTexture = (GlTexture) this.texture;
this.renderWrapper.setLightmapId(glTexture.glId(), clientLevel);
#else
// both options are available since the renderer can be changed to either Blaze3D or OpenGL
GlTexture glTexture = (GlTexture) this.texture;
this.renderWrapper.setLightmapId(glTexture.glId(), clientLevel);
// TODO vulkan
//// both options are available since the renderer can be changed to either Blaze3D or OpenGL
//GlTexture glTexture = (GlTexture) this.texture;
//this.renderWrapper.setLightmapId(glTexture.glId(), clientLevel);
this.renderWrapper.setLightmapGpuTexture(this.texture, clientLevel);
#endif
@@ -87,17 +87,18 @@ public abstract class MixinMinecraft
}
#endif
#if MC_VER >= MC_1_20_2
@Redirect(
method = "Lnet/minecraft/client/Minecraft;onGameLoadFinished(Lnet/minecraft/client/Minecraft$GameLoadCookie;)V",
at = @At(value = "INVOKE", target = "Ljava/lang/Runnable;run()V")
)
private void buildInitialScreens(Runnable runnable)
{
DhUpdateScreenBase.tryShowUpdateScreenAndRunAutoUpdateStartup(runnable);
runnable.run();
}
#endif
// TODO vulkan
//#if MC_VER >= MC_1_20_2
//@Redirect(
// method = "Lnet/minecraft/client/Minecraft;onGameLoadFinished(Lnet/minecraft/client/Minecraft$GameLoadCookie;)V",
// at = @At(value = "INVOKE", target = "Ljava/lang/Runnable;run()V")
//)
//private void buildInitialScreens(Runnable runnable)
//{
// DhUpdateScreenBase.tryShowUpdateScreenAndRunAutoUpdateStartup(runnable);
// runnable.run();
//}
//#endif
@Inject(at = @At("HEAD"), method = "updateLevelInEngines")
public void updateLevelInEngines(ClientLevel level, CallbackInfo ci)
@@ -19,6 +19,7 @@
package com.seibel.distanthorizons.fabric.mixins.client;
import com.seibel.distanthorizons.common.wrappers.gui.DhScreenUtil;
import com.seibel.distanthorizons.common.wrappers.gui.GetConfigScreen;
import com.seibel.distanthorizons.common.wrappers.gui.TexturedButtonWidget;
import com.seibel.distanthorizons.coreapi.ModInfo;
@@ -147,7 +148,7 @@ public class MixinOptionsScreen extends Screen
20, ICON_TEXTURE, 20, 40,
// Create the button and tell it where to go
// For now it goes to the client option by default
(buttonWidget) -> Objects.requireNonNull(this.minecraft).setScreen(GetConfigScreen.getScreen(this)),
(buttonWidget) -> DhScreenUtil.showScreen(GetConfigScreen.getScreen(this)),
// Add a title to the button
#if MC_VER < MC_1_19_2
new TranslatableComponent(ModInfo.ID + ".title"));
@@ -20,17 +20,17 @@
package com.seibel.distanthorizons.fabric.wrappers.config;
import com.seibel.distanthorizons.common.wrappers.gui.GetConfigScreen;
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
import com.terraformersmc.modmenu.api.ModMenuApi;
//import com.terraformersmc.modmenu.api.ConfigScreenFactory;
//import com.terraformersmc.modmenu.api.ModMenuApi;
/** For making the config show up in modmenu */
public class ModMenuIntegration implements ModMenuApi
public class ModMenuIntegration //implements ModMenuApi
{
// For the custom config code
@Override
public ConfigScreenFactory<?> getModConfigScreenFactory()
{
return parent -> GetConfigScreen.getScreen(parent);
}
//@Override
//public ConfigScreenFactory<?> getModConfigScreenFactory()
//{
// return parent -> GetConfigScreen.getScreen(parent);
//}
}
@@ -27,20 +27,20 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IIrisAccess
import net.coderbot.iris.Iris;
import net.irisshaders.iris.api.v0.IrisApi;
#else
import net.irisshaders.iris.Iris;
import net.irisshaders.iris.api.v0.IrisApi;
//import net.irisshaders.iris.Iris;
//import net.irisshaders.iris.api.v0.IrisApi;
#endif
public class IrisAccessor implements IIrisAccessor
{
@Override
public String getModName() { return Iris.MODID; }
public String getModName() { return /*Iris.MODID;*/ ""; }
@Override
public boolean isShaderPackInUse() { return IrisApi.getInstance().isShaderPackInUse(); }
public boolean isShaderPackInUse() { return false;/*IrisApi.getInstance().isShaderPackInUse();*/ }
@Override
public boolean isRenderingShadowPass() { return IrisApi.getInstance().isRenderingShadowPass(); }
public boolean isRenderingShadowPass() { return false;/*IrisApi.getInstance().isRenderingShadowPass();*/ }
}