Update to 1.21.5
This commit is contained in:
@@ -89,6 +89,7 @@ dependencies {
|
|||||||
12100 -> "0.100.3+1.21"
|
12100 -> "0.100.3+1.21"
|
||||||
12102 -> "0.106.1+1.21.2"
|
12102 -> "0.106.1+1.21.2"
|
||||||
12104 -> "0.111.0+1.21.4"
|
12104 -> "0.111.0+1.21.4"
|
||||||
|
12105 -> "0.119.9+1.21.5"
|
||||||
else -> throw UnsupportedOperationException()
|
else -> throw UnsupportedOperationException()
|
||||||
}
|
}
|
||||||
val fabricApiModules = mutableListOf(
|
val fabricApiModules = mutableListOf(
|
||||||
@@ -167,6 +168,7 @@ dependencies {
|
|||||||
|
|
||||||
if (platform.isFabric) {
|
if (platform.isFabric) {
|
||||||
val modMenuVersion = when {
|
val modMenuVersion = when {
|
||||||
|
mcVersion >= 12105 -> "14.0.0-rc.2"
|
||||||
mcVersion >= 12104 -> "13.0.0-beta.1"
|
mcVersion >= 12104 -> "13.0.0-beta.1"
|
||||||
mcVersion >= 12102 -> "12.0.0-beta.1"
|
mcVersion >= 12102 -> "12.0.0-beta.1"
|
||||||
mcVersion >= 12100 -> "11.0.0-rc.4"
|
mcVersion >= 12100 -> "11.0.0-rc.4"
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
essential.defaults.loom=0
|
essential.defaults.loom=0
|
||||||
essential.defaults.loom.fabric-loader=net.fabricmc:fabric-loader:0.16.9
|
essential.defaults.loom.fabric-loader=net.fabricmc:fabric-loader:0.16.12
|
||||||
|
|
||||||
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
|
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
|
||||||
# This is required to provide enough memory for the Minecraft decompilation process.
|
# This is required to provide enough memory for the Minecraft decompilation process.
|
||||||
org.gradle.jvmargs=-Xmx8G
|
org.gradle.jvmargs=-Xmx8G
|
||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
org.gradle.configureondemand=true
|
org.gradle.configureondemand=true
|
||||||
|
|
||||||
|
loom.ignoreDependencyLoomVersionValidation=true
|
||||||
|
|||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|||||||
2
jGui
2
jGui
Submodule jGui updated: bbce84072e...be4bf44276
Submodule libs/ReplayStudio updated: aa5ab3a302...d23e0ec824
@@ -3,6 +3,7 @@ import java.io.ByteArrayOutputStream
|
|||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("gg.essential.multi-version.root")
|
id("gg.essential.multi-version.root")
|
||||||
|
id("gg.essential.loom") version "1.7.28" apply false
|
||||||
id("com.github.hierynomus.license") version "0.15.0"
|
id("com.github.hierynomus.license") version "0.15.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,6 +204,7 @@ defaultTasks("bundleJar")
|
|||||||
preprocess {
|
preprocess {
|
||||||
strictExtraMappings.set(true)
|
strictExtraMappings.set(true)
|
||||||
|
|
||||||
|
val mc12105 = createNode("1.21.5", 12105, "yarn")
|
||||||
val mc12104 = createNode("1.21.4", 12104, "yarn")
|
val mc12104 = createNode("1.21.4", 12104, "yarn")
|
||||||
val mc12102 = createNode("1.21.2", 12102, "yarn")
|
val mc12102 = createNode("1.21.2", 12102, "yarn")
|
||||||
val mc12100 = createNode("1.21", 12100, "yarn")
|
val mc12100 = createNode("1.21", 12100, "yarn")
|
||||||
@@ -234,6 +236,7 @@ preprocess {
|
|||||||
val mc10800 = createNode("1.8", 10800, "srg")
|
val mc10800 = createNode("1.8", 10800, "srg")
|
||||||
val mc10710 = createNode("1.7.10", 10710, "srg")
|
val mc10710 = createNode("1.7.10", 10710, "srg")
|
||||||
|
|
||||||
|
mc12105.link(mc12104, file("versions/mapping-fabric-1.21.5-1.21.4.txt"))
|
||||||
mc12104.link(mc12102)
|
mc12104.link(mc12102)
|
||||||
mc12102.link(mc12100)
|
mc12102.link(mc12100)
|
||||||
mc12100.link(mc12006)
|
mc12100.link(mc12006)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ pluginManagement {
|
|||||||
maven("https://repo.essential.gg/repository/maven-public")
|
maven("https://repo.essential.gg/repository/maven-public")
|
||||||
}
|
}
|
||||||
plugins {
|
plugins {
|
||||||
id("gg.essential.multi-version.root") version "0.6.5"
|
id("gg.essential.multi-version.root") version "0.6.7"
|
||||||
id("io.github.goooler.shadow") version "8.1.7"
|
id("io.github.goooler.shadow") version "8.1.7"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -42,6 +42,7 @@ val jGuiVersions = listOf(
|
|||||||
"1.21",
|
"1.21",
|
||||||
"1.21.2",
|
"1.21.2",
|
||||||
"1.21.4",
|
"1.21.4",
|
||||||
|
"1.21.5",
|
||||||
)
|
)
|
||||||
val replayModVersions = listOf(
|
val replayModVersions = listOf(
|
||||||
// "1.7.10",
|
// "1.7.10",
|
||||||
@@ -74,6 +75,7 @@ val replayModVersions = listOf(
|
|||||||
"1.21",
|
"1.21",
|
||||||
"1.21.2",
|
"1.21.2",
|
||||||
"1.21.4",
|
"1.21.4",
|
||||||
|
"1.21.5",
|
||||||
)
|
)
|
||||||
|
|
||||||
rootProject.buildFileName = "root.gradle.kts"
|
rootProject.buildFileName = "root.gradle.kts"
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ import net.minecraft.util.Identifier;
|
|||||||
import net.minecraft.util.Util;
|
import net.minecraft.util.Util;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ import net.minecraft.client.render.VertexConsumer;
|
||||||
|
//#endif
|
||||||
|
|
||||||
//#if MC>=11700
|
//#if MC>=11700
|
||||||
//$$ import net.minecraft.util.math.Matrix4f;
|
//$$ import net.minecraft.util.math.Matrix4f;
|
||||||
//#endif
|
//#endif
|
||||||
@@ -440,11 +444,19 @@ public class MCVer {
|
|||||||
//$$ }
|
//$$ }
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ public static void emitLine(MatrixStack matrixStack, VertexConsumer buffer, Vector2f p1, Vector2f p2, int color) {
|
||||||
|
//#else
|
||||||
public static void emitLine(MatrixStack matrixStack, BufferBuilder buffer, Vector2f p1, Vector2f p2, int color) {
|
public static void emitLine(MatrixStack matrixStack, BufferBuilder buffer, Vector2f p1, Vector2f p2, int color) {
|
||||||
|
//#endif
|
||||||
emitLine(matrixStack, buffer, new Vector3f(p1.x, p1.y, 0), new Vector3f(p2.x, p2.y, 0), color);
|
emitLine(matrixStack, buffer, new Vector3f(p1.x, p1.y, 0), new Vector3f(p2.x, p2.y, 0), color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ public static void emitLine(MatrixStack matrixStack, VertexConsumer buffer, Vector3f p1, Vector3f p2, int color) {
|
||||||
|
//#else
|
||||||
public static void emitLine(MatrixStack matrixStack, BufferBuilder buffer, Vector3f p1, Vector3f p2, int color) {
|
public static void emitLine(MatrixStack matrixStack, BufferBuilder buffer, Vector3f p1, Vector3f p2, int color) {
|
||||||
|
//#endif
|
||||||
int r = color >> 24 & 0xff;
|
int r = color >> 24 & 0xff;
|
||||||
int g = color >> 16 & 0xff;
|
int g = color >> 16 & 0xff;
|
||||||
int b = color >> 8 & 0xff;
|
int b = color >> 8 & 0xff;
|
||||||
|
|||||||
@@ -35,7 +35,11 @@ public abstract class MixinServerInfo implements ServerInfoExt {
|
|||||||
private static void deserialize(CompoundTag tag, CallbackInfoReturnable<ServerInfo> ci) {
|
private static void deserialize(CompoundTag tag, CallbackInfoReturnable<ServerInfo> ci) {
|
||||||
ServerInfoExt serverInfo = ServerInfoExt.from(ci.getReturnValue());
|
ServerInfoExt serverInfo = ServerInfoExt.from(ci.getReturnValue());
|
||||||
if (tag.contains("autoRecording")) {
|
if (tag.contains("autoRecording")) {
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ serverInfo.setAutoRecording(tag.getBoolean("autoRecording").orElseThrow());
|
||||||
|
//#else
|
||||||
serverInfo.setAutoRecording(tag.getBoolean("autoRecording"));
|
serverInfo.setAutoRecording(tag.getBoolean("autoRecording"));
|
||||||
|
//#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ import org.spongepowered.asm.mixin.injection.At;
|
|||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ import net.minecraft.entity.Entity;
|
||||||
|
//#endif
|
||||||
|
|
||||||
//#if MC>=11802
|
//#if MC>=11802
|
||||||
//$$ import net.minecraft.util.registry.RegistryEntry;
|
//$$ import net.minecraft.util.registry.RegistryEntry;
|
||||||
//#endif
|
//#endif
|
||||||
@@ -51,7 +55,10 @@ public abstract class MixinWorldClient extends World implements RecordingEventHa
|
|||||||
// but are instead played directly by the client. The server only sends these sounds to
|
// but are instead played directly by the client. The server only sends these sounds to
|
||||||
// other clients so we have to record them manually.
|
// other clients so we have to record them manually.
|
||||||
// E.g. Block place sounds
|
// E.g. Block place sounds
|
||||||
//#if MC>=11903
|
//#if MC>=12105
|
||||||
|
//$$ @Inject(method = "playSound(Lnet/minecraft/entity/Entity;DDDLnet/minecraft/registry/entry/RegistryEntry;Lnet/minecraft/sound/SoundCategory;FFJ)V",
|
||||||
|
//$$ at = @At("HEAD"))
|
||||||
|
//#elseif MC>=11903
|
||||||
//$$ @Inject(method = "playSound(Lnet/minecraft/entity/player/PlayerEntity;DDDLnet/minecraft/registry/entry/RegistryEntry;Lnet/minecraft/sound/SoundCategory;FFJ)V",
|
//$$ @Inject(method = "playSound(Lnet/minecraft/entity/player/PlayerEntity;DDDLnet/minecraft/registry/entry/RegistryEntry;Lnet/minecraft/sound/SoundCategory;FFJ)V",
|
||||||
//$$ at = @At("HEAD"))
|
//$$ at = @At("HEAD"))
|
||||||
//#elseif MC>=11900
|
//#elseif MC>=11900
|
||||||
@@ -70,7 +77,12 @@ public abstract class MixinWorldClient extends World implements RecordingEventHa
|
|||||||
//$$ at = @At("HEAD"))
|
//$$ at = @At("HEAD"))
|
||||||
//#endif
|
//#endif
|
||||||
public void replayModRecording_recordClientSound(
|
public void replayModRecording_recordClientSound(
|
||||||
PlayerEntity player, double x, double y, double z,
|
//#if MC>=12105
|
||||||
|
//$$ Entity player,
|
||||||
|
//#else
|
||||||
|
PlayerEntity player,
|
||||||
|
//#endif
|
||||||
|
double x, double y, double z,
|
||||||
//#if MC>=11903
|
//#if MC>=11903
|
||||||
//$$ RegistryEntry<SoundEvent> sound,
|
//$$ RegistryEntry<SoundEvent> sound,
|
||||||
//#else
|
//#else
|
||||||
@@ -103,7 +115,14 @@ public abstract class MixinWorldClient extends World implements RecordingEventHa
|
|||||||
//#else
|
//#else
|
||||||
//$$ @Inject(method = "playLevelEvent", at = @At("HEAD"))
|
//$$ @Inject(method = "playLevelEvent", at = @At("HEAD"))
|
||||||
//#endif
|
//#endif
|
||||||
private void playLevelEvent (PlayerEntity player, int type, BlockPos pos, int data, CallbackInfo ci) {
|
private void playLevelEvent(
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ Entity player,
|
||||||
|
//#else
|
||||||
|
PlayerEntity player,
|
||||||
|
//#endif
|
||||||
|
int type, BlockPos pos, int data, CallbackInfo ci
|
||||||
|
) {
|
||||||
//#else
|
//#else
|
||||||
//$$ // These are handled in the World class, so we override the method in WorldClient and add our special handling.
|
//$$ // These are handled in the World class, so we override the method in WorldClient and add our special handling.
|
||||||
//$$ @Override
|
//$$ @Override
|
||||||
|
|||||||
@@ -23,6 +23,13 @@ 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_COLOR_BUFFER_BIT;
|
||||||
import static org.lwjgl.opengl.GL11.GL_DEPTH_BUFFER_BIT;
|
import static org.lwjgl.opengl.GL11.GL_DEPTH_BUFFER_BIT;
|
||||||
|
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ import com.mojang.blaze3d.buffers.BufferType;
|
||||||
|
//$$ import com.mojang.blaze3d.buffers.BufferUsage;
|
||||||
|
//$$ import com.mojang.blaze3d.buffers.GpuBuffer;
|
||||||
|
//$$ import com.mojang.blaze3d.systems.GpuDevice;
|
||||||
|
//#endif
|
||||||
|
|
||||||
public abstract class OpenGlFrameCapturer<F extends Frame, D extends CaptureData> implements FrameCapturer<F> {
|
public abstract class OpenGlFrameCapturer<F extends Frame, D extends CaptureData> implements FrameCapturer<F> {
|
||||||
protected final WorldRenderer worldRenderer;
|
protected final WorldRenderer worldRenderer;
|
||||||
protected final RenderInfo renderInfo;
|
protected final RenderInfo renderInfo;
|
||||||
@@ -81,20 +88,30 @@ public abstract class OpenGlFrameCapturer<F extends Frame, D extends CaptureData
|
|||||||
resizeMainWindow(mc, getFrameWidth(), getFrameHeight());
|
resizeMainWindow(mc, getFrameWidth(), getFrameHeight());
|
||||||
|
|
||||||
pushMatrix();
|
pushMatrix();
|
||||||
|
//#if MC<12105
|
||||||
frameBuffer().beginWrite(true);
|
frameBuffer().beginWrite(true);
|
||||||
|
//#endif
|
||||||
|
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ RenderSystem.getDevice()
|
||||||
|
//$$ .createCommandEncoder()
|
||||||
|
//$$ .clearColorAndDepthTextures(mc.getFramebuffer().getColorAttachment(), 0, mc.getFramebuffer().getDepthAttachment(), 1);
|
||||||
|
//#else
|
||||||
GlStateManager.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT
|
GlStateManager.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT
|
||||||
//#if MC>=11400 && MC<12102
|
//#if MC>=11400 && MC<12102
|
||||||
, false
|
, false
|
||||||
//#endif
|
//#endif
|
||||||
);
|
);
|
||||||
|
//#endif
|
||||||
//#if MC<11904
|
//#if MC<11904
|
||||||
GlStateManager.enableTexture();
|
GlStateManager.enableTexture();
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
worldRenderer.renderWorld(partialTicks, captureData);
|
worldRenderer.renderWorld(partialTicks, captureData);
|
||||||
|
|
||||||
|
//#if MC<12105
|
||||||
frameBuffer().endWrite();
|
frameBuffer().endWrite();
|
||||||
|
//#endif
|
||||||
popMatrix();
|
popMatrix();
|
||||||
|
|
||||||
return captureFrame(frameId, captureData);
|
return captureFrame(frameId, captureData);
|
||||||
@@ -102,9 +119,19 @@ public abstract class OpenGlFrameCapturer<F extends Frame, D extends CaptureData
|
|||||||
|
|
||||||
protected OpenGlFrame captureFrame(int frameId, D captureData) {
|
protected OpenGlFrame captureFrame(int frameId, D captureData) {
|
||||||
ByteBuffer buffer = ByteBufferPool.allocate(getFrameWidth() * getFrameHeight() * 4);
|
ByteBuffer buffer = ByteBufferPool.allocate(getFrameWidth() * getFrameHeight() * 4);
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ GpuDevice device = RenderSystem.getDevice();
|
||||||
|
//$$ try (GpuBuffer gpuBuffer = device.createBuffer(null, BufferType.PIXEL_PACK, BufferUsage.STATIC_READ, getFrameWidth() * getFrameHeight() * 4)) {
|
||||||
|
//$$ device.createCommandEncoder().copyTextureToBuffer(frameBuffer().getColorAttachment(), gpuBuffer, 0, () -> {}, 0);
|
||||||
|
//$$ try (GpuBuffer.ReadView view = device.createCommandEncoder().readBuffer(gpuBuffer)) {
|
||||||
|
//$$ buffer.put(view.data());
|
||||||
|
//$$ }
|
||||||
|
//$$ }
|
||||||
|
//#else
|
||||||
frameBuffer().beginWrite(true);
|
frameBuffer().beginWrite(true);
|
||||||
GL11.glReadPixels(0, 0, getFrameWidth(), getFrameHeight(), GL12.GL_BGRA, GL11.GL_UNSIGNED_BYTE, buffer);
|
GL11.glReadPixels(0, 0, getFrameWidth(), getFrameHeight(), GL12.GL_BGRA, GL11.GL_UNSIGNED_BYTE, buffer);
|
||||||
frameBuffer().endWrite();
|
frameBuffer().endWrite();
|
||||||
|
//#endif
|
||||||
buffer.rewind();
|
buffer.rewind();
|
||||||
|
|
||||||
return new OpenGlFrame(frameId, new Dimension(getFrameWidth(), getFrameHeight()), 4, buffer);
|
return new OpenGlFrame(frameId, new Dimension(getFrameWidth(), getFrameHeight()), 4, buffer);
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.replaymod.render.capturer;
|
package com.replaymod.render.capturer;
|
||||||
|
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
|
||||||
import com.replaymod.render.frame.OpenGlFrame;
|
import com.replaymod.render.frame.OpenGlFrame;
|
||||||
import com.replaymod.render.rendering.Channel;
|
import com.replaymod.render.rendering.Channel;
|
||||||
import com.replaymod.render.rendering.Frame;
|
import com.replaymod.render.rendering.Frame;
|
||||||
@@ -14,11 +13,24 @@ import java.nio.ByteBuffer;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ import com.mojang.blaze3d.buffers.BufferType;
|
||||||
|
//$$ import com.mojang.blaze3d.buffers.BufferUsage;
|
||||||
|
//$$ import com.mojang.blaze3d.buffers.GpuBuffer;
|
||||||
|
//$$ import com.mojang.blaze3d.systems.CommandEncoder;
|
||||||
|
//$$ import com.mojang.blaze3d.systems.GpuDevice;
|
||||||
|
//$$ import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
|
//#endif
|
||||||
|
|
||||||
public abstract class PboOpenGlFrameCapturer<F extends Frame, D extends Enum<D> & CaptureData>
|
public abstract class PboOpenGlFrameCapturer<F extends Frame, D extends Enum<D> & CaptureData>
|
||||||
extends OpenGlFrameCapturer<F, D> {
|
extends OpenGlFrameCapturer<F, D> {
|
||||||
private final boolean withDepth;
|
private final boolean withDepth;
|
||||||
private final D[] data;
|
private final D[] data;
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ private GpuBuffer pbo, otherPBO;
|
||||||
|
//#else
|
||||||
private PixelBufferObject pbo, otherPBO;
|
private PixelBufferObject pbo, otherPBO;
|
||||||
|
//#endif
|
||||||
|
|
||||||
public PboOpenGlFrameCapturer(WorldRenderer worldRenderer, RenderInfo renderInfo, Class<D> type, int framePixels) {
|
public PboOpenGlFrameCapturer(WorldRenderer worldRenderer, RenderInfo renderInfo, Class<D> type, int framePixels) {
|
||||||
super(worldRenderer, renderInfo);
|
super(worldRenderer, renderInfo);
|
||||||
@@ -26,14 +38,23 @@ public abstract class PboOpenGlFrameCapturer<F extends Frame, D extends Enum<D>
|
|||||||
withDepth = renderInfo.getRenderSettings().isDepthMap();
|
withDepth = renderInfo.getRenderSettings().isDepthMap();
|
||||||
data = type.getEnumConstants();
|
data = type.getEnumConstants();
|
||||||
int bufferSize = framePixels * (4 /* bgra */ + (withDepth ? 4 /* float */ : 0)) * data.length;
|
int bufferSize = framePixels * (4 /* bgra */ + (withDepth ? 4 /* float */ : 0)) * data.length;
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ pbo = RenderSystem.getDevice().createBuffer(null, BufferType.PIXEL_PACK, BufferUsage.STREAM_READ, bufferSize);
|
||||||
|
//$$ otherPBO = RenderSystem.getDevice().createBuffer(null, BufferType.PIXEL_PACK, BufferUsage.STREAM_READ, bufferSize);
|
||||||
|
//#else
|
||||||
pbo = new PixelBufferObject(bufferSize, PixelBufferObject.Usage.READ);
|
pbo = new PixelBufferObject(bufferSize, PixelBufferObject.Usage.READ);
|
||||||
otherPBO = new PixelBufferObject(bufferSize, PixelBufferObject.Usage.READ);
|
otherPBO = new PixelBufferObject(bufferSize, PixelBufferObject.Usage.READ);
|
||||||
|
//#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract F create(OpenGlFrame[] from);
|
protected abstract F create(OpenGlFrame[] from);
|
||||||
|
|
||||||
private void swapPBOs() {
|
private void swapPBOs() {
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ GpuBuffer old = pbo;
|
||||||
|
//#else
|
||||||
PixelBufferObject old = pbo;
|
PixelBufferObject old = pbo;
|
||||||
|
//#endif
|
||||||
pbo = otherPBO;
|
pbo = otherPBO;
|
||||||
otherPBO = old;
|
otherPBO = old;
|
||||||
}
|
}
|
||||||
@@ -43,13 +64,26 @@ public abstract class PboOpenGlFrameCapturer<F extends Frame, D extends Enum<D>
|
|||||||
return framesDone >= renderInfo.getTotalFrames() + 2;
|
return framesDone >= renderInfo.getTotalFrames() + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
private F readFromPbo(ByteBuffer pboBuffer, int bytesPerPixel) {
|
private F readFromPbo(ByteBuffer pboBuffer, int bytesPerPixel, boolean swapRB) {
|
||||||
OpenGlFrame[] frames = new OpenGlFrame[data.length];
|
OpenGlFrame[] frames = new OpenGlFrame[data.length];
|
||||||
int frameBufferSize = getFrameWidth() * getFrameHeight() * bytesPerPixel;
|
int frameBufferSize = getFrameWidth() * getFrameHeight() * bytesPerPixel;
|
||||||
for (int i = 0; i < frames.length; i++) {
|
for (int i = 0; i < frames.length; i++) {
|
||||||
ByteBuffer frameBuffer = ByteBufferPool.allocate(frameBufferSize);
|
ByteBuffer frameBuffer = ByteBufferPool.allocate(frameBufferSize);
|
||||||
pboBuffer.limit(pboBuffer.position() + frameBufferSize);
|
pboBuffer.limit(pboBuffer.position() + frameBufferSize);
|
||||||
|
if (swapRB) {
|
||||||
|
for (int j = 0; j < frameBufferSize; j += 4) {
|
||||||
|
byte r = pboBuffer.get();
|
||||||
|
byte g = pboBuffer.get();
|
||||||
|
byte b = pboBuffer.get();
|
||||||
|
byte a = pboBuffer.get();
|
||||||
|
frameBuffer.put(b);
|
||||||
|
frameBuffer.put(g);
|
||||||
|
frameBuffer.put(r);
|
||||||
|
frameBuffer.put(a);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
frameBuffer.put(pboBuffer);
|
frameBuffer.put(pboBuffer);
|
||||||
|
}
|
||||||
frameBuffer.rewind();
|
frameBuffer.rewind();
|
||||||
frames[i] = new OpenGlFrame(framesDone - 2, frameSize, bytesPerPixel, frameBuffer);
|
frames[i] = new OpenGlFrame(framesDone - 2, frameSize, bytesPerPixel, frameBuffer);
|
||||||
}
|
}
|
||||||
@@ -62,17 +96,27 @@ public abstract class PboOpenGlFrameCapturer<F extends Frame, D extends Enum<D>
|
|||||||
|
|
||||||
if (framesDone > 1) {
|
if (framesDone > 1) {
|
||||||
// Read pbo to memory
|
// Read pbo to memory
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ try (GpuBuffer.ReadView view = RenderSystem.getDevice().createCommandEncoder().readBuffer(pbo)) {
|
||||||
|
//$$ channels = new HashMap<>();
|
||||||
|
//$$ channels.put(Channel.BRGA, readFromPbo(view.data(), 4, true));
|
||||||
|
//$$ if (withDepth) {
|
||||||
|
//$$ channels.put(Channel.DEPTH, readFromPbo(view.data(), 4, false));
|
||||||
|
//$$ }
|
||||||
|
//$$ }
|
||||||
|
//#else
|
||||||
pbo.bind();
|
pbo.bind();
|
||||||
ByteBuffer pboBuffer = pbo.mapReadOnly();
|
ByteBuffer pboBuffer = pbo.mapReadOnly();
|
||||||
|
|
||||||
channels = new HashMap<>();
|
channels = new HashMap<>();
|
||||||
channels.put(Channel.BRGA, readFromPbo(pboBuffer, 4));
|
channels.put(Channel.BRGA, readFromPbo(pboBuffer, 4, false));
|
||||||
if (withDepth) {
|
if (withDepth) {
|
||||||
channels.put(Channel.DEPTH, readFromPbo(pboBuffer, 4));
|
channels.put(Channel.DEPTH, readFromPbo(pboBuffer, 4, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
pbo.unmap();
|
pbo.unmap();
|
||||||
pbo.unbind();
|
pbo.unbind();
|
||||||
|
//#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (framesDone < renderInfo.getTotalFrames()) {
|
if (framesDone < renderInfo.getTotalFrames()) {
|
||||||
@@ -90,6 +134,15 @@ public abstract class PboOpenGlFrameCapturer<F extends Frame, D extends Enum<D>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected OpenGlFrame captureFrame(int frameId, D captureData) {
|
protected OpenGlFrame captureFrame(int frameId, D captureData) {
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ int offset = captureData.ordinal() * getFrameWidth() * getFrameHeight() * 4;
|
||||||
|
//$$ CommandEncoder cmd = RenderSystem.getDevice().createCommandEncoder();
|
||||||
|
//$$ cmd.copyTextureToBuffer(frameBuffer().getColorAttachment(), pbo, offset, () -> {}, 0);
|
||||||
|
//$$ if (withDepth) {
|
||||||
|
//$$ offset += data.length * getFrameWidth() * getFrameHeight() * 4;
|
||||||
|
//$$ cmd.copyTextureToBuffer(frameBuffer().getDepthAttachment(), pbo, offset, () -> {}, 0);
|
||||||
|
//$$ }
|
||||||
|
//#else
|
||||||
pbo.bind();
|
pbo.bind();
|
||||||
|
|
||||||
int offset = captureData.ordinal() * getFrameWidth() * getFrameHeight() * 4;
|
int offset = captureData.ordinal() * getFrameWidth() * getFrameHeight() * 4;
|
||||||
@@ -102,13 +155,14 @@ public abstract class PboOpenGlFrameCapturer<F extends Frame, D extends Enum<D>
|
|||||||
frameBuffer().endWrite();
|
frameBuffer().endWrite();
|
||||||
|
|
||||||
pbo.unbind();
|
pbo.unbind();
|
||||||
|
//#endif
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
super.close();
|
super.close();
|
||||||
pbo.delete();
|
pbo.close();
|
||||||
otherPBO.delete();
|
otherPBO.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -240,7 +240,9 @@ public class GuiVideoRenderer extends GuiScreen implements Tickable {
|
|||||||
final int videoHeight = videoSize.getHeight();
|
final int videoHeight = videoSize.getHeight();
|
||||||
|
|
||||||
if (previewTexture == null) {
|
if (previewTexture == null) {
|
||||||
//#if MC>=11400
|
//#if MC>=12105
|
||||||
|
//$$ previewTexture = new NativeImageBackedTexture((String) null, videoWidth, videoHeight, true);
|
||||||
|
//#elseif MC>=11400
|
||||||
previewTexture = new NativeImageBackedTexture(videoWidth, videoHeight, true);
|
previewTexture = new NativeImageBackedTexture(videoWidth, videoHeight, true);
|
||||||
//#else
|
//#else
|
||||||
//$$ previewTexture = new DynamicTexture(videoWidth, videoHeight);
|
//$$ previewTexture = new DynamicTexture(videoWidth, videoHeight);
|
||||||
@@ -252,7 +254,11 @@ public class GuiVideoRenderer extends GuiScreen implements Tickable {
|
|||||||
previewTextureDirty = false;
|
previewTextureDirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ guiRenderer.bindTexture(previewTexture.getGlTexture());
|
||||||
|
//#else
|
||||||
guiRenderer.bindTexture(previewTexture.getGlId());
|
guiRenderer.bindTexture(previewTexture.getGlId());
|
||||||
|
//#endif
|
||||||
renderPreviewTexture(guiRenderer, size, videoWidth, videoHeight);
|
renderPreviewTexture(guiRenderer, size, videoWidth, videoHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,16 +69,24 @@ public class VirtualWindow implements Closeable {
|
|||||||
|
|
||||||
public void beginWrite() {
|
public void beginWrite() {
|
||||||
MinecraftClientExt.get(mc).setFramebufferDelegate(guiFramebuffer);
|
MinecraftClientExt.get(mc).setFramebufferDelegate(guiFramebuffer);
|
||||||
|
//#if MC<12105
|
||||||
guiFramebuffer.beginWrite(true);
|
guiFramebuffer.beginWrite(true);
|
||||||
|
//#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public void endWrite() {
|
public void endWrite() {
|
||||||
|
//#if MC<12105
|
||||||
guiFramebuffer.endWrite();
|
guiFramebuffer.endWrite();
|
||||||
|
//#endif
|
||||||
MinecraftClientExt.get(mc).setFramebufferDelegate(null);
|
MinecraftClientExt.get(mc).setFramebufferDelegate(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void flip() {
|
public void flip() {
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ guiFramebuffer.blitToScreen();
|
||||||
|
//#else
|
||||||
guiFramebuffer.draw(framebufferWidth, framebufferHeight);
|
guiFramebuffer.draw(framebufferWidth, framebufferHeight);
|
||||||
|
//#endif
|
||||||
|
|
||||||
//#if MC>=12102
|
//#if MC>=12102
|
||||||
//$$ window.swapBuffers(null);
|
//$$ window.swapBuffers(null);
|
||||||
|
|||||||
@@ -21,6 +21,12 @@ import java.util.concurrent.locks.Condition;
|
|||||||
import java.util.concurrent.locks.Lock;
|
import java.util.concurrent.locks.Lock;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
|
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ import org.spongepowered.asm.mixin.Mutable;
|
||||||
|
//$$ import java.util.AbstractQueue;
|
||||||
|
//$$ import java.util.Iterator;
|
||||||
|
//#endif
|
||||||
|
|
||||||
//#if MC>=12102
|
//#if MC>=12102
|
||||||
//$$ import net.minecraft.util.thread.SimpleConsecutiveExecutor;
|
//$$ import net.minecraft.util.thread.SimpleConsecutiveExecutor;
|
||||||
//#endif
|
//#endif
|
||||||
@@ -68,6 +74,9 @@ public abstract class Mixin_BlockOnChunkRebuilds implements ForceChunkLoadingHoo
|
|||||||
|
|
||||||
@Shadow protected abstract void scheduleRunTasks();
|
@Shadow protected abstract void scheduleRunTasks();
|
||||||
|
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ @Mutable
|
||||||
|
//#endif
|
||||||
@Shadow @Final private Queue<Runnable> uploadQueue;
|
@Shadow @Final private Queue<Runnable> uploadQueue;
|
||||||
private final Lock waitingForWorkLock = new ReentrantLock();
|
private final Lock waitingForWorkLock = new ReentrantLock();
|
||||||
private final Condition newWork = waitingForWorkLock.newCondition();
|
private final Condition newWork = waitingForWorkLock.newCondition();
|
||||||
@@ -96,6 +105,29 @@ public abstract class Mixin_BlockOnChunkRebuilds implements ForceChunkLoadingHoo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ @Inject(method = "<init>", at = @At("RETURN"))
|
||||||
|
//$$ private void notifyMainThreadOfNewUpload(CallbackInfo ci) {
|
||||||
|
//$$ Queue<Runnable> inner = this.uploadQueue;
|
||||||
|
//$$ this.uploadQueue = new AbstractQueue<>() {
|
||||||
|
//$$ @Override
|
||||||
|
//$$ public boolean offer(Runnable runnable) {
|
||||||
|
//$$ boolean result = inner.offer(runnable);
|
||||||
|
//$$ waitingForWorkLock.lock();
|
||||||
|
//$$ try {
|
||||||
|
//$$ newWork.signal();
|
||||||
|
//$$ } finally {
|
||||||
|
//$$ waitingForWorkLock.unlock();
|
||||||
|
//$$ }
|
||||||
|
//$$ return result;
|
||||||
|
//$$ }
|
||||||
|
//$$ @Override public Runnable poll() { return inner.poll(); }
|
||||||
|
//$$ @Override public Runnable peek() { return inner.peek(); }
|
||||||
|
//$$ @Override public int size() { return inner.size(); }
|
||||||
|
//$$ @Override public Iterator<Runnable> iterator() { return inner.iterator(); }
|
||||||
|
//$$ };
|
||||||
|
//$$ }
|
||||||
|
//#else
|
||||||
@Inject(method = "scheduleUpload", at = @At("RETURN"))
|
@Inject(method = "scheduleUpload", at = @At("RETURN"))
|
||||||
private void notifyMainThreadOfNewUpload(CallbackInfoReturnable<CompletableFuture<Void>> ci) {
|
private void notifyMainThreadOfNewUpload(CallbackInfoReturnable<CompletableFuture<Void>> ci) {
|
||||||
this.waitingForWorkLock.lock();
|
this.waitingForWorkLock.lock();
|
||||||
@@ -105,6 +137,7 @@ public abstract class Mixin_BlockOnChunkRebuilds implements ForceChunkLoadingHoo
|
|||||||
this.waitingForWorkLock.unlock();
|
this.waitingForWorkLock.unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//#endif
|
||||||
|
|
||||||
private boolean waitForMainThreadWork() {
|
private boolean waitForMainThreadWork() {
|
||||||
//#if MC>=12102
|
//#if MC>=12102
|
||||||
@@ -125,6 +158,7 @@ public abstract class Mixin_BlockOnChunkRebuilds implements ForceChunkLoadingHoo
|
|||||||
this.waitingForWorkLock.lock();
|
this.waitingForWorkLock.lock();
|
||||||
try {
|
try {
|
||||||
while (true) {
|
while (true) {
|
||||||
|
//#if MC<11900
|
||||||
// Now, what is this call doing here you might be wondering. Well, from a quick look over everything
|
// Now, what is this call doing here you might be wondering. Well, from a quick look over everything
|
||||||
// it does not look like it would be required but have a **very** close look at [scheduleUpload]:
|
// it does not look like it would be required but have a **very** close look at [scheduleUpload]:
|
||||||
// It is not actually guaranteed to run the upload on the main thread, it just looks like it (and
|
// It is not actually guaranteed to run the upload on the main thread, it just looks like it (and
|
||||||
@@ -138,6 +172,7 @@ public abstract class Mixin_BlockOnChunkRebuilds implements ForceChunkLoadingHoo
|
|||||||
// dead-lock ourselves here (since the upload queue is already empty), if we did never do this call
|
// dead-lock ourselves here (since the upload queue is already empty), if we did never do this call
|
||||||
// to run the upload scheduled via this particular path of code execution.
|
// to run the upload scheduled via this particular path of code execution.
|
||||||
RenderSystem.replayQueue();
|
RenderSystem.replayQueue();
|
||||||
|
//#endif
|
||||||
|
|
||||||
if (this.allDone) {
|
if (this.allDone) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -49,12 +49,19 @@ public abstract class Mixin_ChromaKeyColorSky {
|
|||||||
if (handler != null) {
|
if (handler != null) {
|
||||||
ReadableColor color = handler.getSettings().getChromaKeyingColor();
|
ReadableColor color = handler.getSettings().getChromaKeyingColor();
|
||||||
if (color != null) {
|
if (color != null) {
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ RenderSystem.getDevice().createCommandEncoder().clearColorTexture(
|
||||||
|
//$$ this.client.getFramebuffer().getColorAttachment(),
|
||||||
|
//$$ (0xff << 24) | (color.getRed() << 16) | (color.getGreen() << 8) | color.getBlue()
|
||||||
|
//$$ );
|
||||||
|
//#else
|
||||||
GlStateManager.clearColor(color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, 1);
|
GlStateManager.clearColor(color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, 1);
|
||||||
GlStateManager.clear(GL11.GL_COLOR_BUFFER_BIT
|
GlStateManager.clear(GL11.GL_COLOR_BUFFER_BIT
|
||||||
//#if MC>=11400 && MC<12102
|
//#if MC>=11400 && MC<12102
|
||||||
, false
|
, false
|
||||||
//#endif
|
//#endif
|
||||||
);
|
);
|
||||||
|
//#endif
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -495,22 +495,34 @@ public class VideoRenderer implements RenderInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pushMatrix();
|
pushMatrix();
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ RenderSystem.getDevice()
|
||||||
|
//$$ .createCommandEncoder()
|
||||||
|
//$$ .clearColorAndDepthTextures(mc.getFramebuffer().getColorAttachment(), 0, mc.getFramebuffer().getDepthAttachment(), 1);
|
||||||
|
//#else
|
||||||
GlStateManager.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT
|
GlStateManager.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT
|
||||||
//#if MC>=11400 && MC<12102
|
//#if MC>=11400 && MC<12102
|
||||||
, false
|
, false
|
||||||
//#endif
|
//#endif
|
||||||
);
|
);
|
||||||
|
//#endif
|
||||||
//#if MC<11904
|
//#if MC<11904
|
||||||
GlStateManager.enableTexture();
|
GlStateManager.enableTexture();
|
||||||
//#endif
|
//#endif
|
||||||
guiWindow.beginWrite();
|
guiWindow.beginWrite();
|
||||||
|
|
||||||
//#if MC>=11500
|
//#if MC>=11500
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ RenderSystem.getDevice()
|
||||||
|
//$$ .createCommandEncoder()
|
||||||
|
//$$ .clearColorAndDepthTextures(mc.getFramebuffer().getColorAttachment(), 0, mc.getFramebuffer().getDepthAttachment(), 1);
|
||||||
|
//#else
|
||||||
//#if MC>=12102
|
//#if MC>=12102
|
||||||
//$$ RenderSystem.clear(256);
|
//$$ RenderSystem.clear(256);
|
||||||
//#else
|
//#else
|
||||||
RenderSystem.clear(256, MinecraftClient.IS_SYSTEM_MAC);
|
RenderSystem.clear(256, MinecraftClient.IS_SYSTEM_MAC);
|
||||||
//#endif
|
//#endif
|
||||||
|
//#endif
|
||||||
//#if MC>=11700
|
//#if MC>=11700
|
||||||
//$$ RenderSystem.setProjectionMatrix(Matrix4f.projectionMatrix(
|
//$$ RenderSystem.setProjectionMatrix(Matrix4f.projectionMatrix(
|
||||||
//$$ 0,
|
//$$ 0,
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import static org.lwjgl.opengl.GL21.GL_PIXEL_PACK_BUFFER;
|
|||||||
import static org.lwjgl.opengl.ARBVertexBufferObject.*;
|
import static org.lwjgl.opengl.ARBVertexBufferObject.*;
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
public class PixelBufferObject {
|
public class PixelBufferObject implements AutoCloseable {
|
||||||
public enum Usage {
|
public enum Usage {
|
||||||
COPY(GL_STREAM_COPY_ARB, GL_STREAM_COPY),
|
COPY(GL_STREAM_COPY_ARB, GL_STREAM_COPY),
|
||||||
DRAW(GL_STREAM_DRAW_ARB, GL_STREAM_DRAW),
|
DRAW(GL_STREAM_DRAW_ARB, GL_STREAM_DRAW),
|
||||||
@@ -207,7 +207,8 @@ public class PixelBufferObject {
|
|||||||
mapped.set(0);
|
mapped.set(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void delete() {
|
@Override
|
||||||
|
public void close() {
|
||||||
if (handle != -1) {
|
if (handle != -1) {
|
||||||
if (arb) {
|
if (arb) {
|
||||||
//#if MC>=11400
|
//#if MC>=11400
|
||||||
@@ -227,7 +228,7 @@ public class PixelBufferObject {
|
|||||||
super.finalize();
|
super.finalize();
|
||||||
if (handle != -1) {
|
if (handle != -1) {
|
||||||
LogManager.getLogger().warn("PBO garbage collected before deleted!");
|
LogManager.getLogger().warn("PBO garbage collected before deleted!");
|
||||||
ReplayMod.instance.runLater(this::delete);
|
ReplayMod.instance.runLater(this::close);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ import net.minecraft.network.packet.s2c.play.DisconnectS2CPacket;
|
|||||||
import net.minecraft.network.packet.s2c.play.EntitiesDestroyS2CPacket;
|
import net.minecraft.network.packet.s2c.play.EntitiesDestroyS2CPacket;
|
||||||
import net.minecraft.network.packet.s2c.play.EntitySpawnS2CPacket;
|
import net.minecraft.network.packet.s2c.play.EntitySpawnS2CPacket;
|
||||||
import net.minecraft.network.packet.s2c.play.ExperienceBarUpdateS2CPacket;
|
import net.minecraft.network.packet.s2c.play.ExperienceBarUpdateS2CPacket;
|
||||||
import net.minecraft.network.packet.s2c.play.ExperienceOrbSpawnS2CPacket;
|
|
||||||
import net.minecraft.network.packet.s2c.play.GameJoinS2CPacket;
|
import net.minecraft.network.packet.s2c.play.GameJoinS2CPacket;
|
||||||
import net.minecraft.network.packet.s2c.play.GameStateChangeS2CPacket;
|
import net.minecraft.network.packet.s2c.play.GameStateChangeS2CPacket;
|
||||||
import net.minecraft.network.packet.s2c.play.CloseScreenS2CPacket;
|
import net.minecraft.network.packet.s2c.play.CloseScreenS2CPacket;
|
||||||
@@ -57,6 +56,11 @@ import net.minecraft.util.math.Vec3d;
|
|||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
|
||||||
|
//#if MC>=12105
|
||||||
|
//#else
|
||||||
|
import net.minecraft.network.packet.s2c.play.ExperienceOrbSpawnS2CPacket;
|
||||||
|
//#endif
|
||||||
|
|
||||||
//#if MC>=12005
|
//#if MC>=12005
|
||||||
//$$ import net.minecraft.network.packet.s2c.common.ServerTransferS2CPacket;
|
//$$ import net.minecraft.network.packet.s2c.common.ServerTransferS2CPacket;
|
||||||
//#endif
|
//#endif
|
||||||
@@ -501,7 +505,9 @@ public class FullReplaySender extends ChannelInboundHandlerAdapter implements Re
|
|||||||
//#if MC<11600
|
//#if MC<11600
|
||||||
//$$ || packet instanceof EntitySpawnGlobalS2CPacket
|
//$$ || packet instanceof EntitySpawnGlobalS2CPacket
|
||||||
//#endif
|
//#endif
|
||||||
|
//#if MC<12105
|
||||||
|| packet instanceof ExperienceOrbSpawnS2CPacket
|
|| packet instanceof ExperienceOrbSpawnS2CPacket
|
||||||
|
//#endif
|
||||||
|| packet instanceof EntitiesDestroyS2CPacket;
|
|| packet instanceof EntitiesDestroyS2CPacket;
|
||||||
if (!relevantPacket) {
|
if (!relevantPacket) {
|
||||||
return; // don't want to do it too often, only when there's likely to be a dead entity
|
return; // don't want to do it too often, only when there's likely to be a dead entity
|
||||||
|
|||||||
@@ -11,6 +11,15 @@ import net.minecraft.client.util.ScreenshotUtils;
|
|||||||
import static com.replaymod.core.versions.MCVer.popMatrix;
|
import static com.replaymod.core.versions.MCVer.popMatrix;
|
||||||
import static com.replaymod.core.versions.MCVer.pushMatrix;
|
import static com.replaymod.core.versions.MCVer.pushMatrix;
|
||||||
|
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ import com.mojang.blaze3d.buffers.BufferType;
|
||||||
|
//$$ import com.mojang.blaze3d.buffers.BufferUsage;
|
||||||
|
//$$ import com.mojang.blaze3d.buffers.GpuBuffer;
|
||||||
|
//$$ import com.mojang.blaze3d.systems.CommandEncoder;
|
||||||
|
//$$ import com.mojang.blaze3d.systems.GpuDevice;
|
||||||
|
//$$ import net.minecraft.client.texture.NativeImage;
|
||||||
|
//#endif
|
||||||
|
|
||||||
//#if MC>=12100
|
//#if MC>=12100
|
||||||
//$$ import net.minecraft.client.render.RenderTickCounter;
|
//$$ import net.minecraft.client.render.RenderTickCounter;
|
||||||
//#endif
|
//#endif
|
||||||
@@ -66,6 +75,11 @@ public class NoGuiScreenshot {
|
|||||||
|
|
||||||
// Render frame without GUI
|
// Render frame without GUI
|
||||||
pushMatrix();
|
pushMatrix();
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ RenderSystem.getDevice()
|
||||||
|
//$$ .createCommandEncoder()
|
||||||
|
//$$ .clearColorAndDepthTextures(mc.getFramebuffer().getColorAttachment(), 0, mc.getFramebuffer().getDepthAttachment(), 1);
|
||||||
|
//#else
|
||||||
GlStateManager.clear(
|
GlStateManager.clear(
|
||||||
16640
|
16640
|
||||||
//#if MC>=11400 && MC<12102
|
//#if MC>=11400 && MC<12102
|
||||||
@@ -73,6 +87,7 @@ public class NoGuiScreenshot {
|
|||||||
//#endif
|
//#endif
|
||||||
);
|
);
|
||||||
mc.getFramebuffer().beginWrite(true);
|
mc.getFramebuffer().beginWrite(true);
|
||||||
|
//#endif
|
||||||
//#if MC<11904
|
//#if MC<11904
|
||||||
GlStateManager.enableTexture();
|
GlStateManager.enableTexture();
|
||||||
//#endif
|
//#endif
|
||||||
@@ -98,11 +113,15 @@ public class NoGuiScreenshot {
|
|||||||
//#endif
|
//#endif
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
|
//#if MC<12105
|
||||||
mc.getFramebuffer().endWrite();
|
mc.getFramebuffer().endWrite();
|
||||||
|
//#endif
|
||||||
popMatrix();
|
popMatrix();
|
||||||
|
//#if MC<12105
|
||||||
pushMatrix();
|
pushMatrix();
|
||||||
mc.getFramebuffer().draw(frameWidth, frameHeight);
|
mc.getFramebuffer().draw(frameWidth, frameHeight);
|
||||||
popMatrix();
|
popMatrix();
|
||||||
|
//#endif
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
future.setException(t);
|
future.setException(t);
|
||||||
return;
|
return;
|
||||||
@@ -114,7 +133,24 @@ public class NoGuiScreenshot {
|
|||||||
// The frame without GUI has been rendered
|
// The frame without GUI has been rendered
|
||||||
// Read it, create the screenshot and finish the future
|
// Read it, create the screenshot and finish the future
|
||||||
try {
|
try {
|
||||||
//#if MC>=11400
|
//#if MC>=12105
|
||||||
|
//$$ Image image;
|
||||||
|
//$$ GpuDevice device = RenderSystem.getDevice();
|
||||||
|
//$$ try (GpuBuffer gpuBuffer = device.createBuffer(null, BufferType.PIXEL_PACK, BufferUsage.STATIC_READ, frameWidth * frameHeight * 4)) {
|
||||||
|
//$$ CommandEncoder cmd = device.createCommandEncoder();
|
||||||
|
//$$ cmd.copyTextureToBuffer(mc.getFramebuffer().getColorAttachment(), gpuBuffer, 0, () -> {}, 0);
|
||||||
|
//$$ try (GpuBuffer.ReadView readView = cmd.readBuffer(gpuBuffer)) {
|
||||||
|
//$$ NativeImage nativeImage = new NativeImage(frameWidth, frameHeight, false);
|
||||||
|
//$$ for (int y = 0; y < frameHeight; ++y) {
|
||||||
|
//$$ for (int x = 0; x < frameWidth; ++x) {
|
||||||
|
//$$ int color = readView.data().getInt((x + y * frameWidth) * 4);
|
||||||
|
//$$ nativeImage.setColor(x, frameHeight - y - 1, 0xff000000 | color);
|
||||||
|
//$$ }
|
||||||
|
//$$ }
|
||||||
|
//$$ image = new Image(nativeImage);
|
||||||
|
//$$ }
|
||||||
|
//$$ }
|
||||||
|
//#elseif MC>=11400
|
||||||
Image image = new Image(ScreenshotUtils.takeScreenshot(
|
Image image = new Image(ScreenshotUtils.takeScreenshot(
|
||||||
//#if MC<11701
|
//#if MC<11701
|
||||||
frameWidth, frameHeight,
|
frameWidth, frameHeight,
|
||||||
|
|||||||
@@ -45,6 +45,10 @@ import net.minecraft.network.ClientConnection;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ import net.minecraft.entity.PositionInterpolator;
|
||||||
|
//#endif
|
||||||
|
|
||||||
//#if MC>=12102
|
//#if MC>=12102
|
||||||
//$$ import com.mojang.blaze3d.systems.ProjectionType;
|
//$$ import com.mojang.blaze3d.systems.ProjectionType;
|
||||||
//#endif
|
//#endif
|
||||||
@@ -713,22 +717,32 @@ public class ReplayHandler {
|
|||||||
|
|
||||||
// Perform the rendering using OpenGL
|
// Perform the rendering using OpenGL
|
||||||
pushMatrix();
|
pushMatrix();
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ RenderSystem.getDevice()
|
||||||
|
//$$ .createCommandEncoder()
|
||||||
|
//$$ .clearColorAndDepthTextures(mc.getFramebuffer().getColorAttachment(), 0, mc.getFramebuffer().getDepthAttachment(), 1);
|
||||||
|
//#else
|
||||||
GlStateManager.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT
|
GlStateManager.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT
|
||||||
//#if MC>=11400 && MC<12102
|
//#if MC>=11400 && MC<12102
|
||||||
, true
|
, true
|
||||||
//#endif
|
//#endif
|
||||||
);
|
);
|
||||||
|
//#endif
|
||||||
//#if MC<11904
|
//#if MC<11904
|
||||||
GlStateManager.enableTexture();
|
GlStateManager.enableTexture();
|
||||||
//#endif
|
//#endif
|
||||||
|
//#if MC<12105
|
||||||
mc.getFramebuffer().beginWrite(true);
|
mc.getFramebuffer().beginWrite(true);
|
||||||
|
//#endif
|
||||||
Window window = mc.getWindow();
|
Window window = mc.getWindow();
|
||||||
//#if MC>=11500
|
//#if MC>=11500
|
||||||
|
//#if MC<12105
|
||||||
//#if MC>=12102
|
//#if MC>=12102
|
||||||
//$$ RenderSystem.clear(256);
|
//$$ RenderSystem.clear(256);
|
||||||
//#else
|
//#else
|
||||||
RenderSystem.clear(256, MinecraftClient.IS_SYSTEM_MAC);
|
RenderSystem.clear(256, MinecraftClient.IS_SYSTEM_MAC);
|
||||||
//#endif
|
//#endif
|
||||||
|
//#endif
|
||||||
//#if MC>=11700
|
//#if MC>=11700
|
||||||
//$$ RenderSystem.setProjectionMatrix(Matrix4f.projectionMatrix(
|
//$$ RenderSystem.setProjectionMatrix(Matrix4f.projectionMatrix(
|
||||||
//$$ 0,
|
//$$ 0,
|
||||||
@@ -788,10 +802,16 @@ public class ReplayHandler {
|
|||||||
//#endif
|
//#endif
|
||||||
guiScreen.toMinecraft().removed();
|
guiScreen.toMinecraft().removed();
|
||||||
|
|
||||||
|
//#if MC<12105
|
||||||
mc.getFramebuffer().endWrite();
|
mc.getFramebuffer().endWrite();
|
||||||
|
//#endif
|
||||||
popMatrix();
|
popMatrix();
|
||||||
pushMatrix();
|
pushMatrix();
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ mc.getFramebuffer().blitToScreen();
|
||||||
|
//#else
|
||||||
mc.getFramebuffer().draw(mc.getWindow().getFramebufferWidth(), mc.getWindow().getFramebufferHeight());
|
mc.getFramebuffer().draw(mc.getWindow().getFramebufferWidth(), mc.getWindow().getFramebufferHeight());
|
||||||
|
//#endif
|
||||||
popMatrix();
|
popMatrix();
|
||||||
|
|
||||||
//#if MC>=12102
|
//#if MC>=12102
|
||||||
@@ -861,7 +881,13 @@ public class ReplayHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void skipTeleportInterpolation(Entity entity) {
|
private void skipTeleportInterpolation(Entity entity) {
|
||||||
//#if MC>=11400
|
//#if MC>=12105
|
||||||
|
//$$ PositionInterpolator i = entity.getInterpolator();
|
||||||
|
//$$ if (i != null && i.isInterpolating()) {
|
||||||
|
//$$ entity.refreshPositionAndAngles(i.getLerpedPos(), i.getLerpedYaw(), i.getLerpedPitch());
|
||||||
|
//$$ i.clear();
|
||||||
|
//$$ }
|
||||||
|
//#elseif MC>=11400
|
||||||
if (entity instanceof LivingEntity && !(entity instanceof CameraEntity)) {
|
if (entity instanceof LivingEntity && !(entity instanceof CameraEntity)) {
|
||||||
LivingEntity e = (LivingEntity) entity;
|
LivingEntity e = (LivingEntity) entity;
|
||||||
EntityLivingBaseAccessor ea = (EntityLivingBaseAccessor) e;
|
EntityLivingBaseAccessor ea = (EntityLivingBaseAccessor) e;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import org.spongepowered.asm.mixin.gen.Accessor;
|
|||||||
|
|
||||||
@Mixin(LivingEntity.class)
|
@Mixin(LivingEntity.class)
|
||||||
public interface EntityLivingBaseAccessor {
|
public interface EntityLivingBaseAccessor {
|
||||||
//#if MC>=11400
|
//#if MC>=11400 && MC<12105
|
||||||
@Accessor("serverX")
|
@Accessor("serverX")
|
||||||
double getInterpTargetX();
|
double getInterpTargetX();
|
||||||
@Accessor("serverY")
|
@Accessor("serverY")
|
||||||
|
|||||||
@@ -37,9 +37,17 @@ import static de.johni0702.minecraft.gui.versions.MCVer.popScissorState;
|
|||||||
import static de.johni0702.minecraft.gui.versions.MCVer.pushScissorState;
|
import static de.johni0702.minecraft.gui.versions.MCVer.pushScissorState;
|
||||||
import static de.johni0702.minecraft.gui.versions.MCVer.setScissorDisabled;
|
import static de.johni0702.minecraft.gui.versions.MCVer.setScissorDisabled;
|
||||||
|
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ import net.minecraft.client.render.RenderLayer;
|
||||||
|
//$$ import net.minecraft.client.render.VertexConsumer;
|
||||||
|
//$$ import net.minecraft.client.render.VertexConsumerProvider;
|
||||||
|
//#endif
|
||||||
|
|
||||||
//#if MC>=12102
|
//#if MC>=12102
|
||||||
|
//#if MC<12105
|
||||||
//$$ import net.minecraft.client.gl.ShaderProgramKeys;
|
//$$ import net.minecraft.client.gl.ShaderProgramKeys;
|
||||||
//#endif
|
//#endif
|
||||||
|
//#endif
|
||||||
|
|
||||||
//#if MC>=11700
|
//#if MC>=11700
|
||||||
//$$ import com.mojang.blaze3d.systems.RenderSystem;
|
//$$ import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
@@ -157,6 +165,11 @@ public class GuiKeyframeTimeline extends AbstractGuiTimeline<GuiKeyframeTimeline
|
|||||||
float positionXKeyframeTimeline = positonX + KEYFRAME_SIZE / 2f;
|
float positionXKeyframeTimeline = positonX + KEYFRAME_SIZE / 2f;
|
||||||
|
|
||||||
final int color = 0xff0000ff;
|
final int color = 0xff0000ff;
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ VertexConsumerProvider.Immediate immediate = getMinecraft().getBufferBuilders().getEntityVertexConsumers();
|
||||||
|
//$$ immediate.draw();
|
||||||
|
//$$ VertexConsumer buffer = immediate.getBuffer(RenderLayer.LINE_STRIP);
|
||||||
|
//#else
|
||||||
Tessellator tessellator = Tessellator.getInstance();
|
Tessellator tessellator = Tessellator.getInstance();
|
||||||
//#if MC>=12100
|
//#if MC>=12100
|
||||||
//$$ BufferBuilder buffer = tessellator.begin(net.minecraft.client.render.VertexFormat.DrawMode.LINE_STRIP, VertexFormats.LINES);
|
//$$ BufferBuilder buffer = tessellator.begin(net.minecraft.client.render.VertexFormat.DrawMode.LINE_STRIP, VertexFormats.LINES);
|
||||||
@@ -164,6 +177,7 @@ public class GuiKeyframeTimeline extends AbstractGuiTimeline<GuiKeyframeTimeline
|
|||||||
BufferBuilder buffer = tessellator.getBuffer();
|
BufferBuilder buffer = tessellator.getBuffer();
|
||||||
buffer.begin(GL11.GL_LINE_STRIP, VertexFormats.POSITION_COLOR);
|
buffer.begin(GL11.GL_LINE_STRIP, VertexFormats.POSITION_COLOR);
|
||||||
//#endif
|
//#endif
|
||||||
|
//#endif
|
||||||
|
|
||||||
// Start just below the top border of the replay timeline
|
// Start just below the top border of the replay timeline
|
||||||
Vector2f p1 = new Vector2f(replayTimelineLeft + positionXReplayTimeline, replayTimelineTop + BORDER_TOP);
|
Vector2f p1 = new Vector2f(replayTimelineLeft + positionXReplayTimeline, replayTimelineTop + BORDER_TOP);
|
||||||
@@ -179,6 +193,13 @@ public class GuiKeyframeTimeline extends AbstractGuiTimeline<GuiKeyframeTimeline
|
|||||||
emitLine(matrixStack, buffer, p2, p3, color);
|
emitLine(matrixStack, buffer, p2, p3, color);
|
||||||
emitLine(matrixStack, buffer, p3, p4, color);
|
emitLine(matrixStack, buffer, p3, p4, color);
|
||||||
|
|
||||||
|
pushScissorState();
|
||||||
|
setScissorDisabled();
|
||||||
|
GL11.glLineWidth(2);
|
||||||
|
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ immediate.draw();
|
||||||
|
//#else
|
||||||
//#if MC>=12102
|
//#if MC>=12102
|
||||||
//$$ RenderSystem.setShader(ShaderProgramKeys.RENDERTYPE_LINES);
|
//$$ RenderSystem.setShader(ShaderProgramKeys.RENDERTYPE_LINES);
|
||||||
//#elseif MC>=11700
|
//#elseif MC>=11700
|
||||||
@@ -187,9 +208,6 @@ public class GuiKeyframeTimeline extends AbstractGuiTimeline<GuiKeyframeTimeline
|
|||||||
GL11.glEnable(GL11.GL_LINE_SMOOTH);
|
GL11.glEnable(GL11.GL_LINE_SMOOTH);
|
||||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||||
//#endif
|
//#endif
|
||||||
pushScissorState();
|
|
||||||
setScissorDisabled();
|
|
||||||
GL11.glLineWidth(2);
|
|
||||||
//#if MC>=12100
|
//#if MC>=12100
|
||||||
//$$ try (var builtBuffer = buffer.end()) {
|
//$$ try (var builtBuffer = buffer.end()) {
|
||||||
//$$ net.minecraft.client.render.BufferRenderer.drawWithGlobalProgram(builtBuffer);
|
//$$ net.minecraft.client.render.BufferRenderer.drawWithGlobalProgram(builtBuffer);
|
||||||
@@ -197,11 +215,13 @@ public class GuiKeyframeTimeline extends AbstractGuiTimeline<GuiKeyframeTimeline
|
|||||||
//#else
|
//#else
|
||||||
tessellator.draw();
|
tessellator.draw();
|
||||||
//#endif
|
//#endif
|
||||||
popScissorState();
|
|
||||||
//#if MC<11700
|
//#if MC<11700
|
||||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||||
GL11.glDisable(GL11.GL_LINE_SMOOTH);
|
GL11.glDisable(GL11.GL_LINE_SMOOTH);
|
||||||
//#endif
|
//#endif
|
||||||
|
//#endif
|
||||||
|
|
||||||
|
popScissorState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -30,9 +30,17 @@ import org.apache.commons.lang3.tuple.Pair;
|
|||||||
import org.apache.commons.lang3.tuple.Triple;
|
import org.apache.commons.lang3.tuple.Triple;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ import net.minecraft.client.render.RenderLayer;
|
||||||
|
//$$ import net.minecraft.client.render.VertexConsumer;
|
||||||
|
//$$ import net.minecraft.client.render.VertexConsumerProvider;
|
||||||
|
//#endif
|
||||||
|
|
||||||
//#if MC>=12102
|
//#if MC>=12102
|
||||||
|
//#if MC<12105
|
||||||
//$$ import net.minecraft.client.gl.ShaderProgramKeys;
|
//$$ import net.minecraft.client.gl.ShaderProgramKeys;
|
||||||
//#endif
|
//#endif
|
||||||
|
//#endif
|
||||||
|
|
||||||
//#if MC>=11700
|
//#if MC>=11700
|
||||||
//$$ import net.minecraft.client.render.GameRenderer;
|
//$$ import net.minecraft.client.render.GameRenderer;
|
||||||
@@ -173,9 +181,11 @@ public class PathPreviewRenderer extends EventRegistrations {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#if MC<12105
|
||||||
GL11.glEnable(GL11.GL_BLEND);
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_SRC_COLOR);
|
GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_SRC_COLOR);
|
||||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||||
|
//#endif
|
||||||
//#if MC<11700
|
//#if MC<11700
|
||||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||||
//#endif
|
//#endif
|
||||||
@@ -188,8 +198,10 @@ public class PathPreviewRenderer extends EventRegistrations {
|
|||||||
.sorted(new KeyframeComparator(viewPos)) // Need to render the furthest first
|
.sorted(new KeyframeComparator(viewPos)) // Need to render the furthest first
|
||||||
.forEachOrdered(p -> drawPoint(viewPos, p.getRight(), p.getLeft()));
|
.forEachOrdered(p -> drawPoint(viewPos, p.getRight(), p.getLeft()));
|
||||||
|
|
||||||
|
//#if MC<12105
|
||||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||||
|
//#endif
|
||||||
|
|
||||||
int time = guiPathing.timeline.getCursorPosition();
|
int time = guiPathing.timeline.getCursorPosition();
|
||||||
Optional<Integer> entityId = path.getValue(SpectatorProperty.PROPERTY, time);
|
Optional<Integer> entityId = path.getValue(SpectatorProperty.PROPERTY, time);
|
||||||
@@ -214,11 +226,13 @@ public class PathPreviewRenderer extends EventRegistrations {
|
|||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
popMatrix();
|
popMatrix();
|
||||||
|
//#if MC<12105
|
||||||
//#if MC>=11700
|
//#if MC>=11700
|
||||||
//$$ GL11.glDisable(GL11.GL_BLEND);
|
//$$ GL11.glDisable(GL11.GL_BLEND);
|
||||||
//#else
|
//#else
|
||||||
GL11.glPopAttrib();
|
GL11.glPopAttrib();
|
||||||
//#endif
|
//#endif
|
||||||
|
//#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,6 +266,11 @@ public class PathPreviewRenderer extends EventRegistrations {
|
|||||||
if (distanceSquared(view, pos1) > renderDistanceSquared) return;
|
if (distanceSquared(view, pos1) > renderDistanceSquared) return;
|
||||||
if (distanceSquared(view, pos2) > renderDistanceSquared) return;
|
if (distanceSquared(view, pos2) > renderDistanceSquared) return;
|
||||||
|
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ VertexConsumerProvider.Immediate immediate = mc.getBufferBuilders().getEntityVertexConsumers();
|
||||||
|
//$$ immediate.draw();
|
||||||
|
//$$ VertexConsumer buffer = immediate.getBuffer(RenderLayer.LINES);
|
||||||
|
//#else
|
||||||
Tessellator tessellator = Tessellator.getInstance();
|
Tessellator tessellator = Tessellator.getInstance();
|
||||||
//#if MC>=12100
|
//#if MC>=12100
|
||||||
//$$ BufferBuilder buffer = tessellator.begin(net.minecraft.client.render.VertexFormat.DrawMode.LINES, VertexFormats.LINES);
|
//$$ BufferBuilder buffer = tessellator.begin(net.minecraft.client.render.VertexFormat.DrawMode.LINES, VertexFormats.LINES);
|
||||||
@@ -259,9 +278,15 @@ public class PathPreviewRenderer extends EventRegistrations {
|
|||||||
BufferBuilder buffer = tessellator.getBuffer();
|
BufferBuilder buffer = tessellator.getBuffer();
|
||||||
buffer.begin(GL11.GL_LINES, VertexFormats.POSITION_COLOR);
|
buffer.begin(GL11.GL_LINES, VertexFormats.POSITION_COLOR);
|
||||||
//#endif
|
//#endif
|
||||||
|
//#endif
|
||||||
|
|
||||||
emitLine(new MatrixStack(), buffer, Vector3f.sub(pos1, view, null), Vector3f.sub(pos2, view, null), color);
|
emitLine(new MatrixStack(), buffer, Vector3f.sub(pos1, view, null), Vector3f.sub(pos2, view, null), color);
|
||||||
|
|
||||||
|
GL11.glLineWidth(3);
|
||||||
|
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ immediate.draw();
|
||||||
|
//#else
|
||||||
//#if MC>=11700
|
//#if MC>=11700
|
||||||
//#if MC>=12102
|
//#if MC>=12102
|
||||||
//$$ RenderSystem.setShader(ShaderProgramKeys.RENDERTYPE_LINES);
|
//$$ RenderSystem.setShader(ShaderProgramKeys.RENDERTYPE_LINES);
|
||||||
@@ -270,7 +295,6 @@ public class PathPreviewRenderer extends EventRegistrations {
|
|||||||
//#endif
|
//#endif
|
||||||
//$$ RenderSystem.disableCull();
|
//$$ RenderSystem.disableCull();
|
||||||
//#endif
|
//#endif
|
||||||
GL11.glLineWidth(3);
|
|
||||||
//#if MC>=12100
|
//#if MC>=12100
|
||||||
//$$ try (var builtBuffer = buffer.end()) {
|
//$$ try (var builtBuffer = buffer.end()) {
|
||||||
//$$ net.minecraft.client.render.BufferRenderer.drawWithGlobalProgram(builtBuffer);
|
//$$ net.minecraft.client.render.BufferRenderer.drawWithGlobalProgram(builtBuffer);
|
||||||
@@ -281,6 +305,7 @@ public class PathPreviewRenderer extends EventRegistrations {
|
|||||||
//#if MC>=11700
|
//#if MC>=11700
|
||||||
//$$ RenderSystem.enableCull();
|
//$$ RenderSystem.enableCull();
|
||||||
//#endif
|
//#endif
|
||||||
|
//#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawPoint(Vector3f view, Vector3f pos, Keyframe keyframe) {
|
private void drawPoint(Vector3f view, Vector3f pos, Keyframe keyframe) {
|
||||||
@@ -304,18 +329,24 @@ public class PathPreviewRenderer extends EventRegistrations {
|
|||||||
float maxX = 0.5f;
|
float maxX = 0.5f;
|
||||||
float maxY = 0.5f;
|
float maxY = 0.5f;
|
||||||
|
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ VertexConsumerProvider.Immediate immediate = mc.getBufferBuilders().getEntityVertexConsumers();
|
||||||
|
//$$ immediate.draw();
|
||||||
|
//$$ VertexConsumer buffer = immediate.getBuffer(RenderLayer.getGuiTexturedOverlay(TEXTURE));
|
||||||
|
//#else
|
||||||
Tessellator tessellator = Tessellator.getInstance();
|
Tessellator tessellator = Tessellator.getInstance();
|
||||||
//#if MC>=12100
|
//#if MC>=12100
|
||||||
//$$ BufferBuilder buffer = tessellator.begin(net.minecraft.client.render.VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE);
|
//$$ BufferBuilder buffer = tessellator.begin(net.minecraft.client.render.VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE_COLOR);
|
||||||
//#else
|
//#else
|
||||||
BufferBuilder buffer = tessellator.getBuffer();
|
BufferBuilder buffer = tessellator.getBuffer();
|
||||||
buffer.begin(GL11.GL_QUADS, VertexFormats.POSITION_TEXTURE);
|
buffer.begin(GL11.GL_QUADS, VertexFormats.POSITION_TEXTURE_COLOR);
|
||||||
|
//#endif
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
buffer.vertex(minX, minY, 0).texture(posX + size, posY + size).next();
|
buffer.vertex(minX, minY, 0).texture(posX + size, posY + size).color(255, 255, 255, 255).next();
|
||||||
buffer.vertex(minX, maxY, 0).texture(posX + size, posY).next();
|
buffer.vertex(minX, maxY, 0).texture(posX + size, posY).color(255, 255, 255, 255).next();
|
||||||
buffer.vertex(maxX, maxY, 0).texture(posX, posY).next();
|
buffer.vertex(maxX, maxY, 0).texture(posX, posY).color(255, 255, 255, 255).next();
|
||||||
buffer.vertex(maxX, minY, 0).texture(posX, posY + size).next();
|
buffer.vertex(maxX, minY, 0).texture(posX, posY + size).color(255, 255, 255, 255).next();
|
||||||
|
|
||||||
pushMatrix();
|
pushMatrix();
|
||||||
|
|
||||||
@@ -324,11 +355,14 @@ public class PathPreviewRenderer extends EventRegistrations {
|
|||||||
GL11.glRotatef(-mc.getEntityRenderDispatcher().camera.getYaw(), 0, 1, 0);
|
GL11.glRotatef(-mc.getEntityRenderDispatcher().camera.getYaw(), 0, 1, 0);
|
||||||
GL11.glRotatef(mc.getEntityRenderDispatcher().camera.getPitch(), 1, 0, 0);
|
GL11.glRotatef(mc.getEntityRenderDispatcher().camera.getPitch(), 1, 0, 0);
|
||||||
|
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ immediate.draw();
|
||||||
|
//#else
|
||||||
//#if MC>=12102
|
//#if MC>=12102
|
||||||
//$$ RenderSystem.setShader(ShaderProgramKeys.POSITION_TEX);
|
//$$ RenderSystem.setShader(ShaderProgramKeys.POSITION_TEX_COLOR);
|
||||||
//#elseif MC>=11700
|
//#elseif MC>=11700
|
||||||
//$$ RenderSystem.applyModelViewMatrix();
|
//$$ RenderSystem.applyModelViewMatrix();
|
||||||
//$$ RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
//$$ RenderSystem.setShader(GameRenderer::getPositionTexColorShader);
|
||||||
//#endif
|
//#endif
|
||||||
//#if MC>=12100
|
//#if MC>=12100
|
||||||
//$$ try (var builtBuffer = buffer.end()) {
|
//$$ try (var builtBuffer = buffer.end()) {
|
||||||
@@ -337,6 +371,7 @@ public class PathPreviewRenderer extends EventRegistrations {
|
|||||||
//#else
|
//#else
|
||||||
tessellator.draw();
|
tessellator.draw();
|
||||||
//#endif
|
//#endif
|
||||||
|
//#endif
|
||||||
|
|
||||||
popMatrix();
|
popMatrix();
|
||||||
}
|
}
|
||||||
@@ -354,6 +389,11 @@ public class PathPreviewRenderer extends EventRegistrations {
|
|||||||
GL11.glRotatef(rot.z, 0, 0, 1); // Roll
|
GL11.glRotatef(rot.z, 0, 0, 1); // Roll
|
||||||
|
|
||||||
//draw the position line
|
//draw the position line
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ VertexConsumerProvider.Immediate immediate = mc.getBufferBuilders().getEntityVertexConsumers();
|
||||||
|
//$$ immediate.draw();
|
||||||
|
//$$ VertexConsumer buffer = immediate.getBuffer(RenderLayer.LINES);
|
||||||
|
//#else
|
||||||
Tessellator tessellator = Tessellator.getInstance();
|
Tessellator tessellator = Tessellator.getInstance();
|
||||||
//#if MC>=12100
|
//#if MC>=12100
|
||||||
//$$ BufferBuilder buffer = tessellator.begin(net.minecraft.client.render.VertexFormat.DrawMode.LINES, VertexFormats.LINES);
|
//$$ BufferBuilder buffer = tessellator.begin(net.minecraft.client.render.VertexFormat.DrawMode.LINES, VertexFormats.LINES);
|
||||||
@@ -361,9 +401,13 @@ public class PathPreviewRenderer extends EventRegistrations {
|
|||||||
BufferBuilder buffer = tessellator.getBuffer();
|
BufferBuilder buffer = tessellator.getBuffer();
|
||||||
buffer.begin(GL11.GL_LINES, VertexFormats.POSITION_COLOR);
|
buffer.begin(GL11.GL_LINES, VertexFormats.POSITION_COLOR);
|
||||||
//#endif
|
//#endif
|
||||||
|
//#endif
|
||||||
|
|
||||||
emitLine(new MatrixStack(), buffer, new Vector3f(0, 0, 0), new Vector3f(0, 0, 2), 0x00ff00aa);
|
emitLine(new MatrixStack(), buffer, new Vector3f(0, 0, 0), new Vector3f(0, 0, 2), 0x00ff00aa);
|
||||||
|
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ immediate.draw();
|
||||||
|
//#else
|
||||||
//#if MC>=12102
|
//#if MC>=12102
|
||||||
//$$ RenderSystem.setShader(ShaderProgramKeys.RENDERTYPE_LINES);
|
//$$ RenderSystem.setShader(ShaderProgramKeys.RENDERTYPE_LINES);
|
||||||
//#elseif MC>=11700
|
//#elseif MC>=11700
|
||||||
@@ -384,6 +428,7 @@ public class PathPreviewRenderer extends EventRegistrations {
|
|||||||
//#if MC<11700
|
//#if MC<11700
|
||||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||||
//#endif
|
//#endif
|
||||||
|
//#endif
|
||||||
|
|
||||||
// draw camera cube
|
// draw camera cube
|
||||||
|
|
||||||
@@ -395,7 +440,9 @@ public class PathPreviewRenderer extends EventRegistrations {
|
|||||||
double r = -cubeSize/2;
|
double r = -cubeSize/2;
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
//#if MC>=12100
|
//#if MC>=12105
|
||||||
|
//$$ buffer = immediate.getBuffer(RenderLayer.getGuiTextured(CAMERA_HEAD));
|
||||||
|
//#elseif MC>=12100
|
||||||
//$$ buffer = tessellator.begin(net.minecraft.client.render.VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE_COLOR);
|
//$$ buffer = tessellator.begin(net.minecraft.client.render.VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE_COLOR);
|
||||||
//#else
|
//#else
|
||||||
buffer.begin(GL11.GL_QUADS, VertexFormats.POSITION_TEXTURE_COLOR);
|
buffer.begin(GL11.GL_QUADS, VertexFormats.POSITION_TEXTURE_COLOR);
|
||||||
@@ -437,6 +484,9 @@ public class PathPreviewRenderer extends EventRegistrations {
|
|||||||
buffer.vertex(r + cubeSize, r + cubeSize, r + cubeSize).texture(2*8/64f, 8/64f).color(255, 255, 255, 200).next();
|
buffer.vertex(r + cubeSize, r + cubeSize, r + cubeSize).texture(2*8/64f, 8/64f).color(255, 255, 255, 200).next();
|
||||||
buffer.vertex(r + cubeSize, r + cubeSize, r).texture(2 * 8 / 64f, 0).color(255, 255, 255, 200).next();
|
buffer.vertex(r + cubeSize, r + cubeSize, r).texture(2 * 8 / 64f, 0).color(255, 255, 255, 200).next();
|
||||||
|
|
||||||
|
//#if MC>=12105
|
||||||
|
//$$ immediate.draw();
|
||||||
|
//#else
|
||||||
//#if MC>=12102
|
//#if MC>=12102
|
||||||
//$$ RenderSystem.setShader(ShaderProgramKeys.POSITION_TEX_COLOR);
|
//$$ RenderSystem.setShader(ShaderProgramKeys.POSITION_TEX_COLOR);
|
||||||
//#elseif MC>=11700
|
//#elseif MC>=11700
|
||||||
@@ -450,6 +500,7 @@ public class PathPreviewRenderer extends EventRegistrations {
|
|||||||
//#else
|
//#else
|
||||||
tessellator.draw();
|
tessellator.draw();
|
||||||
//#endif
|
//#endif
|
||||||
|
//#endif
|
||||||
|
|
||||||
popMatrix();
|
popMatrix();
|
||||||
}
|
}
|
||||||
|
|||||||
0
versions/1.21.5/.gitkeep
Normal file
0
versions/1.21.5/.gitkeep
Normal file
2
versions/mapping-fabric-1.21.5-1.21.4.txt
Normal file
2
versions/mapping-fabric-1.21.5-1.21.4.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
com.mojang.blaze3d.vertex.VertexFormat net.minecraft.client.render.VertexFormat
|
||||||
|
com.mojang.blaze3d.vertex.VertexFormatElement net.minecraft.client.render.VertexFormatElement
|
||||||
Reference in New Issue
Block a user