Update to 1.21.2
This commit is contained in:
@@ -84,7 +84,7 @@ public abstract class OpenGlFrameCapturer<F extends Frame, D extends CaptureData
|
||||
frameBuffer().beginWrite(true);
|
||||
|
||||
GlStateManager.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT
|
||||
//#if MC>=11400
|
||||
//#if MC>=11400 && MC<12102
|
||||
, false
|
||||
//#endif
|
||||
);
|
||||
|
||||
@@ -293,7 +293,10 @@ public class GuiVideoRenderer extends GuiScreen implements Tickable {
|
||||
int g = buffer.get() & 0xff;
|
||||
int r = buffer.get() & 0xff;
|
||||
buffer.get(); // alpha
|
||||
//#if MC>=11400
|
||||
//#if MC>=12102
|
||||
//$$ int value = 0xff << 24 | r << 16 | g << 8 | b;
|
||||
//$$ data.setColorArgb(x, y, value);
|
||||
//#elseif MC>=11400
|
||||
int value = 0xff << 24 | b << 16 | g << 8 | r;
|
||||
data.setPixelColor(x, y, value); // actually takes ABGR, not RGBA
|
||||
//#else
|
||||
|
||||
@@ -68,17 +68,21 @@ public class VirtualWindow implements Closeable {
|
||||
}
|
||||
|
||||
public void beginWrite() {
|
||||
MinecraftClientExt.get(mc).setFramebufferDelegate(guiFramebuffer);
|
||||
guiFramebuffer.beginWrite(true);
|
||||
}
|
||||
|
||||
public void endWrite() {
|
||||
guiFramebuffer.endWrite();
|
||||
MinecraftClientExt.get(mc).setFramebufferDelegate(null);
|
||||
}
|
||||
|
||||
public void flip() {
|
||||
guiFramebuffer.draw(framebufferWidth, framebufferHeight);
|
||||
|
||||
//#if MC>=11500
|
||||
//#if MC>=12102
|
||||
//$$ window.swapBuffers(null);
|
||||
//#elseif MC>=11500
|
||||
window.swapBuffers();
|
||||
//#else
|
||||
//#if MC>=11400
|
||||
@@ -112,7 +116,7 @@ public class VirtualWindow implements Closeable {
|
||||
|
||||
//#if MC>=11400
|
||||
guiFramebuffer.resize(newWidth, newHeight
|
||||
//#if MC>=11400
|
||||
//#if MC>=11400 && MC<12102
|
||||
, false
|
||||
//#endif
|
||||
);
|
||||
|
||||
@@ -2,9 +2,11 @@ package com.replaymod.render.hooks;
|
||||
|
||||
import com.replaymod.render.gui.progress.VirtualWindow;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gl.Framebuffer;
|
||||
|
||||
public interface MinecraftClientExt {
|
||||
void setWindowDelegate(VirtualWindow window);
|
||||
void setFramebufferDelegate(Framebuffer framebuffer);
|
||||
|
||||
static MinecraftClientExt get(MinecraftClient mc) {
|
||||
return (MinecraftClientExt) mc;
|
||||
|
||||
@@ -9,6 +9,10 @@ import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
|
||||
//#if MC>=12102
|
||||
//$$ import net.minecraft.client.render.entity.EntityRenderer;
|
||||
//#endif
|
||||
|
||||
//#if MC>=11500
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
@@ -31,7 +35,9 @@ public abstract class MixinRenderManager {
|
||||
//$$ @Shadow private float cameraYaw;
|
||||
//#endif
|
||||
|
||||
//#if MC>=11500
|
||||
//#if MC>=12102
|
||||
//$$ @Inject(method = "render(Lnet/minecraft/entity/Entity;DDDFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/client/render/entity/EntityRenderer;)V", at = @At("HEAD"))
|
||||
//#elseif MC>=11500
|
||||
@Inject(method = "render", at = @At("HEAD"))
|
||||
//#else
|
||||
//#if MC>=11400 && FABRIC>=1
|
||||
@@ -45,7 +51,11 @@ public abstract class MixinRenderManager {
|
||||
//#endif
|
||||
//#endif
|
||||
//#if MC>=10904
|
||||
private void replayModRender_reorientForCubicRendering(Entity entity, double dx, double dy, double dz, float iDoNotKnow, float partialTicks,
|
||||
private void replayModRender_reorientForCubicRendering(Entity entity, double dx, double dy, double dz,
|
||||
//#if MC<12102
|
||||
float iDoNotKnow,
|
||||
//#endif
|
||||
float partialTicks,
|
||||
//#if MC>=11500
|
||||
MatrixStack matrixStack,
|
||||
VertexConsumerProvider vertexConsumerProvider,
|
||||
@@ -53,6 +63,9 @@ public abstract class MixinRenderManager {
|
||||
//#else
|
||||
//$$ boolean iDoNotCare,
|
||||
//#endif
|
||||
//#if MC>=12102
|
||||
//$$ EntityRenderer<?, ?> renderer,
|
||||
//#endif
|
||||
CallbackInfo ci) {
|
||||
//#else
|
||||
//$$ private void replayModRender_reorientForCubicRendering(Entity entity, double dx, double dy, double dz, float iDoNotKnow, float partialTicks, boolean iDoNotCare, CallbackInfoReturnable<Boolean> ci) {
|
||||
|
||||
@@ -21,6 +21,10 @@ import java.util.concurrent.locks.Condition;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
//#if MC>=12102
|
||||
//$$ import net.minecraft.util.thread.SimpleConsecutiveExecutor;
|
||||
//#endif
|
||||
|
||||
//#if MC>=12003
|
||||
//$$ import net.minecraft.client.render.chunk.BlockBufferBuilderPool;
|
||||
//#endif
|
||||
@@ -56,7 +60,11 @@ public abstract class Mixin_BlockOnChunkRebuilds implements ForceChunkLoadingHoo
|
||||
@Shadow public abstract boolean upload();
|
||||
//#endif
|
||||
|
||||
//#if MC>=12102
|
||||
//$$ @Shadow @Final private SimpleConsecutiveExecutor consecutiveExecutor;
|
||||
//#else
|
||||
@Shadow @Final private TaskExecutor<Runnable> mailbox;
|
||||
//#endif
|
||||
|
||||
@Shadow protected abstract void scheduleRunTasks();
|
||||
|
||||
@@ -99,10 +107,17 @@ public abstract class Mixin_BlockOnChunkRebuilds implements ForceChunkLoadingHoo
|
||||
}
|
||||
|
||||
private boolean waitForMainThreadWork() {
|
||||
//#if MC>=12102
|
||||
//$$ this.consecutiveExecutor.executeAsync(future -> {
|
||||
//$$ scheduleRunTasks();
|
||||
//$$ future.complete(getAvailableBufferCount() == this.totalBufferCount);
|
||||
//$$ }).join();
|
||||
//#else
|
||||
boolean allDone = this.mailbox.<Boolean>ask(reply -> () -> {
|
||||
scheduleRunTasks();
|
||||
reply.send(getAvailableBufferCount() == this.totalBufferCount);
|
||||
}).join();
|
||||
//#endif
|
||||
|
||||
if (allDone) {
|
||||
return true;
|
||||
|
||||
@@ -22,14 +22,20 @@ public abstract class Mixin_ChromaKeyColorSky {
|
||||
|
||||
//#if MC>=11800
|
||||
//$$ @Inject(
|
||||
//#if MC>=12005
|
||||
//#if MC>=12102
|
||||
//$$ method = "method_62215",
|
||||
//#elseif MC>=12005
|
||||
//$$ method = "renderSky(Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;FLnet/minecraft/client/render/Camera;ZLjava/lang/Runnable;)V",
|
||||
//#elseif MC>=11802
|
||||
//$$ method = "renderSky(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/util/math/Matrix4f;FLnet/minecraft/client/render/Camera;ZLjava/lang/Runnable;)V",
|
||||
//#else
|
||||
//$$ method = "renderSky(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/util/math/Matrix4f;FLjava/lang/Runnable;)V",
|
||||
//#endif
|
||||
//$$ at = @At(value = "INVOKE", target = "Ljava/lang/Runnable;run()V", remap = false, shift = At.Shift.AFTER),
|
||||
//#if MC>=12102
|
||||
//$$ at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/RenderPhase$Target;startDrawing()V", shift = At.Shift.AFTER),
|
||||
//#else
|
||||
//$$ at = @At(value = "INVOKE", target = "Ljava/lang/Runnable;run()V", remap = false, shift = At.Shift.AFTER),
|
||||
//#endif
|
||||
//$$ cancellable = true)
|
||||
//#elseif MC>=11400 || 10710>=MC
|
||||
@Inject(method = "renderSky", at = @At("HEAD"), cancellable = true)
|
||||
@@ -43,7 +49,7 @@ public abstract class Mixin_ChromaKeyColorSky {
|
||||
if (color != null) {
|
||||
GlStateManager.clearColor(color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, 1);
|
||||
GlStateManager.clear(GL11.GL_COLOR_BUFFER_BIT
|
||||
//#if MC>=11400
|
||||
//#if MC>=11400 && MC<12102
|
||||
, false
|
||||
//#endif
|
||||
);
|
||||
|
||||
@@ -1,13 +1,20 @@
|
||||
package com.replaymod.render.mixin;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.replaymod.core.versions.MCVer;
|
||||
import com.replaymod.render.hooks.EntityRendererHandler;
|
||||
import net.minecraft.client.render.BackgroundRenderer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
|
||||
//#if MC>=12102
|
||||
//$$ import net.minecraft.client.render.Fog;
|
||||
//$$ import net.minecraft.client.render.FogShape;
|
||||
//$$ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
//#else
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
//#endif
|
||||
|
||||
@Mixin(BackgroundRenderer.class)
|
||||
public abstract class Mixin_ChromaKeyDisableFog {
|
||||
@@ -16,7 +23,13 @@ public abstract class Mixin_ChromaKeyDisableFog {
|
||||
//#if MC>=11500
|
||||
static
|
||||
//#endif
|
||||
void replayModRender_onSetupFog(CallbackInfo ci) {
|
||||
void replayModRender_onSetupFog(
|
||||
//#if MC>=12102
|
||||
//$$ CallbackInfoReturnable<Fog> ci
|
||||
//#else
|
||||
CallbackInfo ci
|
||||
//#endif
|
||||
) {
|
||||
EntityRendererHandler handler =
|
||||
((EntityRendererHandler.IEntityRenderer) MCVer.getMinecraft().gameRenderer).replayModRender_getHandler();
|
||||
if (handler == null) return;
|
||||
@@ -30,9 +43,13 @@ public abstract class Mixin_ChromaKeyDisableFog {
|
||||
// start, as would be the case in these cases. Sodium doing math is also the reason we don't set start
|
||||
// equal to end (that'll result in undefined behavior because it sticks those into a smoothstep on old
|
||||
// versions), and we don't set it to MAX_VALUE because that also gives wrong results.
|
||||
//#if MC>=12102
|
||||
//$$ ci.setReturnValue(new Fog(1E10F, 2E10F, FogShape.CYLINDER, 0f, 0f, 0f, 0f));
|
||||
//#else
|
||||
GlStateManager.fogStart(1E10F);
|
||||
GlStateManager.fogEnd(2E10F);
|
||||
ci.cancel();
|
||||
//#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,11 @@ public abstract class Mixin_PreserveDepthDuringGuiRendering {
|
||||
@ModifyArg(
|
||||
//#if MC>=11500
|
||||
method = "render",
|
||||
//#if MC>=12102
|
||||
//$$ at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;clear(I)V"), index = 0
|
||||
//#else
|
||||
at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;clear(IZ)V"), index = 0
|
||||
//#endif
|
||||
//#elseif MC>=11400
|
||||
//$$ method = "method_4493",
|
||||
//$$ at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/platform/GlStateManager;clear(IZ)V"), index = 0
|
||||
|
||||
@@ -16,7 +16,11 @@ public abstract class Mixin_PreserveDepthDuringHandRendering {
|
||||
//$$ method = "renderWorldPass",
|
||||
//#endif
|
||||
//#if MC>=11500
|
||||
//#if MC>=12102
|
||||
//$$ at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;clear(I)V"),
|
||||
//#else
|
||||
at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;clear(IZ)V"),
|
||||
//#endif
|
||||
//#elseif MC>=11400
|
||||
//$$ at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/platform/GlStateManager;clear(IZ)V", ordinal = 1),
|
||||
//#else
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(MinecraftClient.class)
|
||||
public class Mixin_SuppressFramebufferResizeDuringRender implements MinecraftClientExt {
|
||||
public abstract class Mixin_SuppressFramebufferResizeDuringRender implements MinecraftClientExt {
|
||||
|
||||
@Unique
|
||||
private VirtualWindow windowDelegate;
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.replaymod.render.mixin;
|
||||
|
||||
import com.replaymod.render.hooks.MinecraftClientExt;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gl.Framebuffer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(MinecraftClient.class)
|
||||
public abstract class Mixin_UseGuiFramebufferDuringGuiRendering implements MinecraftClientExt {
|
||||
|
||||
@Unique
|
||||
private Framebuffer framebufferDelegate;
|
||||
|
||||
@Override
|
||||
public void setFramebufferDelegate(Framebuffer framebuffer) {
|
||||
this.framebufferDelegate = framebuffer;
|
||||
}
|
||||
|
||||
@Inject(method = "getFramebuffer", at = @At("HEAD"), cancellable = true)
|
||||
private void useGuiFramebuffer(CallbackInfoReturnable<Framebuffer> ci) {
|
||||
Framebuffer delegate = this.framebufferDelegate;
|
||||
if (delegate != null) {
|
||||
ci.setReturnValue(delegate);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,6 +40,10 @@ import net.minecraft.util.crash.CrashException;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
//#if MC>=12102
|
||||
//$$ import com.mojang.blaze3d.systems.ProjectionType;
|
||||
//#endif
|
||||
|
||||
//#if MC>=12000
|
||||
//$$ import com.mojang.blaze3d.systems.VertexSorter;
|
||||
//$$ import net.minecraft.client.gui.DrawContext;
|
||||
@@ -492,7 +496,7 @@ public class VideoRenderer implements RenderInfo {
|
||||
|
||||
pushMatrix();
|
||||
GlStateManager.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT
|
||||
//#if MC>=11400
|
||||
//#if MC>=11400 && MC<12102
|
||||
, false
|
||||
//#endif
|
||||
);
|
||||
@@ -502,7 +506,11 @@ public class VideoRenderer implements RenderInfo {
|
||||
guiWindow.beginWrite();
|
||||
|
||||
//#if MC>=11500
|
||||
//#if MC>=12102
|
||||
//$$ RenderSystem.clear(256);
|
||||
//#else
|
||||
RenderSystem.clear(256, MinecraftClient.IS_SYSTEM_MAC);
|
||||
//#endif
|
||||
//#if MC>=11700
|
||||
//$$ RenderSystem.setProjectionMatrix(Matrix4f.projectionMatrix(
|
||||
//$$ 0,
|
||||
@@ -512,7 +520,9 @@ public class VideoRenderer implements RenderInfo {
|
||||
//$$ 1000,
|
||||
//$$ 3000
|
||||
//$$ )
|
||||
//#if MC>=12000
|
||||
//#if MC>=12102
|
||||
//$$ , ProjectionType.ORTHOGRAPHIC
|
||||
//#elseif MC>=12000
|
||||
//$$ , VertexSorter.BY_Z
|
||||
//#endif
|
||||
//$$ );
|
||||
@@ -524,7 +534,9 @@ public class VideoRenderer implements RenderInfo {
|
||||
//$$ matrixStack.loadIdentity();
|
||||
//$$ matrixStack.translate(0, 0, -2000);
|
||||
//#endif
|
||||
//#if MC<12102
|
||||
//$$ RenderSystem.applyModelViewMatrix();
|
||||
//#endif
|
||||
//$$ DiffuseLighting.enableGuiDepthLighting();
|
||||
//#else
|
||||
RenderSystem.matrixMode(GL11.GL_PROJECTION);
|
||||
|
||||
Reference in New Issue
Block a user