Port to 1.17-pre1
This commit is contained in:
@@ -63,7 +63,9 @@ public class BlendMeshBuilder
|
||||
}
|
||||
|
||||
@Override
|
||||
//#if MC>=10809
|
||||
//#if MC>=11700
|
||||
//$$ public void begin(VertexFormat.DrawMode mode, VertexFormat vertexFormat) {
|
||||
//#elseif MC>=10809
|
||||
public void begin(int mode, VertexFormat vertexFormat) {
|
||||
//#else
|
||||
//$$ public void startDrawing(int mode) {
|
||||
@@ -148,7 +150,17 @@ public class BlendMeshBuilder
|
||||
//#endif
|
||||
}
|
||||
|
||||
public static DMesh addBufferToMesh(ByteBuffer buffer, int mode, VertexFormat vertexFormat, DMesh mesh, ReadableVector3f vertOffset) {
|
||||
public static DMesh addBufferToMesh(
|
||||
ByteBuffer buffer,
|
||||
//#if MC>=11700
|
||||
//$$ VertexFormat.DrawMode mode,
|
||||
//#else
|
||||
int mode,
|
||||
//#endif
|
||||
VertexFormat vertexFormat,
|
||||
DMesh mesh,
|
||||
ReadableVector3f vertOffset
|
||||
) {
|
||||
//#if MC>=11400
|
||||
int vertexCount = buffer.remaining() / vertexFormat.getVertexSize();
|
||||
//#else
|
||||
@@ -157,7 +169,18 @@ public class BlendMeshBuilder
|
||||
return addBufferToMesh(buffer, vertexCount, mode, vertexFormat, mesh, vertOffset);
|
||||
}
|
||||
|
||||
public static DMesh addBufferToMesh(ByteBuffer buffer, int vertexCount, int mode, VertexFormat vertexFormat, DMesh mesh, ReadableVector3f vertOffset) {
|
||||
public static DMesh addBufferToMesh(
|
||||
ByteBuffer buffer,
|
||||
int vertexCount,
|
||||
//#if MC>=11700
|
||||
//$$ VertexFormat.DrawMode mode,
|
||||
//#else
|
||||
int mode,
|
||||
//#endif
|
||||
VertexFormat vertexFormat,
|
||||
DMesh mesh,
|
||||
ReadableVector3f vertOffset
|
||||
) {
|
||||
if (mesh == null) {
|
||||
mesh = new DMesh();
|
||||
}
|
||||
@@ -261,7 +284,11 @@ public class BlendMeshBuilder
|
||||
|
||||
// Bundle vertices into shapes and add them to the mesh
|
||||
switch (mode) {
|
||||
//#if MC>=11700
|
||||
//$$ case TRIANGLES:
|
||||
//#else
|
||||
case GL11.GL_TRIANGLES:
|
||||
//#endif
|
||||
for (int i = 0; i < vertices.size(); i+=3) {
|
||||
mesh.addTriangle(
|
||||
vertices.get(i ),
|
||||
@@ -277,7 +304,11 @@ public class BlendMeshBuilder
|
||||
);
|
||||
}
|
||||
break;
|
||||
//#if MC>=11700
|
||||
//$$ case QUADS:
|
||||
//#else
|
||||
case GL11.GL_QUADS:
|
||||
//#endif
|
||||
for (int i = 0; i < vertices.size(); i+=4) {
|
||||
mesh.addQuad(
|
||||
vertices.get(i ),
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.replaymod.render.blend.mixin.ParticleAccessor;
|
||||
import de.johni0702.minecraft.gui.utils.lwjgl.vector.Matrix4f;
|
||||
import de.johni0702.minecraft.gui.utils.lwjgl.vector.Vector3f;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
//#if MC>=11400
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
@@ -169,7 +170,7 @@ public class ParticlesExporter implements Exporter {
|
||||
builder.setReverseOffset(offset);
|
||||
builder.setWellBehaved(true);
|
||||
//#if MC>=10809
|
||||
builder.begin(7, VertexFormats.POSITION_TEXTURE_COLOR_LIGHT);
|
||||
builder.begin(GL11.GL_QUADS, VertexFormats.POSITION_TEXTURE_COLOR_LIGHT);
|
||||
//#else
|
||||
//$$ builder.startDrawingQuads();
|
||||
//#endif
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.replaymod.render.capturer;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.replaymod.render.rendering.Channel;
|
||||
import de.johni0702.minecraft.gui.utils.EventRegistrations;
|
||||
import com.replaymod.render.RenderSettings;
|
||||
@@ -15,12 +16,12 @@ import net.minecraft.util.crash.CrashReport;
|
||||
import net.minecraft.util.crash.CrashException;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import static com.mojang.blaze3d.platform.GlStateManager.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.replaymod.core.versions.MCVer.popMatrix;
|
||||
import static com.replaymod.core.versions.MCVer.pushMatrix;
|
||||
import static com.replaymod.core.versions.MCVer.resizeMainWindow;
|
||||
import static org.lwjgl.opengl.GL11.GL_COLOR_BUFFER_BIT;
|
||||
import static org.lwjgl.opengl.GL11.GL_DEPTH_BUFFER_BIT;
|
||||
@@ -170,12 +171,12 @@ public class ODSFrameCapturer implements FrameCapturer<ODSOpenGlFrame> {
|
||||
pushMatrix();
|
||||
frameBuffer().beginWrite(true);
|
||||
|
||||
clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT
|
||||
GlStateManager.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT
|
||||
//#if MC>=11400
|
||||
, false
|
||||
//#endif
|
||||
);
|
||||
enableTexture();
|
||||
GlStateManager.enableTexture();
|
||||
|
||||
directionVariable.set(captureData.ordinal());
|
||||
worldRenderer.renderWorld(partialTicks, null);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.replaymod.render.capturer;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.replaymod.core.versions.MCVer;
|
||||
import com.replaymod.render.frame.OpenGlFrame;
|
||||
import com.replaymod.render.rendering.Frame;
|
||||
@@ -16,12 +17,8 @@ import org.lwjgl.opengl.GL12;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
//#if MC>=10800
|
||||
import static com.mojang.blaze3d.platform.GlStateManager.*;
|
||||
//#else
|
||||
//$$ import static com.replaymod.core.versions.MCVer.GlStateManager.*;
|
||||
//#endif
|
||||
|
||||
import static com.replaymod.core.versions.MCVer.popMatrix;
|
||||
import static com.replaymod.core.versions.MCVer.pushMatrix;
|
||||
import static com.replaymod.core.versions.MCVer.resizeMainWindow;
|
||||
import static org.lwjgl.opengl.GL11.GL_COLOR_BUFFER_BIT;
|
||||
import static org.lwjgl.opengl.GL11.GL_DEPTH_BUFFER_BIT;
|
||||
@@ -86,12 +83,12 @@ public abstract class OpenGlFrameCapturer<F extends Frame, D extends CaptureData
|
||||
pushMatrix();
|
||||
frameBuffer().beginWrite(true);
|
||||
|
||||
clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT
|
||||
GlStateManager.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT
|
||||
//#if MC>=11400
|
||||
, false
|
||||
//#endif
|
||||
);
|
||||
enableTexture();
|
||||
GlStateManager.enableTexture();
|
||||
|
||||
worldRenderer.renderWorld(partialTicks, captureData);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//#if MC>=10800
|
||||
//#if MC>=10800 && MC<11700
|
||||
package com.replaymod.render.mixin;
|
||||
|
||||
import com.replaymod.render.hooks.FogStateCallback;
|
||||
|
||||
@@ -83,13 +83,15 @@ public abstract class Mixin_StabilizeCamera {
|
||||
//#endif
|
||||
RenderSettings settings = getHandler().getSettings();
|
||||
if (settings.isStabilizeYaw()) {
|
||||
entity.prevYaw = entity.yaw = 0;
|
||||
entity.prevYaw = 0;
|
||||
entity.yaw = 0;
|
||||
if (entity instanceof LivingEntity) {
|
||||
((LivingEntity) entity).prevHeadYaw = ((LivingEntity) entity).headYaw = 0;
|
||||
}
|
||||
}
|
||||
if (settings.isStabilizePitch()) {
|
||||
entity.prevPitch = entity.pitch = 0;
|
||||
entity.prevPitch = 0;
|
||||
entity.pitch = 0;
|
||||
}
|
||||
if (settings.isStabilizeRoll() && entity instanceof CameraEntity) {
|
||||
((CameraEntity) entity).roll = 0;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.replaymod.render.rendering;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.replaymod.core.mixin.MinecraftAccessor;
|
||||
import com.replaymod.core.mixin.TimerAccessor;
|
||||
import com.replaymod.core.utils.WrappedTimer;
|
||||
@@ -40,6 +41,12 @@ import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.client.render.RenderTickCounter;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
//#if MC>=11700
|
||||
//$$ import net.minecraft.client.gl.WindowFramebuffer;
|
||||
//$$ import net.minecraft.client.render.DiffuseLighting;
|
||||
//$$ import net.minecraft.util.math.Matrix4f;
|
||||
//#endif
|
||||
|
||||
//#if MC>=11600
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
//#endif
|
||||
@@ -59,10 +66,8 @@ import java.util.concurrent.CompletableFuture;
|
||||
//#endif
|
||||
|
||||
//#if MC>=10800
|
||||
import static com.mojang.blaze3d.platform.GlStateManager.*;
|
||||
//#else
|
||||
//$$ import com.replaymod.replay.gui.screen.GuiOpeningReplay;
|
||||
//$$ import static com.replaymod.core.versions.MCVer.GlStateManager.*;
|
||||
//#endif
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -360,11 +365,15 @@ public class VideoRenderer implements RenderInfo {
|
||||
forceChunkLoadingHook = new ForceChunkLoadingHook(mc.worldRenderer);
|
||||
|
||||
// Set up our own framebuffer to render the GUI to
|
||||
//#if MC>=11700
|
||||
//$$ guiFramebuffer = new WindowFramebuffer(displayWidth, displayHeight);
|
||||
//#else
|
||||
guiFramebuffer = new Framebuffer(displayWidth, displayHeight, true
|
||||
//#if MC>=11400
|
||||
, false
|
||||
//#endif
|
||||
);
|
||||
//#endif
|
||||
}
|
||||
|
||||
private void finish() {
|
||||
@@ -419,7 +428,7 @@ public class VideoRenderer implements RenderInfo {
|
||||
private void executeTaskQueue() {
|
||||
//#if MC>=11400
|
||||
while (true) {
|
||||
while (mc.overlay != null) {
|
||||
while (mc.getOverlay() != null) {
|
||||
drawGui();
|
||||
((MinecraftMethodAccessor) mc).replayModExecuteTaskQueue();
|
||||
}
|
||||
@@ -486,22 +495,38 @@ public class VideoRenderer implements RenderInfo {
|
||||
}
|
||||
|
||||
pushMatrix();
|
||||
clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT
|
||||
GlStateManager.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT
|
||||
//#if MC>=11400
|
||||
, false
|
||||
//#endif
|
||||
);
|
||||
enableTexture();
|
||||
GlStateManager.enableTexture();
|
||||
guiFramebuffer.beginWrite(true);
|
||||
|
||||
//#if MC>=11500
|
||||
RenderSystem.clear(256, MinecraftClient.IS_SYSTEM_MAC);
|
||||
//#if MC>=11700
|
||||
//$$ RenderSystem.setProjectionMatrix(Matrix4f.projectionMatrix(
|
||||
//$$ 0,
|
||||
//$$ (float) (window.getFramebufferWidth() / window.getScaleFactor()),
|
||||
//$$ 0,
|
||||
//$$ (float) (window.getFramebufferHeight() / window.getScaleFactor()),
|
||||
//$$ 1000,
|
||||
//$$ 3000
|
||||
//$$ ));
|
||||
//$$ MatrixStack matrixStack = RenderSystem.getModelViewStack();
|
||||
//$$ matrixStack.loadIdentity();
|
||||
//$$ matrixStack.translate(0, 0, -2000);
|
||||
//$$ RenderSystem.applyModelViewMatrix();
|
||||
//$$ DiffuseLighting.enableGuiDepthLighting();
|
||||
//#else
|
||||
RenderSystem.matrixMode(GL11.GL_PROJECTION);
|
||||
RenderSystem.loadIdentity();
|
||||
RenderSystem.ortho(0, window.getFramebufferWidth() / window.getScaleFactor(), window.getFramebufferHeight() / window.getScaleFactor(), 0, 1000, 3000);
|
||||
RenderSystem.matrixMode(GL11.GL_MODELVIEW);
|
||||
RenderSystem.loadIdentity();
|
||||
RenderSystem.translatef(0, 0, -2000);
|
||||
//#endif
|
||||
//#else
|
||||
//#if MC>=11400
|
||||
//$$ window.method_4493(
|
||||
@@ -535,11 +560,11 @@ public class VideoRenderer implements RenderInfo {
|
||||
int mouseX = (int) mc.mouse.getX() * window.getScaledWidth() / displayWidth;
|
||||
int mouseY = (int) mc.mouse.getY() * window.getScaledHeight() / displayHeight;
|
||||
|
||||
if (mc.overlay != null) {
|
||||
if (mc.getOverlay() != null) {
|
||||
Screen orgScreen = mc.currentScreen;
|
||||
try {
|
||||
mc.currentScreen = gui.toMinecraft();
|
||||
mc.overlay.render(
|
||||
mc.getOverlay().render(
|
||||
//#if MC>=11600
|
||||
new MatrixStack(),
|
||||
//#endif
|
||||
|
||||
Reference in New Issue
Block a user