basic mixin updates
This commit is contained in:
@@ -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
|
||||
|
||||
+3
@@ -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();
|
||||
|
||||
+13
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
+8
@@ -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
|
||||
|
||||
|
||||
+4
-3
@@ -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
|
||||
|
||||
+12
-11
@@ -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)
|
||||
|
||||
+2
-1
@@ -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"));
|
||||
|
||||
Reference in New Issue
Block a user