Release 2.6.13

This commit is contained in:
Jonas Herzig
2023-06-20 09:44:55 +02:00
25 changed files with 286 additions and 26 deletions

View File

@@ -243,7 +243,6 @@ dependencies {
11601: '1.16.1', 11601: '1.16.1',
11603: '1.16.3', 11603: '1.16.3',
11604: '1.16.4', 11604: '1.16.4',
11700: '1.17',
11701: '1.17.1', 11701: '1.17.1',
11800: '1.18', 11800: '1.18',
11801: '1.18.1', 11801: '1.18.1',
@@ -253,6 +252,7 @@ dependencies {
11902: '1.19.2', 11902: '1.19.2',
11903: '1.19.3-rc3', 11903: '1.19.3-rc3',
11904: '1.19.4', 11904: '1.19.4',
12001: '1.20.1',
][mcVersion] ][mcVersion]
mappings 'net.fabricmc:yarn:' + [ mappings 'net.fabricmc:yarn:' + [
11404: '1.14.4+build.16', 11404: '1.14.4+build.16',
@@ -260,7 +260,6 @@ dependencies {
11601: '1.16.1+build.17:v2', 11601: '1.16.1+build.17:v2',
11603: '1.16.3+build.1:v2', 11603: '1.16.3+build.1:v2',
11604: '1.16.4+build.6:v2', 11604: '1.16.4+build.6:v2',
11700: '1.17+build.13:v2',
11701: '1.17.1+build.29:v2', 11701: '1.17.1+build.29:v2',
11800: '1.18+build.1:v2', 11800: '1.18+build.1:v2',
11801: '1.18.1+build.1:v2', 11801: '1.18.1+build.1:v2',
@@ -270,6 +269,7 @@ dependencies {
11902: '1.19.2+build.28:v2', 11902: '1.19.2+build.28:v2',
11903: '1.19.3-rc3+build.1:v2', 11903: '1.19.3-rc3+build.1:v2',
11904: '1.19.4+build.1:v2', 11904: '1.19.4+build.1:v2',
12001: '1.20.1+build.2:v2',
][mcVersion] ][mcVersion]
modImplementation 'net.fabricmc:fabric-loader:0.14.11' modImplementation 'net.fabricmc:fabric-loader:0.14.11'
def fabricApiVersion = [ def fabricApiVersion = [
@@ -277,9 +277,8 @@ dependencies {
11502: '0.5.1+build.294-1.15', 11502: '0.5.1+build.294-1.15',
11601: '0.14.0+build.371-1.16', 11601: '0.14.0+build.371-1.16',
11603: '0.17.1+build.394-1.16', 11603: '0.17.1+build.394-1.16',
11604: '0.25.1+build.416-1.16', 11604: '0.42.0+1.16',
11700: '0.36.0+1.17', 11701: '0.46.1+1.17',
11701: '0.37.1+1.17',
11800: '0.43.1+1.18', 11800: '0.43.1+1.18',
11801: '0.43.1+1.18', 11801: '0.43.1+1.18',
11802: '0.47.9+1.18.2', 11802: '0.47.9+1.18.2',
@@ -288,6 +287,7 @@ dependencies {
11902: '0.68.0+1.19.2', 11902: '0.68.0+1.19.2',
11903: '0.68.1+1.19.3', 11903: '0.68.1+1.19.3',
11904: '0.76.0+1.19.4', 11904: '0.76.0+1.19.4',
12001: '0.83.1+1.20.1',
][mcVersion] ][mcVersion]
def fabricApiModules = [ def fabricApiModules = [
"api-base", "api-base",
@@ -299,6 +299,9 @@ dependencies {
fabricApiModules.remove("keybindings-v0") fabricApiModules.remove("keybindings-v0")
fabricApiModules.add("key-binding-api-v1") fabricApiModules.add("key-binding-api-v1")
} }
if (mcVersion >= 11604) {
fabricApiModules.add("screen-api-v1")
}
if (mcVersion >= 11700) { if (mcVersion >= 11700) {
fabricApiModules.remove("networking-v0") fabricApiModules.remove("networking-v0")
fabricApiModules.add("networking-api-v1") fabricApiModules.add("networking-api-v1")
@@ -330,6 +333,11 @@ dependencies {
annotationProcessor 'org.ow2.asm:asm-tree:6.2' annotationProcessor 'org.ow2.asm:asm-tree:6.2'
annotationProcessor 'org.apache.logging.log4j:log4j-core:2.0-beta9' annotationProcessor 'org.apache.logging.log4j:log4j-core:2.0-beta9'
} }
if (mcVersion >= 11604) {
shadow(annotationProcessor('com.github.LlamaLad7:MixinExtras:0.1.1'))
}
shadow 'com.googlecode.mp4parser:isoparser:1.1.7' shadow 'com.googlecode.mp4parser:isoparser:1.1.7'
shadow 'org.apache.commons:commons-exec:1.3' shadow 'org.apache.commons:commons-exec:1.3'
shadow 'com.google.apis:google-api-services-youtube:v3-rev178-1.22.0', shadeExclusions shadow 'com.google.apis:google-api-services-youtube:v3-rev178-1.22.0', shadeExclusions
@@ -360,7 +368,7 @@ dependencies {
shadow 'com.github.ReplayMod.JavaBlend:2.79.0:a0696f8' shadow 'com.github.ReplayMod.JavaBlend:2.79.0:a0696f8'
shadow "com.github.ReplayMod:ReplayStudio:d3f8506", shadeExclusions shadow "com.github.ReplayMod:ReplayStudio:a1e2b83", shadeExclusions
// FIXME this should be pulled in by ReplayStudio, and IntelliJ sees it, but javac for some reason does not // FIXME this should be pulled in by ReplayStudio, and IntelliJ sees it, but javac for some reason does not
implementation 'com.github.viaversion:opennbt:0a02214' // 2.0-SNAPSHOT (ViaVersion Edition) implementation 'com.github.viaversion:opennbt:0a02214' // 2.0-SNAPSHOT (ViaVersion Edition)
@@ -371,7 +379,9 @@ dependencies {
shadow 'com.github.ReplayMod:lwjgl-utils:27dcd66' shadow 'com.github.ReplayMod:lwjgl-utils:27dcd66'
if (FABRIC) { if (FABRIC) {
if (mcVersion >= 11904) { if (mcVersion >= 12000) {
modImplementation 'com.terraformersmc:modmenu:7.0.1'
} else if (mcVersion >= 11904) {
modImplementation 'com.terraformersmc:modmenu:6.1.0-rc.4' modImplementation 'com.terraformersmc:modmenu:6.1.0-rc.4'
} else if (mcVersion >= 11903) { } else if (mcVersion >= 11903) {
modImplementation 'com.terraformersmc:modmenu:5.0.0-alpha.4' modImplementation 'com.terraformersmc:modmenu:5.0.0-alpha.4'

2
jGui

Submodule jGui updated: 34d9d6bb15...eb3297f5a6

View File

@@ -193,6 +193,7 @@ val doRelease by tasks.registering {
defaultTasks("bundleJar") defaultTasks("bundleJar")
preprocess { preprocess {
val mc12001 = createNode("1.20.1", 12001, "yarn")
val mc11904 = createNode("1.19.4", 11904, "yarn") val mc11904 = createNode("1.19.4", 11904, "yarn")
val mc11903 = createNode("1.19.3", 11903, "yarn") val mc11903 = createNode("1.19.3", 11903, "yarn")
val mc11902 = createNode("1.19.2", 11902, "yarn") val mc11902 = createNode("1.19.2", 11902, "yarn")
@@ -201,7 +202,6 @@ preprocess {
val mc11802 = createNode("1.18.2", 11802, "yarn") val mc11802 = createNode("1.18.2", 11802, "yarn")
val mc11801 = createNode("1.18.1", 11801, "yarn") val mc11801 = createNode("1.18.1", 11801, "yarn")
val mc11701 = createNode("1.17.1", 11701, "yarn") val mc11701 = createNode("1.17.1", 11701, "yarn")
val mc11700 = createNode("1.17", 11700, "yarn")
val mc11604 = createNode("1.16.4", 11604, "yarn") val mc11604 = createNode("1.16.4", 11604, "yarn")
val mc11601 = createNode("1.16.1", 11601, "yarn") val mc11601 = createNode("1.16.1", 11601, "yarn")
val mc11502 = createNode("1.15.2", 11502, "yarn") val mc11502 = createNode("1.15.2", 11502, "yarn")
@@ -218,6 +218,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")
mc12001.link(mc11904)
mc11904.link(mc11903) mc11904.link(mc11903)
mc11903.link(mc11902, file("versions/mapping-fabric-1.19.3-1.19.2.txt")) mc11903.link(mc11902, file("versions/mapping-fabric-1.19.3-1.19.2.txt"))
mc11902.link(mc11901) mc11902.link(mc11901)
@@ -225,8 +226,7 @@ preprocess {
mc11900.link(mc11802, file("versions/mapping-fabric-1.19-1.18.2.txt")) mc11900.link(mc11802, file("versions/mapping-fabric-1.19-1.18.2.txt"))
mc11802.link(mc11801) mc11802.link(mc11801)
mc11801.link(mc11701, file("versions/mapping-fabric-1.18.1-1.17.1.txt")) mc11801.link(mc11701, file("versions/mapping-fabric-1.18.1-1.17.1.txt"))
mc11701.link(mc11700) mc11701.link(mc11604, file("versions/mapping-fabric-1.17.1-1.16.4.txt"))
mc11700.link(mc11604, file("versions/mapping-fabric-1.17-1.16.4.txt"))
mc11604.link(mc11601) mc11604.link(mc11601)
mc11601.link(mc11502, file("versions/mapping-fabric-1.16.1-1.15.2.txt")) mc11601.link(mc11502, file("versions/mapping-fabric-1.16.1-1.15.2.txt"))
mc11502.link(mc11404, file("versions/mapping-fabric-1.15.2-1.14.4.txt")) mc11502.link(mc11404, file("versions/mapping-fabric-1.15.2-1.14.4.txt"))

View File

@@ -29,7 +29,6 @@ val jGuiVersions = listOf(
"1.15.2", "1.15.2",
"1.16.1", "1.16.1",
"1.16.4", "1.16.4",
"1.17",
"1.17.1", "1.17.1",
"1.18.1", "1.18.1",
"1.18.2", "1.18.2",
@@ -38,6 +37,7 @@ val jGuiVersions = listOf(
"1.19.2", "1.19.2",
"1.19.3", "1.19.3",
"1.19.4", "1.19.4",
"1.20.1",
) )
val replayModVersions = listOf( val replayModVersions = listOf(
// "1.7.10", // "1.7.10",
@@ -55,7 +55,6 @@ val replayModVersions = listOf(
"1.15.2", "1.15.2",
"1.16.1", "1.16.1",
"1.16.4", "1.16.4",
"1.17",
"1.17.1", "1.17.1",
"1.18.1", "1.18.1",
"1.18.2", "1.18.2",
@@ -64,6 +63,7 @@ val replayModVersions = listOf(
"1.19.2", "1.19.2",
"1.19.3", "1.19.3",
"1.19.4", "1.19.4",
"1.20.1",
) )
rootProject.buildFileName = "root.gradle.kts" rootProject.buildFileName = "root.gradle.kts"

View File

@@ -0,0 +1,14 @@
//#if FABRIC>=1
package com.replaymod.core;
import net.fabricmc.loader.api.entrypoint.PreLaunchEntrypoint;
public class MixinExtrasInit implements PreLaunchEntrypoint {
@Override
public void onPreLaunch() {
//#if MC>=11604
com.llamalad7.mixinextras.MixinExtrasBootstrap.init();
//#endif
}
}
//#endif

View File

@@ -5,7 +5,6 @@ import com.replaymod.core.mixin.GuiScreenAccessor;
import com.replaymod.replaystudio.lib.viaversion.api.protocol.packet.State; import com.replaymod.replaystudio.lib.viaversion.api.protocol.packet.State;
import com.replaymod.replaystudio.lib.viaversion.api.protocol.version.ProtocolVersion; import com.replaymod.replaystudio.lib.viaversion.api.protocol.version.ProtocolVersion;
import com.replaymod.replaystudio.protocol.PacketTypeRegistry; import com.replaymod.replaystudio.protocol.PacketTypeRegistry;
import de.johni0702.minecraft.gui.MinecraftGuiRenderer;
import de.johni0702.minecraft.gui.utils.lwjgl.vector.Vector2f; import de.johni0702.minecraft.gui.utils.lwjgl.vector.Vector2f;
import de.johni0702.minecraft.gui.utils.lwjgl.vector.Vector3f; import de.johni0702.minecraft.gui.utils.lwjgl.vector.Vector3f;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
@@ -422,7 +421,7 @@ public class MCVer {
} }
public static void bindTexture(Identifier id) { public static void bindTexture(Identifier id) {
new MinecraftGuiRenderer(null).bindTexture(id); de.johni0702.minecraft.gui.versions.MCVer.bindTexture(id);
} }
//#if MC<10900 //#if MC<10900

View File

@@ -897,4 +897,13 @@ class Patterns {
//#else //#else
//$$ @Pattern private static void REGISTRIES() {} //$$ @Pattern private static void REGISTRIES() {}
//#endif //#endif
@Pattern
public World getWorld(Entity entity) {
//#if MC>=12000
//$$ return entity.getWorld();
//#else
return entity.world;
//#endif
}
} }

View File

@@ -9,12 +9,17 @@ import de.johni0702.minecraft.gui.versions.callbacks.RenderHudCallback;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer; import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.resource.language.I18n; import net.minecraft.client.resource.language.I18n;
import net.minecraft.client.util.math.MatrixStack;
import static com.replaymod.core.ReplayMod.TEXTURE; import static com.replaymod.core.ReplayMod.TEXTURE;
import static com.replaymod.core.ReplayMod.TEXTURE_SIZE; import static com.replaymod.core.ReplayMod.TEXTURE_SIZE;
import static com.mojang.blaze3d.platform.GlStateManager.*; import static com.mojang.blaze3d.platform.GlStateManager.*;
//#if MC>=12000
//$$ import net.minecraft.client.gui.DrawContext;
//#else
import net.minecraft.client.util.math.MatrixStack;
//#endif
/** /**
* Renders overlay during recording. * Renders overlay during recording.
*/ */
@@ -33,7 +38,11 @@ public class GuiRecordingOverlay extends EventRegistrations {
* Render the recording icon and text in the top left corner of the screen. * Render the recording icon and text in the top left corner of the screen.
*/ */
{ on(RenderHudCallback.EVENT, (stack, partialTicks) -> renderRecordingIndicator(stack)); } { on(RenderHudCallback.EVENT, (stack, partialTicks) -> renderRecordingIndicator(stack)); }
//#if MC>=12000
//$$ private void renderRecordingIndicator(DrawContext stack) {
//#else
private void renderRecordingIndicator(MatrixStack stack) { private void renderRecordingIndicator(MatrixStack stack) {
//#endif
if (guiControls.isStopped()) return; if (guiControls.isStopped()) return;
if (settingsRegistry.get(Setting.INDICATOR)) { if (settingsRegistry.get(Setting.INDICATOR)) {
TextRenderer fontRenderer = mc.textRenderer; TextRenderer fontRenderer = mc.textRenderer;

View File

@@ -27,6 +27,9 @@ import net.minecraft.client.render.WorldRenderer;
public abstract class Mixin_ChromaKeyForceSky { public abstract class Mixin_ChromaKeyForceSky {
@Shadow @Final private MinecraftClient client; @Shadow @Final private MinecraftClient client;
//#if MC>=11700
//$$ // Sky appears to be rendered unconditionally now
//#else
//#if MC>=11500 //#if MC>=11500
@ModifyConstant(method = "render", constant = @Constant(intValue = 4)) @ModifyConstant(method = "render", constant = @Constant(intValue = 4))
//#elseif MC>=11400 //#elseif MC>=11400
@@ -44,4 +47,5 @@ public abstract class Mixin_ChromaKeyForceSky {
} }
return value; return value;
} }
//#endif
} }

View File

@@ -41,6 +41,11 @@ import net.minecraft.sound.SoundCategory;
import net.minecraft.client.render.RenderTickCounter; import net.minecraft.client.render.RenderTickCounter;
import org.lwjgl.glfw.GLFW; import org.lwjgl.glfw.GLFW;
//#if MC>=12000
//$$ import com.mojang.blaze3d.systems.VertexSorter;
//$$ import net.minecraft.client.gui.DrawContext;
//#endif
//#if MC>=11700 //#if MC>=11700
//$$ import net.minecraft.client.render.DiffuseLighting; //$$ import net.minecraft.client.render.DiffuseLighting;
//$$ import net.minecraft.util.math.Matrix4f; //$$ import net.minecraft.util.math.Matrix4f;
@@ -492,7 +497,11 @@ public class VideoRenderer implements RenderInfo {
//$$ (float) (window.getFramebufferHeight() / window.getScaleFactor()), //$$ (float) (window.getFramebufferHeight() / window.getScaleFactor()),
//$$ 1000, //$$ 1000,
//$$ 3000 //$$ 3000
//$$ )); //$$ )
//#if MC>=12000
//$$ , VertexSorter.BY_Z
//#endif
//$$ );
//$$ MatrixStack matrixStack = RenderSystem.getModelViewStack(); //$$ MatrixStack matrixStack = RenderSystem.getModelViewStack();
//$$ matrixStack.loadIdentity(); //$$ matrixStack.loadIdentity();
//$$ matrixStack.translate(0, 0, -2000); //$$ matrixStack.translate(0, 0, -2000);
@@ -544,7 +553,9 @@ public class VideoRenderer implements RenderInfo {
try { try {
mc.currentScreen = gui.toMinecraft(); mc.currentScreen = gui.toMinecraft();
mc.getOverlay().render( mc.getOverlay().render(
//#if MC>=11600 //#if MC>=12000
//$$ new DrawContext(mc, mc.getBufferBuilders().getEntityVertexConsumers()),
//#elseif MC>=11600
new MatrixStack(), new MatrixStack(),
//#endif //#endif
mouseX, mouseY, 0); mouseX, mouseY, 0);
@@ -554,7 +565,9 @@ public class VideoRenderer implements RenderInfo {
} else { } else {
gui.toMinecraft().tick(); gui.toMinecraft().tick();
gui.toMinecraft().render( gui.toMinecraft().render(
//#if MC>=11600 //#if MC>=12000
//$$ new DrawContext(mc, mc.getBufferBuilders().getEntityVertexConsumers()),
//#elseif MC>=11600
new MatrixStack(), new MatrixStack(),
//#endif //#endif
mouseX, mouseY, 0); mouseX, mouseY, 0);

View File

@@ -440,7 +440,11 @@ public class FullReplaySender extends ChannelDuplexHandler implements ReplaySend
//#endif //#endif
LightingProvider provider = world.getChunkManager().getLightingProvider(); LightingProvider provider = world.getChunkManager().getLightingProvider();
while (provider.hasUpdates()) { while (provider.hasUpdates()) {
//#if MC>=12000
//$$ provider.doLightUpdates();
//#else
provider.doLightUpdates(Integer.MAX_VALUE, true, true); provider.doLightUpdates(Integer.MAX_VALUE, true, true);
//#endif
} }
} }
}; };
@@ -712,6 +716,9 @@ public class FullReplaySender extends ChannelDuplexHandler implements ReplaySend
//#if MC>=11900 //#if MC>=11900
//$$ , java.util.Optional.empty() //$$ , java.util.Optional.empty()
//#endif //#endif
//#if MC>=12000
//$$ , packet.portalCooldown()
//#endif
); );
//#else //#else
//#if MC>=10800 //#if MC>=10800
@@ -775,6 +782,9 @@ public class FullReplaySender extends ChannelDuplexHandler implements ReplaySend
//#if MC>=11900 //#if MC>=11900
//$$ , java.util.Optional.empty() //$$ , java.util.Optional.empty()
//#endif //#endif
//#if MC>=12000
//$$ , respawn.getPortalCooldown()
//#endif
); );
//#else //#else
//#if MC>=10809 //#if MC>=10809

View File

@@ -5,6 +5,7 @@ import com.replaymod.core.utils.WrappedTimer;
import com.replaymod.core.versions.MCVer; import com.replaymod.core.versions.MCVer;
import com.replaymod.replay.camera.CameraController; import com.replaymod.replay.camera.CameraController;
import com.replaymod.replay.camera.CameraEntity; import com.replaymod.replay.camera.CameraEntity;
import de.johni0702.minecraft.gui.versions.ScreenExt;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.RenderTickCounter; import net.minecraft.client.render.RenderTickCounter;
@@ -78,7 +79,7 @@ public class InputReplayTimer extends WrappedTimer {
// tick speed may vary or there may not be any ticks at all (when the replay is paused) // tick speed may vary or there may not be any ticks at all (when the replay is paused)
if (mod.getReplayHandler() != null && mc.world != null && mc.player != null) { if (mod.getReplayHandler() != null && mc.world != null && mc.player != null) {
//#if MC>=11400 //#if MC>=11400
if (mc.currentScreen == null || mc.currentScreen.passEvents) { if (mc.currentScreen == null || ((ScreenExt) mc.currentScreen).doesPassEvents()) {
GLFW.glfwPollEvents(); GLFW.glfwPollEvents();
MCVer.processKeyBinds(); MCVer.processKeyBinds();
} }

View File

@@ -42,6 +42,11 @@ import net.minecraft.network.ClientConnection;
import java.io.IOException; import java.io.IOException;
import java.util.*; import java.util.*;
//#if MC>=12000
//$$ import com.mojang.blaze3d.systems.VertexSorter;
//$$ import net.minecraft.client.gui.DrawContext;
//#endif
//#if MC>=11904 //#if MC>=11904
//$$ import net.minecraft.network.PacketBundler; //$$ import net.minecraft.network.PacketBundler;
//#endif //#endif
@@ -653,7 +658,11 @@ public class ReplayHandler {
//$$ (float) (window.getFramebufferHeight() / window.getScaleFactor()), //$$ (float) (window.getFramebufferHeight() / window.getScaleFactor()),
//$$ 1000, //$$ 1000,
//$$ 3000 //$$ 3000
//$$ )); //$$ )
//#if MC>=12000
//$$ , VertexSorter.BY_Z
//#endif
//$$ );
//$$ MatrixStack matrixStack = RenderSystem.getModelViewStack(); //$$ MatrixStack matrixStack = RenderSystem.getModelViewStack();
//$$ matrixStack.loadIdentity(); //$$ matrixStack.loadIdentity();
//$$ matrixStack.translate(0, 0, -2000); //$$ matrixStack.translate(0, 0, -2000);
@@ -676,7 +685,9 @@ public class ReplayHandler {
//#endif //#endif
guiScreen.toMinecraft().init(mc, window.getScaledWidth(), window.getScaledHeight()); guiScreen.toMinecraft().init(mc, window.getScaledWidth(), window.getScaledHeight());
//#if MC>=11600 //#if MC>=12000
//$$ guiScreen.toMinecraft().render(new DrawContext(mc, mc.getBufferBuilders().getEntityVertexConsumers()), 0, 0, 0);
//#elseif MC>=11600
guiScreen.toMinecraft().render(new MatrixStack(), 0, 0, 0); guiScreen.toMinecraft().render(new MatrixStack(), 0, 0, 0);
//#else //#else
//#if MC>=11400 //#if MC>=11400

View File

@@ -12,6 +12,7 @@ public final class Setting<T> extends SettingsRegistry.SettingKeys<T> {
public static final SettingsRegistry.MultipleChoiceSettingKeys<String> CAMERA = public static final SettingsRegistry.MultipleChoiceSettingKeys<String> CAMERA =
new SettingsRegistry.MultipleChoiceSettingKeys<>( new SettingsRegistry.MultipleChoiceSettingKeys<>(
"replay", "camera", "replaymod.gui.settings.camera", "replaymod.camera.classic"); "replay", "camera", "replaymod.gui.settings.camera", "replaymod.camera.classic");
public static final Setting<Boolean> LEGACY_MAIN_MENU_BUTTON = new Setting<>("legacyMainMenuButton", false);
public static final SettingsRegistry.MultipleChoiceSettingKeys<String> MAIN_MENU_BUTTON = public static final SettingsRegistry.MultipleChoiceSettingKeys<String> MAIN_MENU_BUTTON =
new SettingsRegistry.MultipleChoiceSettingKeys<>( new SettingsRegistry.MultipleChoiceSettingKeys<>(
"replay", "mainMenuButton", null, MainMenuButtonPosition.DEFAULT.name()); "replay", "mainMenuButton", null, MainMenuButtonPosition.DEFAULT.name());

View File

@@ -332,7 +332,12 @@ public class CameraEntity
public void afterSpawn() { public void afterSpawn() {
// Make sure our world is up-to-date in case of world changes // Make sure our world is up-to-date in case of world changes
if (this.client.world != null) { if (this.client.world != null) {
// FIXME cannot use Patters because `setWorld` is `protected` in 1.20
//#if MC>=12000
//$$ this.setWorld(this.client.world);
//#else
this.world = this.client.world; this.world = this.client.world;
//#endif
} }
super.afterSpawn(); super.afterSpawn();
} }

View File

@@ -16,6 +16,27 @@ import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.AbstractButtonWidget; import net.minecraft.client.gui.widget.AbstractButtonWidget;
//#if MC>=12000
//$$ import net.minecraft.client.gui.DrawContext;
//#endif
//#if MC>=11904
//#else
import net.minecraft.client.MinecraftClient;
//#endif
//#if MC>=11903
//$$ import net.minecraft.client.gui.tooltip.Tooltip;
//#endif
//#if MC>=11604
import de.johni0702.minecraft.gui.MinecraftGuiRenderer;
import net.fabricmc.fabric.api.client.screen.v1.Screens;
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.ModContainer;
import net.minecraft.client.util.math.MatrixStack;
//#endif
//#if MC>=11600 //#if MC>=11600
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.TranslatableText;
@@ -36,6 +57,7 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Comparator; import java.util.Comparator;
import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.stream.Stream; import java.util.stream.Stream;
@@ -124,6 +146,7 @@ public class GuiHandler extends EventRegistrations {
b.getWidth(), b.getWidth(),
b.getHeight(), b.getHeight(),
"replaymod.gui.exit", "replaymod.gui.exit",
null,
this::onButton this::onButton
)); ));
} else if (id.equals(BUTTON_ADVANCEMENTS)) { } else if (id.equals(BUTTON_ADVANCEMENTS)) {
@@ -226,6 +249,119 @@ public class GuiHandler extends EventRegistrations {
return; return;
} }
//#if MC>=11604
if (mod.getCore().getSettingsRegistry().get(Setting.LEGACY_MAIN_MENU_BUTTON)) {
legacyInjectIntoMainMenu(guiScreen, buttonList);
} else {
properInjectIntoMainMenu(guiScreen);
}
//#else
//$$ legacyInjectIntoMainMenu(guiScreen, buttonList);
//#endif
}
//#if MC>=11604
private void properInjectIntoMainMenu(Screen screen) {
List<AbstractButtonWidget> buttonList = Screens.getButtons(screen);
MainMenuButtonPosition buttonPosition = MainMenuButtonPosition.valueOf(mod.getCore().getSettingsRegistry().get(Setting.MAIN_MENU_BUTTON));
// Workaround for FancyMenu v2 initializing the screen twice, likely fixed in v3
if (isFancyMenu2Installed()) {
for (AbstractButtonWidget button : buttonList) {
if (button instanceof InjectedButton) {
return;
}
}
}
Point pos;
if (buttonPosition == MainMenuButtonPosition.BIG) {
int x = screen.width / 2 - 100;
// We want to position our button below the realms button
Optional<AbstractButtonWidget> targetButton = findButton(buttonList, "menu.online", 14)
.map(Optional::of)
// or, if someone removed the realms button, we'll alternatively take the multiplayer one
.orElseGet(() -> findButton(buttonList, "menu.multiplayer", 2));
int y = targetButton
// if we found some button, put our button at its position (we'll move it out of the way shortly)
.map(it -> it.y)
// and if we can't even find that one, then just guess
.orElse(screen.height / 4 + 10 + 4 * 24);
// Move all buttons above or at our one upwards
moveAllButtonsInRect(buttonList,
x, x + 200,
Integer.MIN_VALUE, y,
-24);
pos = new Point(x, y);
} else {
pos = determineButtonPos(buttonPosition, screen, buttonList);
}
AbstractButtonWidget replayViewerButton;
if (buttonPosition == MainMenuButtonPosition.BIG) {
replayViewerButton = new InjectedButton(
screen, BUTTON_REPLAY_VIEWER,
pos.getX(), pos.getY(),
200, 20,
"replaymod.gui.replayviewer",
null,
this::onButton
);
} else {
replayViewerButton = new InjectedButton(
screen, BUTTON_REPLAY_VIEWER,
pos.getX(), pos.getY(),
20, 20,
"",
"replaymod.gui.replayviewer",
this::onButton
) {
@Override
//#if MC>=12000
//$$ public void renderButton(DrawContext context, int mouseX, int mouseY, float delta) {
//$$ super.renderButton(context, mouseX, mouseY, delta);
//#elseif MC>=11904
//$$ public void renderButton(MatrixStack context, int mouseX, int mouseY, float delta) {
//$$ super.renderButton(context, mouseX, mouseY, delta);
//#else
protected void renderBg(MatrixStack context, MinecraftClient client, int mouseX, int mouseY) {
super.renderBg(context, client, mouseX, mouseY);
//#endif
MinecraftGuiRenderer renderer = new MinecraftGuiRenderer(context);
renderer.bindTexture(GuiReplayButton.ICON);
renderer.drawTexturedRect(
this.x + 3, this.y + 3,
0, 0,
this.width - 6, this.height - 6,
1, 1,
1, 1
);
}
};
}
int index = determineButtonIndex(buttonList, replayViewerButton);
if (index != -1) {
buttonList.add(index, replayViewerButton);
} else {
buttonList.add(replayViewerButton);
}
}
private boolean isFancyMenu2Installed() {
ModContainer mod = FabricLoader.getInstance().getModContainer("fancymenu").orElse(null);
if (mod == null) {
return false;
}
return mod.getMetadata().getVersion().getFriendlyString().startsWith("2.");
}
//#endif
private void legacyInjectIntoMainMenu(Screen guiScreen, Collection<AbstractButtonWidget> buttonList) {
boolean isCustomMainMenuMod = guiScreen.getClass().getName().endsWith("custommainmenu.gui.GuiFakeMain"); boolean isCustomMainMenuMod = guiScreen.getClass().getName().endsWith("custommainmenu.gui.GuiFakeMain");
MainMenuButtonPosition buttonPosition = MainMenuButtonPosition.valueOf(mod.getCore().getSettingsRegistry().get(Setting.MAIN_MENU_BUTTON)); MainMenuButtonPosition buttonPosition = MainMenuButtonPosition.valueOf(mod.getCore().getSettingsRegistry().get(Setting.MAIN_MENU_BUTTON));
@@ -280,6 +416,7 @@ public class GuiHandler extends EventRegistrations {
200, 200,
20, 20,
"replaymod.gui.replayviewer", "replaymod.gui.replayviewer",
null,
this::onButton this::onButton
); );
//#if FABRIC<=0 //#if FABRIC<=0
@@ -356,6 +493,27 @@ public class GuiHandler extends EventRegistrations {
} }
} }
private int determineButtonIndex(Collection<AbstractButtonWidget> buttons, AbstractButtonWidget button) {
AbstractButtonWidget best = null;
int bestIndex = -1;
int index = 0;
for (AbstractButtonWidget other : buttons) {
if (other.y > button.y || other.y == button.y && other.x > button.x) {
index++;
continue;
}
if (best == null || other.y > best.y || other.y == best.y && other.x > best.x) {
best = other;
bestIndex = index + 1;
}
index++;
}
return bestIndex;
}
//#if MC>=11400 //#if MC>=11400
private void onButton(InjectedButton button) { private void onButton(InjectedButton button) {
Screen guiScreen = button.guiScreen; Screen guiScreen = button.guiScreen;
@@ -396,6 +554,7 @@ public class GuiHandler extends EventRegistrations {
public final int id; public final int id;
private Consumer<InjectedButton> onClick; private Consumer<InjectedButton> onClick;
public InjectedButton(Screen guiScreen, int buttonId, int x, int y, int width, int height, String buttonText, public InjectedButton(Screen guiScreen, int buttonId, int x, int y, int width, int height, String buttonText,
String tooltip,
//#if MC>=11400 //#if MC>=11400
Consumer<InjectedButton> onClick Consumer<InjectedButton> onClick
//#else //#else
@@ -418,6 +577,11 @@ public class GuiHandler extends EventRegistrations {
//#if MC>=11400 //#if MC>=11400
, self -> onClick.accept((InjectedButton) self) , self -> onClick.accept((InjectedButton) self)
//#endif //#endif
//#if MC>=11600 && MC<11903
, tooltip != null
? (button, matrices, mouseX, mouseY) -> guiScreen.renderTooltip(matrices, new TranslatableText(tooltip), mouseX, mouseY)
: EMPTY
//#endif
//#if MC>=11903 //#if MC>=11903
//$$ , DEFAULT_NARRATION_SUPPLIER //$$ , DEFAULT_NARRATION_SUPPLIER
//#endif //#endif
@@ -429,6 +593,12 @@ public class GuiHandler extends EventRegistrations {
//#else //#else
//$$ this.onClick = null; //$$ this.onClick = null;
//#endif //#endif
//#if MC>=11903
//$$ if (tooltip != null) {
//$$ setTooltip(Tooltip.of(Text.translatable(tooltip)));
//$$ }
//#endif
} }
//#if MC>=11400 && MC<11400 //#if MC>=11400 && MC<11400

View File

@@ -29,7 +29,8 @@
"com.replaymod.render.utils.FlawlessFrames::registerConsumer" "com.replaymod.render.utils.FlawlessFrames::registerConsumer"
], ],
"preLaunch": [ "preLaunch": [
"com.replaymod.core.DummyChainLoadEntryPoint" "com.replaymod.core.DummyChainLoadEntryPoint",
"com.replaymod.core.MixinExtrasInit"
], ],
"mm:early_risers": [ "mm:early_risers": [
"com.replaymod.core.ReplayModMMLauncher" "com.replaymod.core.ReplayModMMLauncher"

View File

@@ -1 +1 @@
2.6.12 2.6.13

View File

@@ -30,6 +30,7 @@ public class LoadingPlugin implements IFMLLoadingPlugin {
MixinBootstrap.init(); MixinBootstrap.init();
} }
Mixins.addConfiguration("mixins.jgui.json");
Mixins.addConfiguration("mixins.core.replaymod.json"); Mixins.addConfiguration("mixins.core.replaymod.json");
Mixins.addConfiguration("mixins.recording.replaymod.json"); Mixins.addConfiguration("mixins.recording.replaymod.json");
Mixins.addConfiguration("mixins.render.replaymod.json"); Mixins.addConfiguration("mixins.render.replaymod.json");

View File

@@ -29,7 +29,8 @@
"com.replaymod.render.utils.FlawlessFrames::registerConsumer" "com.replaymod.render.utils.FlawlessFrames::registerConsumer"
], ],
"preLaunch": [ "preLaunch": [
"com.replaymod.core.DummyChainLoadEntryPoint" "com.replaymod.core.DummyChainLoadEntryPoint",
"com.replaymod.core.MixinExtrasInit"
], ],
"mm:early_risers": [ "mm:early_risers": [
"com.replaymod.core.ReplayModMMLauncher" "com.replaymod.core.ReplayModMMLauncher"

View File

@@ -29,7 +29,8 @@
"com.replaymod.render.utils.FlawlessFrames::registerConsumer" "com.replaymod.render.utils.FlawlessFrames::registerConsumer"
], ],
"preLaunch": [ "preLaunch": [
"com.replaymod.core.DummyChainLoadEntryPoint" "com.replaymod.core.DummyChainLoadEntryPoint",
"com.replaymod.core.MixinExtrasInit"
], ],
"mm:early_risers": [ "mm:early_risers": [
"com.replaymod.core.ReplayModMMLauncher" "com.replaymod.core.ReplayModMMLauncher"