diff --git a/buildscript/src/main/java/Buildscript.java b/buildscript/src/main/java/Buildscript.java index 7b5c589d31..6ae96e7022 100644 --- a/buildscript/src/main/java/Buildscript.java +++ b/buildscript/src/main/java/Buildscript.java @@ -4,6 +4,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Objects; @@ -34,6 +35,7 @@ import io.github.coolcrabs.brachyura.util.Lazy; import io.github.coolcrabs.brachyura.util.Util; import net.fabricmc.mappingio.MappingReader; +import net.fabricmc.mappingio.adapter.MappingNsRenamer; import net.fabricmc.mappingio.format.MappingFormat; import net.fabricmc.mappingio.tree.MappingTree; import net.fabricmc.mappingio.tree.MemoryMappingTree; @@ -45,8 +47,8 @@ public class Buildscript extends SimpleFabricProject { static final boolean SODIUM = true; static final boolean CUSTOM_SODIUM = true; - static final String MC_VERSION = "23w51b"; - static final String customSodiumName = "sodium-fabric-mc23w51a-0.5.5+git.d8a1fda-dirty.jar"; + static final String MC_VERSION = "24w05a"; + static final String customSodiumName = "sodium-fabric-0.5.7-snapshot+mc24w05a-local.jar"; private static final String[] SOURCE_SETS = new String[] { "main", @@ -71,7 +73,7 @@ public MappingTree createMappings() { @Override public FabricLoader getLoader() { - return new FabricLoader(FabricMaven.URL, FabricMaven.loader("0.15.3")); + return new FabricLoader(FabricMaven.URL, FabricMaven.loader("0.15.6")); } @Override diff --git a/src/main/java/net/coderbot/batchedentityrendering/mixin/MixinLevelRenderer.java b/src/main/java/net/coderbot/batchedentityrendering/mixin/MixinLevelRenderer.java index ed8ca5d222..9f755e714f 100644 --- a/src/main/java/net/coderbot/batchedentityrendering/mixin/MixinLevelRenderer.java +++ b/src/main/java/net/coderbot/batchedentityrendering/mixin/MixinLevelRenderer.java @@ -40,7 +40,7 @@ public class MixinLevelRenderer { private Groupable groupable; @Inject(method = "renderLevel", at = @At("HEAD")) - private void batchedentityrendering$beginLevelRender(PoseStack poseStack, float f, long l, boolean bl, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) { + private void batchedentityrendering$beginLevelRender(float pLevelRenderer0, long pLong1, boolean pBoolean2, Camera pCamera3, GameRenderer pGameRenderer4, LightTexture pLightTexture5, Matrix4f pMatrix4f6, Matrix4f pMatrix4f7, CallbackInfo ci) { if (renderBuffers instanceof DrawCallTrackingRenderBuffers) { ((DrawCallTrackingRenderBuffers) renderBuffers).resetDrawCounts(); } @@ -54,21 +54,21 @@ public class MixinLevelRenderer { } @Inject(method = "renderLevel", at = @At(value = "INVOKE", target = RENDER_ENTITY)) - private void batchedentityrendering$preRenderEntity(PoseStack poseStack, float f, long l, boolean bl, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) { + private void batchedentityrendering$preRenderEntity(float pLevelRenderer0, long pLong1, boolean pBoolean2, Camera pCamera3, GameRenderer pGameRenderer4, LightTexture pLightTexture5, Matrix4f pMatrix4f6, Matrix4f pMatrix4f7, CallbackInfo ci) { if (groupable != null) { groupable.startGroup(); } } @Inject(method = "renderLevel", at = @At(value = "INVOKE", target = RENDER_ENTITY, shift = At.Shift.AFTER)) - private void batchedentityrendering$postRenderEntity(PoseStack poseStack, float f, long l, boolean bl, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) { + private void batchedentityrendering$postRenderEntity(float pLevelRenderer0, long pLong1, boolean pBoolean2, Camera pCamera3, GameRenderer pGameRenderer4, LightTexture pLightTexture5, Matrix4f pMatrix4f6, Matrix4f pMatrix4f7, CallbackInfo ci) { if (groupable != null) { groupable.endGroup(); } } @Inject(method = "renderLevel", at = @At(value = "CONSTANT", args = "stringValue=translucent"), locals = LocalCapture.CAPTURE_FAILHARD) - private void batchedentityrendering$beginTranslucents(PoseStack poseStack, float f, long l, boolean bl, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) { + private void batchedentityrendering$beginTranslucents(float pLevelRenderer0, long pLong1, boolean pBoolean2, Camera pCamera3, GameRenderer pGameRenderer4, LightTexture pLightTexture5, Matrix4f pMatrix4f6, Matrix4f pMatrix4f7, CallbackInfo ci) { if (renderBuffers.bufferSource() instanceof FullyBufferedMultiBufferSource fullyBufferedMultiBufferSource) { fullyBufferedMultiBufferSource.readyUp(); } @@ -89,14 +89,14 @@ public class MixinLevelRenderer { @Inject(method = "renderLevel", at = @At(value = "CONSTANT", args = "stringValue=translucent", shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD) - private void batchedentityrendering$endTranslucents(PoseStack poseStack, float f, long l, boolean bl, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) { + private void batchedentityrendering$endTranslucents(float pLevelRenderer0, long pLong1, boolean pBoolean2, Camera pCamera3, GameRenderer pGameRenderer4, LightTexture pLightTexture5, Matrix4f pMatrix4f6, Matrix4f pMatrix4f7, CallbackInfo ci) { if (BlockRenderingSettings.INSTANCE.shouldSeparateEntityDraws()) { this.renderBuffers.bufferSource().endBatch(); } } @Inject(method = "renderLevel", at = @At("RETURN")) - private void batchedentityrendering$endLevelRender(PoseStack poseStack, float f, long l, boolean bl, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) { + private void batchedentityrendering$endLevelRender(float pLevelRenderer0, long pLong1, boolean pBoolean2, Camera pCamera3, GameRenderer pGameRenderer4, LightTexture pLightTexture5, Matrix4f pMatrix4f6, Matrix4f pMatrix4f7, CallbackInfo ci) { ((RenderBuffersExt) renderBuffers).endLevelRendering(); groupable = null; } diff --git a/src/main/java/net/coderbot/iris/gui/screen/ShaderPackScreen.java b/src/main/java/net/coderbot/iris/gui/screen/ShaderPackScreen.java index 80e6775546..709e6a3648 100644 --- a/src/main/java/net/coderbot/iris/gui/screen/ShaderPackScreen.java +++ b/src/main/java/net/coderbot/iris/gui/screen/ShaderPackScreen.java @@ -36,6 +36,7 @@ import java.nio.file.FileAlreadyExistsException; import java.nio.file.Files; import java.nio.file.Path; +import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; @@ -304,7 +305,7 @@ protected void init() { ); showHideButton.setTooltip(Tooltip.create(showOrHide)); - showHideButton.setTooltipDelay(10); + showHideButton.setTooltipDelay(Duration.ofSeconds(10)); this.addRenderableWidget(showHideButton); } diff --git a/src/main/java/net/coderbot/iris/mixin/LevelRendererAccessor.java b/src/main/java/net/coderbot/iris/mixin/LevelRendererAccessor.java index ee51d5cd0a..fc91853bcb 100644 --- a/src/main/java/net/coderbot/iris/mixin/LevelRendererAccessor.java +++ b/src/main/java/net/coderbot/iris/mixin/LevelRendererAccessor.java @@ -21,7 +21,7 @@ public interface LevelRendererAccessor { EntityRenderDispatcher getEntityRenderDispatcher(); @Invoker("renderSectionLayer") - void invokeRenderSectionLayer(RenderType terrainLayer, PoseStack modelView, double cameraX, double cameraY, double cameraZ, Matrix4f projectionMatrix); + void invokeRenderSectionLayer(RenderType terrainLayer, double cameraX, double cameraY, double cameraZ, Matrix4f modelView, Matrix4f projectionMatrix); @Invoker("setupRender") void invokeSetupRender(Camera camera, Frustum frustum, boolean hasForcedFrustum, boolean spectator); diff --git a/src/main/java/net/coderbot/iris/mixin/MixinBlockStateBehavior.java b/src/main/java/net/coderbot/iris/mixin/MixinBlockStateBehavior.java index c56eb15de5..f468d6e909 100644 --- a/src/main/java/net/coderbot/iris/mixin/MixinBlockStateBehavior.java +++ b/src/main/java/net/coderbot/iris/mixin/MixinBlockStateBehavior.java @@ -7,8 +7,10 @@ import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; /** * This Mixin implements support for the ambientOcclusionLevel value. This injection point was chosen because it's @@ -39,11 +41,11 @@ public abstract class MixinBlockStateBehavior { * @author IMS * @reason ambientOcclusionLevel support. Semantically, we're completely changing the meaning of the method. */ - @Overwrite + @Inject(method = "getShadeBrightness", at = @At("RETURN"), cancellable = true) @SuppressWarnings("deprecation") - public float getShadeBrightness(BlockGetter blockGetter, BlockPos blockPos) { - float originalValue = this.getBlock().getShadeBrightness(this.asState(), blockGetter, blockPos); + public void getShadeBrightness(BlockGetter pBlockBehaviour$BlockStateBase0, BlockPos pBlockPos1, CallbackInfoReturnable cir) { + float originalValue = cir.getReturnValue(); float aoLightValue = BlockRenderingSettings.INSTANCE.getAmbientOcclusionLevel(); - return 1.0F - aoLightValue * (1.0F - originalValue); + cir.setReturnValue(1.0F - aoLightValue * (1.0F - originalValue)); } } diff --git a/src/main/java/net/coderbot/iris/mixin/MixinGameRenderer.java b/src/main/java/net/coderbot/iris/mixin/MixinGameRenderer.java index e24901c098..d7954ff1d1 100644 --- a/src/main/java/net/coderbot/iris/mixin/MixinGameRenderer.java +++ b/src/main/java/net/coderbot/iris/mixin/MixinGameRenderer.java @@ -57,7 +57,7 @@ public class MixinGameRenderer { } @Inject(method = "renderLevel", at = @At("TAIL")) - private void iris$runColorSpace(float pGameRenderer0, long pLong1, PoseStack pPoseStack2, CallbackInfo ci) { + private void iris$runColorSpace(float pGameRenderer0, long pLong1, CallbackInfo ci) { Iris.getPipelineManager().getPipeline().ifPresent(WorldRenderingPipeline::finalizeGameRendering); } @@ -130,7 +130,7 @@ public class MixinGameRenderer { // TODO: getPositionColorLightmapShader - @Inject(method = "getPositionTexColorNormalShader", at = @At("HEAD"), cancellable = true) + @Inject(method = "getRendertypeCloudsShader", at = @At("HEAD"), cancellable = true) private static void iris$overridePositionTexColorNormalShader(CallbackInfoReturnable cir) { if (ShadowRenderer.ACTIVE) { override(ShaderKey.SHADOW_CLOUDS, cir); @@ -169,7 +169,6 @@ public class MixinGameRenderer { @Inject(method = { "getRendertypeTranslucentShader", - "getRendertypeTranslucentNoCrumblingShader", "getRendertypeTranslucentMovingBlockShader", "getRendertypeTripwireShader" }, at = @At("HEAD"), cancellable = true) diff --git a/src/main/java/net/coderbot/iris/mixin/MixinLevelRenderer.java b/src/main/java/net/coderbot/iris/mixin/MixinLevelRenderer.java index afde10f905..a9b57df65f 100644 --- a/src/main/java/net/coderbot/iris/mixin/MixinLevelRenderer.java +++ b/src/main/java/net/coderbot/iris/mixin/MixinLevelRenderer.java @@ -5,6 +5,7 @@ import com.mojang.math.Axis; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.world.TickRateManager; +import net.minecraft.world.level.material.FogType; import org.joml.Matrix4f; import net.coderbot.iris.Iris; import net.coderbot.iris.fantastic.WrappingMultiBufferSource; @@ -43,10 +44,11 @@ import org.spongepowered.asm.mixin.injection.ModifyVariable; import org.spongepowered.asm.mixin.injection.Slice; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.LocalCapture; @Mixin(LevelRenderer.class) public class MixinLevelRenderer { - private static final String RENDER = "Lnet/minecraft/client/renderer/LevelRenderer;renderLevel(Lcom/mojang/blaze3d/vertex/PoseStack;FJZLnet/minecraft/client/Camera;Lnet/minecraft/client/renderer/GameRenderer;Lnet/minecraft/client/renderer/LightTexture;Lorg/joml/Matrix4f;)V"; + private static final String RENDER = "renderLevel"; private static final String CLEAR = "Lcom/mojang/blaze3d/systems/RenderSystem;clear(IZ)V"; private static final String RENDER_SKY = "Lnet/minecraft/client/renderer/LevelRenderer;renderSky(Lcom/mojang/blaze3d/vertex/PoseStack;Lorg/joml/Matrix4f;FLnet/minecraft/client/Camera;ZLjava/lang/Runnable;)V"; private static final String RENDER_CLOUDS = "Lnet/minecraft/client/renderer/LevelRenderer;renderClouds(Lcom/mojang/blaze3d/vertex/PoseStack;Lorg/joml/Matrix4f;FDDD)V"; @@ -76,11 +78,11 @@ public class MixinLevelRenderer { // This is important or else very odd issues will happen with shaders that have a final pass that doesn't write to // all pixels. @Inject(method = "renderLevel", at = @At("HEAD")) - private void iris$setupPipeline(PoseStack poseStack, float tickDelta, long startTime, boolean renderBlockOutline, + private void iris$setupPipeline(float tickDelta, long startTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, - Matrix4f projection, CallbackInfo callback) { + Matrix4f modelView, Matrix4f projection, CallbackInfo callback) { IrisTimeUniforms.updateTime(); - CapturedRenderingState.INSTANCE.setGbufferModelView(poseStack.last().pose()); + CapturedRenderingState.INSTANCE.setGbufferModelView(modelView); CapturedRenderingState.INSTANCE.setGbufferProjection(projection); TickRateManager lvTickRateManager10 = this.minecraft.level.tickRateManager(); float fakeTickDelta = lvTickRateManager10.runsNormally() ? tickDelta : 1.0F; @@ -106,9 +108,7 @@ public class MixinLevelRenderer { // This is important or else very odd issues will happen with shaders that have a final pass that doesn't write to // all pixels. @Inject(method = "renderLevel", at = @At(value = "INVOKE", target = CLEAR, shift = At.Shift.AFTER, remap = false)) - private void iris$beginLevelRender(PoseStack poseStack, float tickDelta, long startTime, boolean renderBlockOutline, - Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, - Matrix4f projection, CallbackInfo callback) { + private void iris$beginLevelRender(float pLevelRenderer0, long pLong1, boolean pBoolean2, Camera pCamera3, GameRenderer pGameRenderer4, LightTexture pLightTexture5, Matrix4f pMatrix4f6, Matrix4f pMatrix4f7, CallbackInfo ci) { pipeline.beginLevelRendering(); pipeline.setPhase(WorldRenderingPhase.NONE); } @@ -116,9 +116,9 @@ public class MixinLevelRenderer { // Inject a bit early so that we can end our rendering before mods like VoxelMap (which inject at RETURN) // render their waypoint beams. - @Inject(method = RENDER, at = @At(value = "RETURN", shift = At.Shift.BEFORE)) - private void iris$endLevelRender(PoseStack poseStack, float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo callback) { - HandRenderer.INSTANCE.renderTranslucent(poseStack, tickDelta, camera, gameRenderer, pipeline); + @Inject(method = "renderLevel", at = @At(value = "RETURN", shift = At.Shift.BEFORE)) + private void iris$endLevelRender(float tickDelta, long pLong1, boolean pBoolean2, Camera camera, GameRenderer gameRenderer, LightTexture pLightTexture5, Matrix4f pMatrix4f6, Matrix4f pMatrix4f7, CallbackInfo ci) { + HandRenderer.INSTANCE.renderTranslucent(pMatrix4f6, tickDelta, camera, gameRenderer, pipeline); Minecraft.getInstance().getProfiler().popPush("iris_final"); pipeline.finalizeLevelRendering(); pipeline = null; @@ -132,8 +132,8 @@ public class MixinLevelRenderer { // avoid breaking other mods such as Light Overlay: https://github.com/IrisShaders/Iris/issues/1356 // Do this before sky rendering so it's ready before the sky render starts. - @Inject(method = RENDER, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/LevelRenderer;renderSky(Lcom/mojang/blaze3d/vertex/PoseStack;Lorg/joml/Matrix4f;FLnet/minecraft/client/Camera;ZLjava/lang/Runnable;)V")) - private void iris$renderTerrainShadows(PoseStack poseStack, float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo callback) { + @Inject(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/LevelRenderer;renderSky(Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;FLnet/minecraft/client/Camera;ZLjava/lang/Runnable;)V")) + private void iris$renderTerrainShadows(float pLevelRenderer0, long pLong1, boolean pBoolean2, Camera camera, GameRenderer pGameRenderer4, LightTexture pLightTexture5, Matrix4f pMatrix4f6, Matrix4f pMatrix4f7, CallbackInfo ci) { pipeline.renderShadows((LevelRendererAccessor) this, camera); } @@ -142,8 +142,8 @@ public class MixinLevelRenderer { return false; } - @Inject(method = "renderLevel", at = @At(value = "INVOKE", target = RENDER_SKY)) - private void iris$beginSky(PoseStack poseStack, float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projection, CallbackInfo callback) { + @Inject(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/LevelRenderer;renderSky(Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;FLnet/minecraft/client/Camera;ZLjava/lang/Runnable;)V")) + private void iris$beginSky(float pLevelRenderer0, long pLong1, boolean pBoolean2, Camera pCamera3, GameRenderer pGameRenderer4, LightTexture pLightTexture5, Matrix4f pMatrix4f6, Matrix4f pMatrix4f7, CallbackInfo ci) { // Use CUSTOM_SKY until levelFogColor is called as a heuristic to catch FabricSkyboxes. pipeline.setPhase(WorldRenderingPhase.CUSTOM_SKY); @@ -153,73 +153,73 @@ public class MixinLevelRenderer { RenderSystem.setShader(GameRenderer::getPositionShader); } - @Inject(method = RENDER_SKY, + @Inject(method = "renderSky", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/FogRenderer;levelFogColor()V")) - private void iris$renderSky$beginNormalSky(PoseStack poseStack, Matrix4f projectionMatrix, float f, Camera camera, boolean bl, Runnable runnable, CallbackInfo ci) { + private void iris$renderSky$beginNormalSky(Matrix4f pLevelRenderer0, Matrix4f pMatrix4f1, float pFloat2, Camera pCamera3, boolean pBoolean4, Runnable pRunnable5, CallbackInfo ci) { // None of the vanilla sky is rendered until after this call, so if anything is rendered before, it's // CUSTOM_SKY. pipeline.setPhase(WorldRenderingPhase.SKY); } @Inject(method = "renderSky", at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/LevelRenderer;SUN_LOCATION:Lnet/minecraft/resources/ResourceLocation;")) - private void iris$setSunRenderStage(PoseStack poseStack, Matrix4f projectionMatrix, float f, Camera camera, boolean bl, Runnable runnable, CallbackInfo ci) { + private void iris$setSunRenderStage(Matrix4f pLevelRenderer0, Matrix4f pMatrix4f1, float pFloat2, Camera pCamera3, boolean pBoolean4, Runnable pRunnable5, CallbackInfo ci) { pipeline.setPhase(WorldRenderingPhase.SUN); } @Inject(method = "renderSky", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/DimensionSpecialEffects;getSunriseColor(FF)[F")) - private void iris$setSunsetRenderStage(PoseStack poseStack, Matrix4f projectionMatrix, float f, Camera camera, boolean bl, Runnable runnable, CallbackInfo ci) { + private void iris$setSunsetRenderStage(Matrix4f pLevelRenderer0, Matrix4f pMatrix4f1, float pFloat2, Camera pCamera3, boolean pBoolean4, Runnable pRunnable5, CallbackInfo ci) { pipeline.setPhase(WorldRenderingPhase.SUNSET); } @Inject(method = "renderSky", at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/LevelRenderer;MOON_LOCATION:Lnet/minecraft/resources/ResourceLocation;")) - private void iris$setMoonRenderStage(PoseStack poseStack, Matrix4f projectionMatrix, float f, Camera camera, boolean bl, Runnable runnable, CallbackInfo ci) { + private void iris$setMoonRenderStage(Matrix4f pLevelRenderer0, Matrix4f pMatrix4f1, float pFloat2, Camera pCamera3, boolean pBoolean4, Runnable pRunnable5, CallbackInfo ci) { pipeline.setPhase(WorldRenderingPhase.MOON); } @Inject(method = "renderSky", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/ClientLevel;getStarBrightness(F)F")) - private void iris$setStarRenderStage(PoseStack poseStack, Matrix4f projectionMatrix, float f, Camera camera, boolean bl, Runnable runnable, CallbackInfo ci) { + private void iris$setStarRenderStage(Matrix4f pLevelRenderer0, Matrix4f pMatrix4f1, float pFloat2, Camera pCamera3, boolean pBoolean4, Runnable pRunnable5, CallbackInfo ci) { pipeline.setPhase(WorldRenderingPhase.STARS); } @Inject(method = "renderSky", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;getEyePosition(F)Lnet/minecraft/world/phys/Vec3;")) - private void iris$setVoidRenderStage(PoseStack poseStack, Matrix4f projectionMatrix, float f, Camera camera, boolean bl, Runnable runnable, CallbackInfo ci) { + private void iris$setVoidRenderStage(Matrix4f pLevelRenderer0, Matrix4f pMatrix4f1, float pFloat2, Camera pCamera3, boolean pBoolean4, Runnable pRunnable5, CallbackInfo ci) { pipeline.setPhase(WorldRenderingPhase.VOID); } @Inject(method = "renderSky", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/ClientLevel;getTimeOfDay(F)F"), - slice = @Slice(from = @At(value = "FIELD", target = "Lcom/mojang/math/Axis;YP:Lcom/mojang/math/Axis;"))) - private void iris$renderSky$tiltSun(PoseStack poseStack, Matrix4f projectionMatrix, float f, Camera camera, boolean bl, Runnable runnable, CallbackInfo ci) { + slice = @Slice(from = @At(value = "FIELD", target = "Lcom/mojang/math/Axis;YP:Lcom/mojang/math/Axis;")), locals = LocalCapture.CAPTURE_FAILHARD) + private void iris$renderSky$tiltSun(Matrix4f pLevelRenderer0, Matrix4f pMatrix4f1, float pFloat2, Camera pCamera3, boolean pBoolean4, Runnable pRunnable5, CallbackInfo ci, FogType type, PoseStack poseStack) { poseStack.mulPose(Axis.ZP.rotationDegrees(pipeline.getSunPathRotation())); } - @Inject(method = "renderLevel", at = @At(value = "INVOKE", target = RENDER_SKY, shift = At.Shift.AFTER)) - private void iris$endSky(PoseStack poseStack, float f, long l, boolean bl, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projection, CallbackInfo ci) { + @Inject(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/LevelRenderer;renderSky(Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;FLnet/minecraft/client/Camera;ZLjava/lang/Runnable;)V", shift = At.Shift.AFTER)) + private void iris$endSky(float pLevelRenderer0, long pLong1, boolean pBoolean2, Camera pCamera3, GameRenderer pGameRenderer4, LightTexture pLightTexture5, Matrix4f pMatrix4f6, Matrix4f pMatrix4f7, CallbackInfo ci) { pipeline.setPhase(WorldRenderingPhase.NONE); } - @Inject(method = "renderLevel", at = @At(value = "INVOKE", target = RENDER_CLOUDS)) - private void iris$beginClouds(PoseStack poseStack, float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projection, CallbackInfo callback) { + @Inject(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/LevelRenderer;renderClouds(Lcom/mojang/blaze3d/vertex/PoseStack;Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;FDDD)V")) + private void iris$beginClouds(float pLevelRenderer0, long pLong1, boolean pBoolean2, Camera pCamera3, GameRenderer pGameRenderer4, LightTexture pLightTexture5, Matrix4f pMatrix4f6, Matrix4f pMatrix4f7, CallbackInfo ci) { pipeline.setPhase(WorldRenderingPhase.CLOUDS); } - @Inject(method = "renderLevel", at = @At(value = "INVOKE", target = RENDER_CLOUDS, shift = At.Shift.AFTER)) - private void iris$endClouds(PoseStack poseStack, float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projection, CallbackInfo callback) { + @Inject(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/LevelRenderer;renderClouds(Lcom/mojang/blaze3d/vertex/PoseStack;Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;FDDD)V", shift = At.Shift.AFTER)) + private void iris$endClouds(float pLevelRenderer0, long pLong1, boolean pBoolean2, Camera pCamera3, GameRenderer pGameRenderer4, LightTexture pLightTexture5, Matrix4f pMatrix4f6, Matrix4f pMatrix4f7, CallbackInfo ci) { pipeline.setPhase(WorldRenderingPhase.NONE); } @Inject(method = "renderSectionLayer", at = @At("HEAD")) - private void iris$beginTerrainLayer(RenderType renderType, PoseStack poseStack, double d, double e, double f, Matrix4f projectionMatrix, CallbackInfo ci) { + private void iris$beginTerrainLayer(RenderType renderType, double pDouble1, double pDouble2, double pDouble3, Matrix4f pMatrix4f4, Matrix4f pMatrix4f5, CallbackInfo ci) { pipeline.setPhase(WorldRenderingPhase.fromTerrainRenderType(renderType)); } @Inject(method = "renderSectionLayer", at = @At("RETURN")) - private void iris$endTerrainLayer(RenderType renderType, PoseStack poseStack, double d, double e, double f, Matrix4f projectionMatrix, CallbackInfo ci) { + private void iris$endTerrainLayer(RenderType pLevelRenderer0, double pDouble1, double pDouble2, double pDouble3, Matrix4f pMatrix4f4, Matrix4f pMatrix4f5, CallbackInfo ci) { pipeline.setPhase(WorldRenderingPhase.NONE); } @Inject(method = "renderLevel", at = @At(value = "INVOKE", target = RENDER_WEATHER)) - private void iris$beginWeather(PoseStack poseStack, float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projection, CallbackInfo callback) { + private void iris$beginWeather(float pLevelRenderer0, long pLong1, boolean pBoolean2, Camera pCamera3, GameRenderer pGameRenderer4, LightTexture pLightTexture5, Matrix4f pMatrix4f6, Matrix4f pMatrix4f7, CallbackInfo ci) { pipeline.setPhase(WorldRenderingPhase.RAIN_SNOW); } @@ -233,27 +233,27 @@ public class MixinLevelRenderer { } @Inject(method = "renderLevel", at = @At(value = "INVOKE", target = RENDER_WEATHER, shift = At.Shift.AFTER)) - private void iris$endWeather(PoseStack poseStack, float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projection, CallbackInfo callback) { + private void iris$endWeather(float pLevelRenderer0, long pLong1, boolean pBoolean2, Camera pCamera3, GameRenderer pGameRenderer4, LightTexture pLightTexture5, Matrix4f pMatrix4f6, Matrix4f pMatrix4f7, CallbackInfo ci) { pipeline.setPhase(WorldRenderingPhase.NONE); } @Inject(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/LevelRenderer;renderWorldBorder(Lnet/minecraft/client/Camera;)V")) - private void iris$beginWorldBorder(PoseStack poseStack, float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projection, CallbackInfo callback) { + private void iris$beginWorldBorder(float pLevelRenderer0, long pLong1, boolean pBoolean2, Camera pCamera3, GameRenderer pGameRenderer4, LightTexture pLightTexture5, Matrix4f pMatrix4f6, Matrix4f pMatrix4f7, CallbackInfo ci) { pipeline.setPhase(WorldRenderingPhase.WORLD_BORDER); } @Inject(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/LevelRenderer;renderWorldBorder(Lnet/minecraft/client/Camera;)V", shift = At.Shift.AFTER)) - private void iris$endWorldBorder(PoseStack poseStack, float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projection, CallbackInfo callback) { + private void iris$endWorldBorder(float pLevelRenderer0, long pLong1, boolean pBoolean2, Camera pCamera3, GameRenderer pGameRenderer4, LightTexture pLightTexture5, Matrix4f pMatrix4f6, Matrix4f pMatrix4f7, CallbackInfo ci) { pipeline.setPhase(WorldRenderingPhase.NONE); } @Inject(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/debug/DebugRenderer;render(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource$BufferSource;DDD)V")) - private void iris$setDebugRenderStage(PoseStack poseStack, float f, long l, boolean bl, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) { + private void iris$setDebugRenderStage(float pLevelRenderer0, long pLong1, boolean pBoolean2, Camera pCamera3, GameRenderer pGameRenderer4, LightTexture pLightTexture5, Matrix4f pMatrix4f6, Matrix4f pMatrix4f7, CallbackInfo ci) { pipeline.setPhase(WorldRenderingPhase.DEBUG); } @Inject(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/debug/DebugRenderer;render(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource$BufferSource;DDD)V", shift = At.Shift.AFTER)) - private void iris$resetDebugRenderStage(PoseStack poseStack, float f, long l, boolean bl, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) { + private void iris$resetDebugRenderStage(float pLevelRenderer0, long pLong1, boolean pBoolean2, Camera pCamera3, GameRenderer pGameRenderer4, LightTexture pLightTexture5, Matrix4f pMatrix4f6, Matrix4f pMatrix4f7, CallbackInfo ci) { pipeline.setPhase(WorldRenderingPhase.NONE); } @@ -268,12 +268,9 @@ public class MixinLevelRenderer { } @Inject(method = "renderLevel", at = @At(value = "CONSTANT", args = "stringValue=translucent")) - private void iris$beginTranslucents(PoseStack poseStack, float tickDelta, long limitTime, - boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, - LightTexture lightTexture, Matrix4f projection, - CallbackInfo ci) { + private void iris$beginTranslucents(float tickDelta, long pLong1, boolean pBoolean2, Camera camera, GameRenderer gameRenderer, LightTexture pLightTexture5, Matrix4f pMatrix4f6, Matrix4f pMatrix4f7, CallbackInfo ci) { pipeline.beginHand(); - HandRenderer.INSTANCE.renderSolid(poseStack, tickDelta, camera, gameRenderer, pipeline); + HandRenderer.INSTANCE.renderSolid(pMatrix4f6, tickDelta, camera, gameRenderer, pipeline); Minecraft.getInstance().getProfiler().popPush("iris_pre_translucent"); pipeline.beginTranslucents(); } diff --git a/src/main/java/net/coderbot/iris/mixin/MixinModelViewBobbing.java b/src/main/java/net/coderbot/iris/mixin/MixinModelViewBobbing.java index 64649221c2..1d86305972 100644 --- a/src/main/java/net/coderbot/iris/mixin/MixinModelViewBobbing.java +++ b/src/main/java/net/coderbot/iris/mixin/MixinModelViewBobbing.java @@ -1,10 +1,10 @@ package net.coderbot.iris.mixin; import com.mojang.blaze3d.vertex.PoseStack; -import org.joml.Matrix3f; import org.joml.Matrix4f; import net.irisshaders.iris.api.v0.IrisApi; import net.minecraft.client.renderer.GameRenderer; +import org.joml.Matrix4fc; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; @@ -25,13 +25,13 @@ @Mixin(GameRenderer.class) public class MixinModelViewBobbing { @Unique - private Matrix4f bobbingEffectsModel; + private Matrix4fc bobbingEffectsModel; @Unique private boolean areShadersOn; @Inject(method = "renderLevel", at = @At("HEAD")) - private void iris$saveShadersOn(float pGameRenderer0, long pLong1, PoseStack pPoseStack2, CallbackInfo ci) { + private void iris$saveShadersOn(float pGameRenderer0, long pLong1, CallbackInfo ci) { areShadersOn = IrisApi.getInstance().isShaderPackInUse(); } @@ -49,27 +49,28 @@ public class MixinModelViewBobbing { @Redirect(method = "renderLevel", at = @At(value = "INVOKE", - target = "Lcom/mojang/blaze3d/vertex/PoseStack;last()Lcom/mojang/blaze3d/vertex/PoseStack$Pose;"), + target = "Lorg/joml/Matrix4f;mul(Lorg/joml/Matrix4fc;)Lorg/joml/Matrix4f;"), slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GameRenderer;bobHurt(Lcom/mojang/blaze3d/vertex/PoseStack;F)V"), to = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GameRenderer;resetProjectionMatrix(Lorg/joml/Matrix4f;)V"))) - private PoseStack.Pose iris$saveBobbing(PoseStack stack) { - if (!areShadersOn) return stack.last(); + private Matrix4f iris$saveBobbing(Matrix4f instance, Matrix4fc right) { + if (!areShadersOn) instance.mul(right); - bobbingEffectsModel = new Matrix4f(stack.last().pose()); + bobbingEffectsModel = right; - stack.popPose(); - - return stack.last(); + return instance; } - @Inject(method = "renderLevel", + @Redirect(method = "renderLevel", at = @At(value = "INVOKE", - target = "Lnet/minecraft/client/renderer/GameRenderer;resetProjectionMatrix(Lorg/joml/Matrix4f;)V")) - private void iris$applyBobbingToModelView(float tickDelta, long limitTime, PoseStack matrix, CallbackInfo ci) { - if (!areShadersOn) return; + target = "Lorg/joml/Matrix4f;rotationXYZ(FFF)Lorg/joml/Matrix4f;")) + private Matrix4f iris$applyBobbingToModelView(Matrix4f instance, float angleX, float angleY, float angleZ) { + instance.rotationXYZ(angleX, angleY, angleZ); + + if (!areShadersOn) return instance; - matrix.last().pose().mul(bobbingEffectsModel); + instance.mul(bobbingEffectsModel); bobbingEffectsModel = null; + return instance; } } diff --git a/src/main/java/net/coderbot/iris/mixin/MixinParticleEngine.java b/src/main/java/net/coderbot/iris/mixin/MixinParticleEngine.java index 58041e82ca..53440f840e 100644 --- a/src/main/java/net/coderbot/iris/mixin/MixinParticleEngine.java +++ b/src/main/java/net/coderbot/iris/mixin/MixinParticleEngine.java @@ -17,20 +17,14 @@ */ @Mixin(ParticleEngine.class) public class MixinParticleEngine { - private static final String RENDER = - "Lnet/minecraft/client/particle/ParticleEngine;render(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource$BufferSource;Lnet/minecraft/client/renderer/LightTexture;Lnet/minecraft/client/Camera;F)V"; - @Inject(method = RENDER, at = @At("HEAD")) - private void iris$beginDrawingParticles(PoseStack poseStack, MultiBufferSource.BufferSource bufferSource, - LightTexture lightTexture, Camera camera, float f, - CallbackInfo ci) { + @Inject(method = "render", at = @At("HEAD")) + private void iris$beginDrawingParticles(LightTexture pParticleEngine0, Camera pCamera1, float pFloat2, CallbackInfo ci) { Iris.getPipelineManager().getPipeline().ifPresent(pipeline -> pipeline.setPhase(WorldRenderingPhase.PARTICLES)); } - @Inject(method = RENDER, at = @At("RETURN")) - private void iris$finishDrawingParticles(PoseStack poseStack, MultiBufferSource.BufferSource bufferSource, - LightTexture lightTexture, Camera camera, float f, - CallbackInfo ci) { + @Inject(method = "render", at = @At("RETURN")) + private void iris$finishDrawingParticles(LightTexture pParticleEngine0, Camera pCamera1, float pFloat2, CallbackInfo ci) { Iris.getPipelineManager().getPipeline().ifPresent(pipeline -> pipeline.setPhase(WorldRenderingPhase.NONE)); } } diff --git a/src/main/java/net/coderbot/iris/mixin/MixinTheEndPortalRenderer.java b/src/main/java/net/coderbot/iris/mixin/MixinTheEndPortalRenderer.java index fb52d8fb2a..db0c68d562 100644 --- a/src/main/java/net/coderbot/iris/mixin/MixinTheEndPortalRenderer.java +++ b/src/main/java/net/coderbot/iris/mixin/MixinTheEndPortalRenderer.java @@ -39,7 +39,7 @@ protected float getOffsetDown() { return 0.375F; } - @Inject(method = "render", at = @At("HEAD"), cancellable = true) + @Inject(method = "render(Lnet/minecraft/world/level/block/entity/TheEndPortalBlockEntity;FLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;II)V", at = @At("HEAD"), cancellable = true) public void iris$onRender(TheEndPortalBlockEntity entity, float tickDelta, PoseStack poseStack, MultiBufferSource multiBufferSource, int light, int overlay, CallbackInfo ci) { if (!Iris.getCurrentPack().isPresent()) { return; @@ -51,8 +51,6 @@ protected float getOffsetDown() { VertexConsumer vertexConsumer = multiBufferSource.getBuffer(RenderType.entitySolid(TheEndPortalRenderer.END_PORTAL_LOCATION)); - Matrix4f pose = poseStack.last().pose(); - Matrix3f normal = poseStack.last().normal(); // animation with a period of 100 seconds. // note that texture coordinates are wrapping, not clamping. @@ -60,37 +58,37 @@ protected float getOffsetDown() { float topHeight = getOffsetUp(); float bottomHeight = getOffsetDown(); - quad(entity, vertexConsumer, pose, normal, Direction.UP, progress, overlay, light, + quad(entity, vertexConsumer, poseStack, Direction.UP, progress, overlay, light, 0.0f, topHeight, 1.0f, 1.0f, topHeight, 1.0f, 1.0f, topHeight, 0.0f, 0.0f, topHeight, 0.0f); - quad(entity, vertexConsumer, pose, normal, Direction.DOWN, progress, overlay, light, + quad(entity, vertexConsumer, poseStack, Direction.DOWN, progress, overlay, light, 0.0f, bottomHeight, 1.0f, 0.0f, bottomHeight, 0.0f, 1.0f, bottomHeight, 0.0f, 1.0f, bottomHeight, 1.0f); - quad(entity, vertexConsumer, pose, normal, Direction.NORTH, progress, overlay, light, + quad(entity, vertexConsumer, poseStack, Direction.NORTH, progress, overlay, light, 0.0f, topHeight, 0.0f, 1.0f, topHeight, 0.0f, 1.0f, bottomHeight, 0.0f, 0.0f, bottomHeight, 0.0f); - quad(entity, vertexConsumer, pose, normal, Direction.WEST, progress, overlay, light, + quad(entity, vertexConsumer, poseStack, Direction.WEST, progress, overlay, light, 0.0f, topHeight, 1.0f, 0.0f, topHeight, 0.0f, 0.0f, bottomHeight, 0.0f, 0.0f, bottomHeight, 1.0f); - quad(entity, vertexConsumer, pose, normal, Direction.SOUTH, progress, overlay, light, + quad(entity, vertexConsumer, poseStack, Direction.SOUTH, progress, overlay, light, 0.0f, topHeight, 1.0f, 0.0f, bottomHeight, 1.0f, 1.0f, bottomHeight, 1.0f, 1.0f, topHeight, 1.0f); - quad(entity, vertexConsumer, pose, normal, Direction.EAST, progress, overlay, light, + quad(entity, vertexConsumer, poseStack, Direction.EAST, progress, overlay, light, 1.0f, topHeight, 1.0f, 1.0f, bottomHeight, 1.0f, 1.0f, bottomHeight, 0.0f, @@ -98,7 +96,7 @@ protected float getOffsetDown() { } @Unique - private void quad(TheEndPortalBlockEntity entity, VertexConsumer vertexConsumer, Matrix4f pose, Matrix3f normal, + private void quad(TheEndPortalBlockEntity entity, VertexConsumer vertexConsumer, PoseStack poseStack, Direction direction, float progress, int overlay, int light, float x1, float y1, float z1, float x2, float y2, float z2, @@ -112,20 +110,22 @@ private void quad(TheEndPortalBlockEntity entity, VertexConsumer vertexConsumer, float ny = direction.getStepY(); float nz = direction.getStepZ(); + PoseStack.Pose pose = poseStack.last(); + vertexConsumer.vertex(pose, x1, y1, z1).color(RED, GREEN, BLUE, 1.0f) .uv(0.0F + progress, 0.0F + progress).overlayCoords(overlay).uv2(light) - .normal(normal, nx, ny, nz).endVertex(); + .normal(pose, nx, ny, nz).endVertex(); vertexConsumer.vertex(pose, x2, y2, z2).color(RED, GREEN, BLUE, 1.0f) .uv(0.0F + progress, 0.2F + progress).overlayCoords(overlay).uv2(light) - .normal(normal, nx, ny, nz).endVertex(); + .normal(pose, nx, ny, nz).endVertex(); vertexConsumer.vertex(pose, x3, y3, z3).color(RED, GREEN, BLUE, 1.0f) .uv(0.2F + progress, 0.2F + progress).overlayCoords(overlay).uv2(light) - .normal(normal, nx, ny, nz).endVertex(); + .normal(pose, nx, ny, nz).endVertex(); vertexConsumer.vertex(pose, x4, y4, z4).color(RED, GREEN, BLUE, 1.0f) .uv(0.2F + progress, 0.0F + progress).overlayCoords(overlay).uv2(light) - .normal(normal, nx, ny, nz).endVertex(); + .normal(pose, nx, ny, nz).endVertex(); } } diff --git a/src/main/java/net/coderbot/iris/mixin/entity_render_context/MixinHorseArmorLayer.java b/src/main/java/net/coderbot/iris/mixin/entity_render_context/MixinHorseArmorLayer.java index f68cfe939a..adba76f6b4 100644 --- a/src/main/java/net/coderbot/iris/mixin/entity_render_context/MixinHorseArmorLayer.java +++ b/src/main/java/net/coderbot/iris/mixin/entity_render_context/MixinHorseArmorLayer.java @@ -25,9 +25,9 @@ public class MixinHorseArmorLayer { @Inject(method = "render(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/world/entity/animal/horse/Horse;FFFFFF)V", at = @At(value = "HEAD")) private void changeId(PoseStack pHorseArmorLayer0, MultiBufferSource pMultiBufferSource1, int pInt2, Horse pHorse3, float pFloat4, float pFloat5, float pFloat6, float pFloat7, float pFloat8, float pFloat9, CallbackInfo ci) { - if (BlockRenderingSettings.INSTANCE.getItemIds() == null || !(pHorse3.getArmor().getItem() instanceof AnimalArmorItem)) return; + if (BlockRenderingSettings.INSTANCE.getItemIds() == null || pHorse3.getBodyArmorItem().isEmpty()) return; - ResourceLocation location = BuiltInRegistries.ITEM.getKey((pHorse3.getArmor().getItem())); + ResourceLocation location = BuiltInRegistries.ITEM.getKey((pHorse3.getBodyArmorItem().getItem())); CapturedRenderingState.INSTANCE.setCurrentRenderedItem(BlockRenderingSettings.INSTANCE.getItemIds().applyAsInt(new NamespacedId(location.getNamespace(), location.getPath()))); } diff --git a/src/main/java/net/coderbot/iris/mixin/entity_render_context/MixinHumanoidArmorLayer.java b/src/main/java/net/coderbot/iris/mixin/entity_render_context/MixinHumanoidArmorLayer.java index 898a7f1b01..6658bfc3a2 100644 --- a/src/main/java/net/coderbot/iris/mixin/entity_render_context/MixinHumanoidArmorLayer.java +++ b/src/main/java/net/coderbot/iris/mixin/entity_render_context/MixinHumanoidArmorLayer.java @@ -11,6 +11,7 @@ import net.minecraft.client.renderer.entity.layers.HumanoidArmorLayer; import net.minecraft.client.renderer.entity.layers.RenderLayer; import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.core.Holder; import net.minecraft.core.Registry; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; @@ -45,7 +46,7 @@ private void changeId(PoseStack pHumanoidArmorLayer0, MultiBufferSource pMultiBu private int backupValue = 0; @Inject(method = "renderTrim", at = @At(value = "HEAD"), locals = LocalCapture.CAPTURE_FAILHARD) - private void changeTrimTemp(ArmorMaterial pHumanoidArmorLayer0, PoseStack pPoseStack1, MultiBufferSource pMultiBufferSource2, int pInt3, ArmorTrim pArmorTrim4, A pHumanoidModel5, boolean pBoolean6, CallbackInfo ci) { + private void changeTrimTemp(Holder pHumanoidArmorLayer0, PoseStack pPoseStack1, MultiBufferSource pMultiBufferSource2, int pInt3, ArmorTrim pArmorTrim4, A pHumanoidModel5, boolean pBoolean6, CallbackInfo ci) { if (BlockRenderingSettings.INSTANCE.getItemIds() == null) return; backupValue = CapturedRenderingState.INSTANCE.getCurrentRenderedItem(); @@ -53,7 +54,7 @@ private void changeTrimTemp(ArmorMaterial pHumanoidArmorLayer0, PoseStack pPoseS } @Inject(method = "renderTrim", at = @At(value = "TAIL")) - private void changeTrimTemp2(ArmorMaterial pHumanoidArmorLayer0, PoseStack pPoseStack1, MultiBufferSource pMultiBufferSource2, int pInt3, ArmorTrim pArmorTrim4, A pHumanoidModel5, boolean pBoolean6, CallbackInfo ci) { + private void changeTrimTemp2(Holder pHumanoidArmorLayer0, PoseStack pPoseStack1, MultiBufferSource pMultiBufferSource2, int pInt3, ArmorTrim pArmorTrim4, A pHumanoidModel5, boolean pBoolean6, CallbackInfo ci) { if (BlockRenderingSettings.INSTANCE.getItemIds() == null) return; CapturedRenderingState.INSTANCE.setCurrentRenderedItem(backupValue); backupValue = 0; diff --git a/src/main/java/net/coderbot/iris/mixin/fantastic/MixinLevelRenderer.java b/src/main/java/net/coderbot/iris/mixin/fantastic/MixinLevelRenderer.java index 18a84ec76a..3ba8213ec4 100644 --- a/src/main/java/net/coderbot/iris/mixin/fantastic/MixinLevelRenderer.java +++ b/src/main/java/net/coderbot/iris/mixin/fantastic/MixinLevelRenderer.java @@ -38,12 +38,12 @@ public class MixinLevelRenderer { private RenderBuffers renderBuffers; @Inject(method = "renderLevel", at = @At("HEAD")) - private void iris$resetParticleManagerPhase(PoseStack poseStack, float f, long l, boolean bl, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) { + private void iris$resetParticleManagerPhase(float pLevelRenderer0, long pLong1, boolean pBoolean2, Camera pCamera3, GameRenderer pGameRenderer4, LightTexture pLightTexture5, Matrix4f pMatrix4f6, Matrix4f pMatrix4f7, CallbackInfo ci) { ((PhasedParticleEngine) minecraft.particleEngine).setParticleRenderingPhase(ParticleRenderingPhase.EVERYTHING); } @Inject(method = "renderLevel", at = @At(value = "CONSTANT", args = "stringValue=entities")) - private void iris$renderOpaqueParticles(PoseStack poseStack, float f, long l, boolean bl, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) { + private void iris$renderOpaqueParticles(float f, long pLong1, boolean pBoolean2, Camera camera, GameRenderer pGameRenderer4, LightTexture lightTexture, Matrix4f pMatrix4f6, Matrix4f pMatrix4f7, CallbackInfo ci) { minecraft.getProfiler().popPush("opaque_particles"); MultiBufferSource.BufferSource bufferSource = renderBuffers.bufferSource(); @@ -51,22 +51,22 @@ public class MixinLevelRenderer { ParticleRenderingSettings settings = getRenderingSettings(); if (settings == ParticleRenderingSettings.BEFORE) { - minecraft.particleEngine.render(poseStack, bufferSource, lightTexture, camera, f); + minecraft.particleEngine.render(lightTexture, camera, f); } else if (settings == ParticleRenderingSettings.MIXED) { ((PhasedParticleEngine) minecraft.particleEngine).setParticleRenderingPhase(ParticleRenderingPhase.OPAQUE); - minecraft.particleEngine.render(poseStack, bufferSource, lightTexture, camera, f); + minecraft.particleEngine.render(lightTexture, camera, f); } } - @Redirect(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/particle/ParticleEngine;render(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource$BufferSource;Lnet/minecraft/client/renderer/LightTexture;Lnet/minecraft/client/Camera;F)V")) - private void iris$renderTranslucentAfterDeferred(ParticleEngine instance, PoseStack poseStack, MultiBufferSource.BufferSource bufferSource, LightTexture lightTexture, Camera camera, float f) { + @Redirect(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/particle/ParticleEngine;render(Lnet/minecraft/client/renderer/LightTexture;Lnet/minecraft/client/Camera;F)V")) + private void iris$renderTranslucentAfterDeferred(ParticleEngine instance, LightTexture lightTexture, Camera camera, float f) { ParticleRenderingSettings settings = getRenderingSettings(); if (settings == ParticleRenderingSettings.AFTER) { - minecraft.particleEngine.render(poseStack, bufferSource, lightTexture, camera, f); + minecraft.particleEngine.render(lightTexture, camera, f); } else if (settings == ParticleRenderingSettings.MIXED) { ((PhasedParticleEngine) minecraft.particleEngine).setParticleRenderingPhase(ParticleRenderingPhase.TRANSLUCENT); - minecraft.particleEngine.render(poseStack, bufferSource, lightTexture, camera, f); + minecraft.particleEngine.render(lightTexture, camera, f); } } diff --git a/src/main/java/net/coderbot/iris/mixin/sky/MixinLevelRenderer_SunMoonToggle.java b/src/main/java/net/coderbot/iris/mixin/sky/MixinLevelRenderer_SunMoonToggle.java index 9968e82df3..3a00ccba89 100644 --- a/src/main/java/net/coderbot/iris/mixin/sky/MixinLevelRenderer_SunMoonToggle.java +++ b/src/main/java/net/coderbot/iris/mixin/sky/MixinLevelRenderer_SunMoonToggle.java @@ -42,7 +42,7 @@ public class MixinLevelRenderer_SunMoonToggle { from = @At(value = "FIELD", target = "net/minecraft/client/renderer/LevelRenderer.SUN_LOCATION : Lnet/minecraft/resources/ResourceLocation;"), to = @At(value = "FIELD", target = "net/minecraft/client/renderer/LevelRenderer.MOON_LOCATION : Lnet/minecraft/resources/ResourceLocation;")), allow = 1) - private void iris$beforeDrawSun(PoseStack arg, Matrix4f arg2, float f, Camera arg3, boolean bl, Runnable runnable, CallbackInfo ci) { + private void iris$beforeDrawSun(Matrix4f pLevelRenderer0, Matrix4f pMatrix4f1, float pFloat2, Camera pCamera3, boolean pBoolean4, Runnable pRunnable5, CallbackInfo ci) { if (!Iris.getPipelineManager().getPipeline().map(WorldRenderingPipeline::shouldRenderSun).orElse(true)) { iris$emptyBuilder(); } @@ -54,7 +54,7 @@ public class MixinLevelRenderer_SunMoonToggle { from = @At(value = "FIELD", target = "net/minecraft/client/renderer/LevelRenderer.MOON_LOCATION : Lnet/minecraft/resources/ResourceLocation;"), to = @At(value = "INVOKE", target = "net/minecraft/client/multiplayer/ClientLevel.getStarBrightness (F)F")), allow = 1) - private void iris$beforeDrawMoon(PoseStack arg, Matrix4f arg2, float f, Camera arg3, boolean bl, Runnable runnable, CallbackInfo ci) { + private void iris$beforeDrawMoon(Matrix4f pLevelRenderer0, Matrix4f pMatrix4f1, float pFloat2, Camera pCamera3, boolean pBoolean4, Runnable pRunnable5, CallbackInfo ci) { if (!Iris.getPipelineManager().getPipeline().map(WorldRenderingPipeline::shouldRenderMoon).orElse(true)) { iris$emptyBuilder(); } diff --git a/src/main/java/net/coderbot/iris/mixin/vertices/immediate/MixinLevelRenderer.java b/src/main/java/net/coderbot/iris/mixin/vertices/immediate/MixinLevelRenderer.java index 5b90825e3d..bd8f8470d7 100644 --- a/src/main/java/net/coderbot/iris/mixin/vertices/immediate/MixinLevelRenderer.java +++ b/src/main/java/net/coderbot/iris/mixin/vertices/immediate/MixinLevelRenderer.java @@ -16,12 +16,12 @@ @Mixin(value = LevelRenderer.class, priority = 999) public class MixinLevelRenderer { @Inject(method = "renderLevel", at = @At("HEAD")) - private void iris$immediateStateBeginLevelRender(PoseStack poseStack, float f, long l, boolean bl, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f matrix4f, CallbackInfo ci) { + private void iris$immediateStateBeginLevelRender(float pLevelRenderer0, long pLong1, boolean pBoolean2, Camera pCamera3, GameRenderer pGameRenderer4, LightTexture pLightTexture5, Matrix4f pMatrix4f6, Matrix4f pMatrix4f7, CallbackInfo ci) { ImmediateState.isRenderingLevel = true; } @Inject(method = "renderLevel", at = @At("RETURN")) - private void iris$immediateStateEndLevelRender(PoseStack poseStack, float f, long l, boolean bl, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f matrix4f, CallbackInfo ci) { + private void iris$immediateStateEndLevelRender(float pLevelRenderer0, long pLong1, boolean pBoolean2, Camera pCamera3, GameRenderer pGameRenderer4, LightTexture pLightTexture5, Matrix4f pMatrix4f6, Matrix4f pMatrix4f7, CallbackInfo ci) { ImmediateState.isRenderingLevel = false; } } diff --git a/src/main/java/net/coderbot/iris/pipeline/HandRenderer.java b/src/main/java/net/coderbot/iris/pipeline/HandRenderer.java index adfda3b805..f136772fc7 100644 --- a/src/main/java/net/coderbot/iris/pipeline/HandRenderer.java +++ b/src/main/java/net/coderbot/iris/pipeline/HandRenderer.java @@ -1,5 +1,6 @@ package net.coderbot.iris.pipeline; +import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; import org.joml.Matrix4f; import net.coderbot.batchedentityrendering.impl.FullyBufferedMultiBufferSource; @@ -28,22 +29,22 @@ public class HandRenderer { public static final float DEPTH = 0.125F; - private void setupGlState(GameRenderer gameRenderer, Camera camera, PoseStack poseStack, float tickDelta) { - final PoseStack.Pose pose = poseStack.last(); + private PoseStack setupGlState(Matrix4f modelMatrix, GameRenderer gameRenderer, Camera camera, float tickDelta) { + final PoseStack poseStack = new PoseStack(); - // We need to scale the matrix by 0.125 so the hand doesn't clip through blocks. Matrix4f scaleMatrix = new Matrix4f().scale(1F, 1F, DEPTH); scaleMatrix.mul(gameRenderer.getProjectionMatrix(((GameRendererAccessor) gameRenderer).invokeGetFov(camera, tickDelta, false))); gameRenderer.resetProjectionMatrix(scaleMatrix); - pose.pose().identity(); - pose.normal().identity(); + poseStack.pushPose(); ((GameRendererAccessor) gameRenderer).invokeBobHurt(poseStack, tickDelta); if (Minecraft.getInstance().options.bobView().get()) { ((GameRendererAccessor) gameRenderer).invokeBobView(poseStack, tickDelta); } + + return poseStack; } private boolean canRender(Camera camera, GameRenderer gameRenderer) { @@ -70,7 +71,7 @@ public boolean isAnyHandTranslucent() { return isHandTranslucent(InteractionHand.MAIN_HAND) || isHandTranslucent(InteractionHand.OFF_HAND); } - public void renderSolid(PoseStack poseStack, float tickDelta, Camera camera, GameRenderer gameRenderer, WorldRenderingPipeline pipeline) { + public void renderSolid(Matrix4f modelMatrix, float tickDelta, Camera camera, GameRenderer gameRenderer, WorldRenderingPipeline pipeline) { if (!canRender(camera, gameRenderer) || !IrisApi.getInstance().isShaderPackInUse()) { return; } @@ -79,15 +80,17 @@ public void renderSolid(PoseStack poseStack, float tickDelta, Camera camera, Gam pipeline.setPhase(WorldRenderingPhase.HAND_SOLID); - poseStack.pushPose(); Minecraft.getInstance().getProfiler().push("iris_hand"); - setupGlState(gameRenderer, camera, poseStack, tickDelta); + PoseStack poseStack = setupGlState(modelMatrix, gameRenderer, camera, tickDelta); + RenderSystem.getModelViewStack().pushMatrix(); + RenderSystem.getModelViewStack().set(poseStack.last().pose()); + RenderSystem.applyModelViewMatrix(); renderingSolid = true; - gameRenderer.itemInHandRenderer.renderHandsWithItems(tickDelta, poseStack, bufferSource.getUnflushableWrapper(), Minecraft.getInstance().player, Minecraft.getInstance().getEntityRenderDispatcher().getPackedLightCoords(camera.getEntity(), tickDelta)); + gameRenderer.itemInHandRenderer.renderHandsWithItems(tickDelta, new PoseStack(), bufferSource.getUnflushableWrapper(), Minecraft.getInstance().player, Minecraft.getInstance().getEntityRenderDispatcher().getPackedLightCoords(camera.getEntity(), tickDelta)); Minecraft.getInstance().getProfiler().pop(); @@ -95,7 +98,8 @@ public void renderSolid(PoseStack poseStack, float tickDelta, Camera camera, Gam bufferSource.endBatch(); gameRenderer.resetProjectionMatrix(CapturedRenderingState.INSTANCE.getGbufferProjection()); - + RenderSystem.getModelViewStack().popMatrix(); + RenderSystem.applyModelViewMatrix(); poseStack.popPose(); renderingSolid = false; @@ -105,7 +109,7 @@ public void renderSolid(PoseStack poseStack, float tickDelta, Camera camera, Gam ACTIVE = false; } - public void renderTranslucent(PoseStack poseStack, float tickDelta, Camera camera, GameRenderer gameRenderer, WorldRenderingPipeline pipeline) { + public void renderTranslucent(Matrix4f modelMatrix, float tickDelta, Camera camera, GameRenderer gameRenderer, WorldRenderingPipeline pipeline) { if (!canRender(camera, gameRenderer) || !isAnyHandTranslucent() || !IrisApi.getInstance().isShaderPackInUse()) { return; } @@ -114,13 +118,13 @@ public void renderTranslucent(PoseStack poseStack, float tickDelta, Camera camer pipeline.setPhase(WorldRenderingPhase.HAND_TRANSLUCENT); - poseStack.pushPose(); - Minecraft.getInstance().getProfiler().push("iris_hand_translucent"); - setupGlState(gameRenderer, camera, poseStack, tickDelta); - - gameRenderer.itemInHandRenderer.renderHandsWithItems(tickDelta, poseStack, bufferSource, Minecraft.getInstance().player, Minecraft.getInstance().getEntityRenderDispatcher().getPackedLightCoords(camera.getEntity(), tickDelta)); + PoseStack poseStack = setupGlState(modelMatrix, gameRenderer, camera, tickDelta); + RenderSystem.getModelViewStack().pushMatrix(); + RenderSystem.getModelViewStack().set(poseStack.last().pose()); + RenderSystem.applyModelViewMatrix(); + gameRenderer.itemInHandRenderer.renderHandsWithItems(tickDelta, new PoseStack(), bufferSource, Minecraft.getInstance().player, Minecraft.getInstance().getEntityRenderDispatcher().getPackedLightCoords(camera.getEntity(), tickDelta)); poseStack.popPose(); @@ -129,6 +133,8 @@ public void renderTranslucent(PoseStack poseStack, float tickDelta, Camera camer gameRenderer.resetProjectionMatrix(CapturedRenderingState.INSTANCE.getGbufferProjection()); bufferSource.endBatch(); + RenderSystem.getModelViewStack().popMatrix(); + RenderSystem.applyModelViewMatrix(); pipeline.setPhase(WorldRenderingPhase.NONE); diff --git a/src/main/java/net/coderbot/iris/pipeline/ShadowRenderer.java b/src/main/java/net/coderbot/iris/pipeline/ShadowRenderer.java index 78f603b6ad..21f58e6895 100644 --- a/src/main/java/net/coderbot/iris/pipeline/ShadowRenderer.java +++ b/src/main/java/net/coderbot/iris/pipeline/ShadowRenderer.java @@ -456,9 +456,9 @@ public void renderShadows(LevelRendererAccessor levelRenderer, Camera playerCame // Render all opaque terrain unless pack requests not to if (shouldRenderTerrain) { - levelRenderer.invokeRenderSectionLayer(RenderType.solid(), modelView, cameraX, cameraY, cameraZ, shadowProjection); - levelRenderer.invokeRenderSectionLayer(RenderType.cutout(), modelView, cameraX, cameraY, cameraZ, shadowProjection); - levelRenderer.invokeRenderSectionLayer(RenderType.cutoutMipped(), modelView, cameraX, cameraY, cameraZ, shadowProjection); + levelRenderer.invokeRenderSectionLayer(RenderType.solid(), cameraX, cameraY, cameraZ, MODELVIEW, shadowProjection); + levelRenderer.invokeRenderSectionLayer(RenderType.cutout(), cameraX, cameraY, cameraZ, MODELVIEW, shadowProjection); + levelRenderer.invokeRenderSectionLayer(RenderType.cutoutMipped(), cameraX, cameraY, cameraZ, MODELVIEW, shadowProjection); } // Reset our viewport in case Sodium overrode it @@ -528,7 +528,7 @@ public void renderShadows(LevelRendererAccessor levelRenderer, Camera playerCame // It doesn't matter a ton, since this just means that they won't be sorted in the normal rendering pass. // Just something to watch out for, however... if (shouldRenderTranslucent) { - levelRenderer.invokeRenderSectionLayer(RenderType.translucent(), modelView, cameraX, cameraY, cameraZ, shadowProjection); + levelRenderer.invokeRenderSectionLayer(RenderType.translucent(), cameraX, cameraY, cameraZ, MODELVIEW, shadowProjection); } // Note: Apparently tripwire isn't rendered in the shadow pass. diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 49819c7e14..ab22a552f5 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "id": "iris", - "version": "1.6.14-development-environment", + "version": "1.6.15-development-environment", "name": "Iris", "description": "A modern shaders mod for Minecraft intended to be compatible with existing OptiFine shader packs", @@ -45,8 +45,7 @@ "depends": { "fabricloader": ">=0.12.3", - "minecraft": ["~1.20.4"], - "sodium": "0.5.6" + "minecraft": ["~1.20.4"] }, "breaks": { diff --git a/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/mixin/font/MixinGlyphRenderer.java b/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/mixin/font/MixinGlyphRenderer.java index eb36d14635..3bfb1a927b 100644 --- a/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/mixin/font/MixinGlyphRenderer.java +++ b/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/mixin/font/MixinGlyphRenderer.java @@ -58,12 +58,10 @@ public class MixinGlyphRenderer { public void render(boolean italic, float x, float y, Matrix4f matrix, VertexConsumer vertexConsumer, float red, float green, float blue, float alpha, int light) { float x1 = x + this.left; float x2 = x + this.right; - float y1 = this.up - 3.0F; - float y2 = this.down - 3.0F; - float h1 = y + y1; - float h2 = y + y2; - float w1 = italic ? 1.0F - 0.25F * y1 : 0.0F; - float w2 = italic ? 1.0F - 0.25F * y2 : 0.0F; + float y1 = y + this.up; + float y2 = y + this.down; + float w1 = italic ? 1.0F - 0.25F * this.up : 0.0F; + float w2 = italic ? 1.0F - 0.25F * this.down : 0.0F; int color = ColorABGR.pack(red, green, blue, alpha); @@ -75,16 +73,16 @@ public void render(boolean italic, float x, float y, Matrix4f matrix, VertexCons long buffer = stack.nmalloc(4 * stride); long ptr = buffer; - write(ext, ptr, matrix, x1 + w1, h1, 0.0F, color, this.u0, this.v0, light); + write(ext, ptr, matrix, x1 + w1, y1, 0.0F, color, this.u0, this.v0, light); ptr += stride; - write(ext, ptr, matrix, x1 + w2, h2, 0.0F, color, this.u0, this.v1, light); + write(ext, ptr, matrix, x1 + w2, y2, 0.0F, color, this.u0, this.v1, light); ptr += stride; - write(ext, ptr, matrix, x2 + w2, h2, 0.0F, color, this.u1, this.v1, light); + write(ext, ptr, matrix, x2 + w2, y2, 0.0F, color, this.u1, this.v1, light); ptr += stride; - write(ext, ptr, matrix, x2 + w1, h1, 0.0F, color, this.u1, this.v0, light); + write(ext, ptr, matrix, x2 + w1, y1, 0.0F, color, this.u1, this.v0, light); ptr += stride; writer.push(stack, buffer, 4, ext ? GlyphVertexExt.FORMAT : GlyphVertex.FORMAT); diff --git a/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/mixin/sky/MixinLevelRenderer.java b/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/mixin/sky/MixinLevelRenderer.java index 8f761088c3..06464b91b8 100644 --- a/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/mixin/sky/MixinLevelRenderer.java +++ b/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/mixin/sky/MixinLevelRenderer.java @@ -45,7 +45,7 @@ public class MixinLevelRenderer { * ways the fog can be reduced in {@link FogRenderer#setupFog}.

*/ @Inject(method = "renderSky", at = @At("HEAD"), cancellable = true) - private void preRenderSky(PoseStack poseStack, Matrix4f projectionMatrix, float f, Camera camera, boolean bl, Runnable runnable, CallbackInfo ci) { + private void preRenderSky(Matrix4f pLevelRenderer0, Matrix4f pMatrix4f1, float pFloat2, Camera camera, boolean pBoolean4, Runnable pRunnable5, CallbackInfo ci) { if (!Iris.getCurrentPack().isPresent()) { Vec3 cameraPosition = camera.getPosition(); Entity cameraEntity = camera.getEntity();