Update to 20w22a (minimal mode only)

This commit is contained in:
Jonas Herzig
2020-06-04 11:54:33 +02:00
parent 6210cb09aa
commit 88be6b3935
26 changed files with 293 additions and 83 deletions

View File

@@ -261,6 +261,9 @@ public class ReplayMod implements
}
}
};
//#if MC>=11600
//$$ // TODO
//#else
//#if MC>=11400
mc.getResourcePackManager().registerProvider(new ResourcePackProvider() {
@Override
@@ -273,6 +276,7 @@ public class ReplayMod implements
//$$ List<IResourcePack> defaultResourcePacks = ((MinecraftAccessor) mc).getDefaultResourcePacks();
//$$ defaultResourcePacks.add(jGuiResourcePack);
//#endif
//#endif
//#if MC<=10710
//$$ FolderResourcePack mainResourcePack = new FolderResourcePack(new File("../src/main/resources")) {
//$$ @Override
@@ -649,13 +653,19 @@ public class ReplayMod implements
if (getSettingsRegistry().get(Setting.NOTIFICATIONS)) {
// Some nostalgia: "§8[§6Replay Mod§8]§r Your message goes here"
//#if MC>=10904
//#if MC>=11600
//$$ Style coloredDarkGray = Style.EMPTY.withColor(Formatting.DARK_GRAY);
//$$ Style coloredGold = Style.EMPTY.withColor(Formatting.GOLD);
//$$ Style alert = Style.EMPTY.withColor(warning ? Formatting.RED : Formatting.DARK_GREEN);
//#else
Style coloredDarkGray = new Style().setColor(Formatting.DARK_GRAY);
Style coloredGold = new Style().setColor(Formatting.GOLD);
Style alert = new Style().setColor(warning ? Formatting.RED : Formatting.DARK_GREEN);
//#endif
Text text = new LiteralText("[").setStyle(coloredDarkGray)
.append(new TranslatableText("replaymod.title").setStyle(coloredGold))
.append(new LiteralText("] "))
.append(new TranslatableText(message, args).setStyle(new Style()
.setColor(warning ? Formatting.RED : Formatting.DARK_GREEN)));
.append(new TranslatableText(message, args).setStyle(alert));
//#else
//$$ ChatStyle coloredDarkGray = new ChatStyle().setColor(EnumChatFormatting.DARK_GRAY);
//$$ ChatStyle coloredGold = new ChatStyle().setColor(EnumChatFormatting.GOLD);

View File

@@ -5,13 +5,16 @@ import de.johni0702.minecraft.gui.utils.EventRegistrations;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.TitleScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.realms.RealmsScreenProxy;
import org.lwjgl.opengl.GL11;
import java.util.List;
import static com.replaymod.core.versions.MCVer.*;
//#if MC>=11400 && MC<11600
import net.minecraft.realms.RealmsScreenProxy;
//#endif
//#if FABRIC>=1
import de.johni0702.minecraft.gui.versions.callbacks.InitScreenCallback;
//#else
@@ -68,7 +71,7 @@ public class MainMenuHandler extends EventRegistrations {
}
//#endif
}
//#if MC>=11400
//#if MC>=11400 && MC<11600
GuiMainMenuAccessor guiA = (GuiMainMenuAccessor) gui;
if (realmsOffset != 0 && guiA.getRealmsNotification() instanceof RealmsScreenProxy) {
guiA.setRealmsNotification(new RealmsNotificationProxy((RealmsScreenProxy) guiA.getRealmsNotification(), realmsOffset));
@@ -77,7 +80,7 @@ public class MainMenuHandler extends EventRegistrations {
}
}
//#if MC>=11400
//#if MC>=11400 && MC<11600
private static class RealmsNotificationProxy extends Screen {
private final RealmsScreenProxy proxy;
private final int offset;

View File

@@ -19,25 +19,39 @@ public class WrappedTimer extends RenderTickCounter {
}
@Override
public void beginRenderTick(
public
//#if MC>=11600
//$$ int
//#else
void
//#endif
beginRenderTick(
//#if MC>=11400
long sysClock
//#endif
) {
copy(this, wrapped);
wrapped.beginRenderTick(
//#if MC>=11400
sysClock
//#endif
);
copy(wrapped, this);
try {
//#if MC>=11600
//$$ return
//#endif
wrapped.beginRenderTick(
//#if MC>=11400
sysClock
//#endif
);
} finally {
copy(wrapped, this);
}
}
protected void copy(RenderTickCounter from, RenderTickCounter to) {
TimerAccessor fromA = (TimerAccessor) from;
TimerAccessor toA = (TimerAccessor) to;
//#if MC<11600
to.ticksThisFrame = from.ticksThisFrame;
//#endif
to.tickDelta = from.tickDelta;
toA.setLastSyncSysClock(fromA.getLastSyncSysClock());
to.lastFrameDuration = from.lastFrameDuration;

View File

@@ -82,11 +82,15 @@ public class HotkeyButtons extends EventRegistrations implements Extra {
// There doesn't seem to be an KeyBindingUpdate event, so we'll just update it every time
String keyName = "???";
try {
//#if MC>=11600
//$$ keyName = keyBinding.getBoundKeyLocalizedText().asString();
//#else
//#if MC>=11400
keyName = keyBinding.getLocalizedName();
//#else
//$$ keyName = Keyboard.getKeyName(keyBinding.getKeyCode());
//#endif
//#endif
} catch (ArrayIndexOutOfBoundsException e) {
// Apparently windows likes to press strange keys, see https://www.replaymod.com/forum/thread/55
}

View File

@@ -116,7 +116,7 @@ public class PlayerOverviewGui extends GuiScreen implements Closeable {
}.setSize(16, 16),
new GuiLabel().setText(
//#if MC>=11400
p.getName().asFormattedString()
p.getName().asString()
//#else
//#if MC>=10800
//$$ p.getName()
@@ -181,7 +181,7 @@ public class PlayerOverviewGui extends GuiScreen implements Closeable {
if (isSpectator(o1) && !isSpectator(o2)) return 1;
if (isSpectator(o2) && !isSpectator(o1)) return -1;
//#if MC>=11400
return o1.getName().asFormattedString().compareToIgnoreCase(o2.getName().asFormattedString());
return o1.getName().asString().compareToIgnoreCase(o2.getName().asString());
//#else
//#if MC>=10800
//$$ return o1.getName().compareToIgnoreCase(o2.getName());

View File

@@ -124,10 +124,13 @@ public abstract class AbstractTimelinePlayer extends EventRegistrations {
float timeInTicks = replayTime / 50f;
float previousTimeInTicks = lastTime / 50f;
float passedTicks = timeInTicks - previousTimeInTicks;
RenderTickCounter timer = ((MinecraftAccessor) mc).getTimer();
timer.tickDelta += passedTicks;
timer.ticksThisFrame = (int) timer.tickDelta;
timer.tickDelta -= timer.ticksThisFrame;
RenderTickCounter renderTickCounter = ((MinecraftAccessor) mc).getTimer();
if (renderTickCounter instanceof ReplayTimer) {
ReplayTimer timer = (ReplayTimer) renderTickCounter;
timer.tickDelta += passedTicks;
timer.ticksThisFrame = (int) timer.tickDelta;
timer.tickDelta -= timer.ticksThisFrame;
}
lastTime = replayTime;

View File

@@ -14,6 +14,10 @@ public class ReplayTimer extends WrappedTimer {
//$$ private final Timer state = new Timer(0);
//#endif
//#if MC>=11600
//$$ public int ticksThisFrame;
//#endif
public ReplayTimer(RenderTickCounter wrapped) {
super(wrapped);
}
@@ -21,7 +25,13 @@ public class ReplayTimer extends WrappedTimer {
@Override
// This should be handled by Remap but it isn't (was handled before a9724e3).
//#if MC>=11400
public void beginRenderTick(
public
//#if MC>=11600
//$$ int
//#else
void
//#endif
beginRenderTick(
//#else
//$$ public void updateTimer(
//#endif
@@ -30,13 +40,22 @@ public class ReplayTimer extends WrappedTimer {
//#endif
) {
copy(this, state); // Save our current state
wrapped.beginRenderTick(
//#if MC>=11400
sysClock
//#endif
); // Update current state
copy(state, this); // Restore our old state
UpdatedCallback.EVENT.invoker().onUpdate();
try {
//#if MC>=11600
//$$ ticksThisFrame =
//#endif
wrapped.beginRenderTick(
//#if MC>=11400
sysClock
//#endif
); // Update current state
} finally {
copy(state, this); // Restore our old state
UpdatedCallback.EVENT.invoker().onUpdate();
}
//#if MC>=11600
//$$ return ticksThisFrame;
//#endif
}
public RenderTickCounter getWrapped() {

View File

@@ -9,6 +9,7 @@ import de.johni0702.minecraft.gui.utils.EventRegistrations;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.client.util.math.MatrixStack;
//#if FABRIC>=1
import de.johni0702.minecraft.gui.versions.callbacks.RenderHudCallback;
@@ -41,21 +42,26 @@ public class GuiRecordingOverlay extends EventRegistrations {
* Render the recording icon and text in the top left corner of the screen.
*/
//#if FABRIC>=1
{ on(RenderHudCallback.EVENT, partialTicks -> renderRecordingIndicator()); }
private void renderRecordingIndicator() {
{ on(RenderHudCallback.EVENT, (stack, partialTicks) -> renderRecordingIndicator(stack)); }
private void renderRecordingIndicator(MatrixStack stack) {
//#else
//$$ @SubscribeEvent
//$$ public void renderRecordingIndicator(RenderGameOverlayEvent.Post event) {
//$$ if (getType(event) != RenderGameOverlayEvent.ElementType.ALL) return;
//$$ MatrixStack stack = new MatrixStack();
//#endif
if (guiControls.isStopped()) return;
if (settingsRegistry.get(Setting.INDICATOR)) {
TextRenderer fontRenderer = mc.textRenderer;
String text = guiControls.isPaused() ? I18n.translate("replaymod.gui.paused") : I18n.translate("replaymod.gui.recording");
fontRenderer.draw(text.toUpperCase(), 30, 18 - (fontRenderer.fontHeight / 2), 0xffffffff);
fontRenderer.draw(
//#if MC>=11600
//$$ stack,
//#endif
text.toUpperCase(), 30, 18 - (fontRenderer.fontHeight / 2), 0xffffffff);
bindTexture(TEXTURE);
enableAlphaTest();
GuiRenderer renderer = new MinecraftGuiRenderer(MCVer.newScaledResolution(mc));
GuiRenderer renderer = new MinecraftGuiRenderer(stack, MCVer.newScaledResolution(mc));
renderer.drawTexturedRect(10, 10, 58, 20, 16, 16, 16, 16, TEXTURE_SIZE, TEXTURE_SIZE);
}
}

View File

@@ -18,6 +18,9 @@ import net.minecraft.client.MinecraftClient;
import net.minecraft.network.ClientConnection;
import org.apache.logging.log4j.Logger;
//#if MC>=11600
//$$ import net.minecraft.world.World;
//#else
//#if MC>=11400
import net.minecraft.world.dimension.DimensionType;
//#endif
@@ -25,6 +28,7 @@ import net.minecraft.world.dimension.DimensionType;
//#if MC>=10800
import net.minecraft.world.level.LevelGeneratorType;
//#endif
//#endif
import java.io.File;
import java.text.SimpleDateFormat;
@@ -60,10 +64,14 @@ public class ConnectionEventHandler {
boolean local = networkManager.isLocal();
if (local) {
//#if MC>=10800
//#if MC>=11600
//$$ if (mc.getServer().getWorld(World.field_25179).isDebugWorld()) {
//#else
//#if MC>=11400
if (mc.getServer().getWorld(DimensionType.OVERWORLD).getGeneratorType() == LevelGeneratorType.DEBUG_ALL_BLOCK_STATES) {
//#else
//$$ if (mc.getIntegratedServer().getEntityWorld().getWorldType() == WorldType.DEBUG_ALL_BLOCK_STATES) {
//#endif
//#endif
logger.info("Debug World recording is not supported.");
return;
@@ -82,7 +90,11 @@ public class ConnectionEventHandler {
String worldName;
if (local) {
//#if MC>=11600
//$$ worldName = mc.getServer().method_27728().getLevelName();
//#else
worldName = mc.getServer().getLevelName();
//#endif
} else if (mc.getCurrentServerEntry() != null) {
worldName = mc.getCurrentServerEntry().address;
//#if MC>=11100

View File

@@ -207,9 +207,13 @@ public class RecordingEventHandler extends EventRegistrations {
//$$ (byte) Math.round(dx * 32), (byte) Math.round(dy * 32), (byte) Math.round(dz * 32),
//#endif
newYaw, newPitch
//#if MC>=11600
//$$ , player.isOnGround()
//#else
//#if MC>=10800
, player.onGround
//#endif
//#endif
);
}

View File

@@ -10,16 +10,25 @@ import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvent;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.level.LevelProperties;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
//#if MC>=11600
//$$ import net.minecraft.util.registry.RegistryKey;
//$$ import net.minecraft.world.MutableWorldProperties;
//$$ import java.util.function.Supplier;
//#else
import net.minecraft.world.level.LevelProperties;
//#endif
//#if MC>=11400
import net.minecraft.world.chunk.ChunkManager;
//#if MC<11600
import net.minecraft.world.dimension.Dimension;
//#endif
import net.minecraft.world.dimension.DimensionType;
import java.util.function.BiFunction;
//#else
@@ -38,6 +47,11 @@ public abstract class MixinWorldClient extends World implements RecordingEventHa
@Shadow
private MinecraftClient client;
//#if MC>=11600
//$$ protected MixinWorldClient(MutableWorldProperties mutableWorldProperties, RegistryKey<World> registryKey, RegistryKey<DimensionType> registryKey2, DimensionType dimensionType, Supplier<Profiler> profiler, boolean bl, boolean bl2, long l) {
//$$ super(mutableWorldProperties, registryKey, registryKey2, dimensionType, profiler, bl, bl2, l);
//$$ }
//#else
//#if MC>=11400
protected MixinWorldClient(LevelProperties levelProperties_1, DimensionType dimensionType_1, BiFunction<World, Dimension, ChunkManager> biFunction_1, Profiler profiler_1, boolean boolean_1) {
super(levelProperties_1, dimensionType_1, biFunction_1, profiler_1, boolean_1);
@@ -61,6 +75,7 @@ public abstract class MixinWorldClient extends World implements RecordingEventHa
//$$ info, providerIn, profilerIn, client);
//$$ }
//#endif
//#endif
private RecordingEventHandler replayModRecording_getRecordingEventHandler() {
return ((RecordingEventHandler.RecordingEventSender) this.client.worldRenderer).getRecordingEventHandler();

View File

@@ -32,6 +32,10 @@ import net.minecraft.util.crash.CrashException;
import net.minecraft.sound.SoundCategory;
import net.minecraft.client.render.RenderTickCounter;
//#if MC>=11600
//$$ import net.minecraft.client.util.math.MatrixStack;
//#endif
//#if MC>=11500
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.util.Window;
@@ -160,7 +164,9 @@ public class VideoRenderer implements RenderInfo {
//$$ timer.timerSpeed = 1;
//#endif
while (replayTime < videoStart) {
//#if MC<11600
timer.ticksThisFrame = 1;
//#endif
replayTime += 50;
replayHandler.getReplaySender().sendPacketsTill(replayTime);
tick();
@@ -218,6 +224,11 @@ public class VideoRenderer implements RenderInfo {
// Updating the timer will cause the timeline player to update the game state
RenderTickCounter timer = ((MinecraftAccessor) mc).getTimer();
//#if MC>=11600
//$$ int elapsedTicks =
//#else
int elapsedTicks = timer.ticksThisFrame;
//#endif
timer.beginRenderTick(
//#if MC>=11400
MCVer.milliTime()
@@ -232,7 +243,6 @@ public class VideoRenderer implements RenderInfo {
//$$ }
//#endif
int elapsedTicks = timer.ticksThisFrame;
while (elapsedTicks-- > 0) {
tick();
}
@@ -501,7 +511,11 @@ public class VideoRenderer implements RenderInfo {
int mouseY = (int) mc.mouse.getY() * getWindow(mc).getScaledHeight() / displayHeight;
gui.toMinecraft().tick();
gui.toMinecraft().render(mouseX, mouseY, 0);
gui.toMinecraft().render(
//#if MC>=11600
//$$ new MatrixStack(),
//#endif
mouseX, mouseY, 0);
//#else
//$$ int mouseX = Mouse.getX() * scaled.getScaledWidth() / mc.displayWidth;
//$$ int mouseY = scaled.getScaledHeight() - Mouse.getY() * scaled.getScaledHeight() / mc.displayHeight - 1;

View File

@@ -591,14 +591,27 @@ public class FullReplaySender extends ChannelDuplexHandler implements ReplaySend
packet.getSeed(),
//#endif
false,
//#if MC>=11600
//$$ packet.method_29443(),
//$$ (net.minecraft.world.dimension.DimensionTracker.Modifiable) packet.getDimension(),
//$$ packet.method_29444(),
//$$ packet.getDimensionId(),
//#else
packet.getDimension(),
//#endif
0, // max players (has no getter -> never actually used)
//#if MC<11600
packet.getGeneratorType(),
//#endif
packet.getChunkLoadDistance(),
packet.hasReducedDebugInfo()
//#if MC>=11500
, packet.showsDeathScreen()
//#endif
//#if MC>=11600
//$$ , packet.isDebugWorld()
//$$ , packet.isFlatWorld()
//#endif
);
//#else
//#if MC>=10800
@@ -638,12 +651,22 @@ public class FullReplaySender extends ChannelDuplexHandler implements ReplaySend
PlayerRespawnS2CPacket respawn = (PlayerRespawnS2CPacket) p;
//#if MC>=11400
p = new PlayerRespawnS2CPacket(
//#if MC>=11600
//$$ respawn.method_29445(),
//#endif
respawn.getDimension(),
//#if MC>=11500
respawn.getSha256Seed(),
//#endif
//#if MC>=11600
//$$ GameMode.SPECTATOR,
//$$ respawn.isDebugWorld(),
//$$ respawn.isFlatWorld(),
//$$ respawn.isWritingErrorSkippable()
//#else
respawn.getGeneratorType(),
GameMode.SPECTATOR
//#endif
);
//#else
//#if MC>=10809

View File

@@ -45,11 +45,20 @@ public class InputReplayTimer extends WrappedTimer {
}
@Override
public void beginRenderTick(
public
//#if MC>=11600
//$$ int
//#else
void
//#endif
beginRenderTick(
//#if MC>=11400
long sysClock
//#endif
) {
//#if MC>=11600
//$$ int ticksThisFrame =
//#endif
super.beginRenderTick(
//#if MC>=11400
sysClock
@@ -114,6 +123,9 @@ public class InputReplayTimer extends WrappedTimer {
//$$ }
//#endif
}
//#if MC>=11600
//$$ return ticksThisFrame;
//#endif
}
public static void handleScroll(int wheel) {

View File

@@ -24,7 +24,6 @@ import net.minecraft.network.NetworkState;
import net.minecraft.network.NetworkSide;
import net.minecraft.network.Packet;
import net.minecraft.util.PacketByteBuf;
import net.minecraft.world.level.LevelGeneratorType;
//#if FABRIC>=1
import de.johni0702.minecraft.gui.versions.callbacks.PreTickCallback;
@@ -40,6 +39,11 @@ import java.io.IOException;
import java.util.Collections;
import java.util.function.Consumer;
//#if MC>=11600
//$$ import net.minecraft.world.World;
//#else
import net.minecraft.world.level.LevelGeneratorType;
//#endif
//#if MC>=11400
import net.minecraft.world.dimension.DimensionType;
//#else
@@ -190,6 +194,15 @@ public class QuickReplaySender extends ChannelHandlerAdapter implements ReplaySe
public void restart() {
replay.reset();
ctx.fireChannelRead(new PlayerRespawnS2CPacket(
//#if MC>=11600
//$$ DimensionType.OVERWORLD_REGISTRY_KEY,
//$$ World.field_25179,
//$$ 0,
//$$ GameMode.SPECTATOR,
//$$ false,
//$$ false,
//$$ false
//#else
//#if MC>=11400
DimensionType.OVERWORLD,
//#else
@@ -203,6 +216,7 @@ public class QuickReplaySender extends ChannelHandlerAdapter implements ReplaySe
//#endif
LevelGeneratorType.DEFAULT,
GameMode.SPECTATOR
//#endif
));
ctx.fireChannelRead(new PlayerPositionLookS2CPacket(0, 0, 0, 0, 0, Collections.emptySet(), 0));
}

View File

@@ -19,15 +19,17 @@ import com.replaymod.replay.gui.overlay.GuiReplayOverlay;
import com.replaymod.replaystudio.data.Marker;
import com.replaymod.replaystudio.replay.ReplayFile;
import com.replaymod.replaystudio.util.Location;
import de.johni0702.minecraft.gui.container.AbstractGuiScreen;
import de.johni0702.minecraft.gui.container.GuiContainer;
import de.johni0702.minecraft.gui.container.GuiScreen;
import de.johni0702.minecraft.gui.element.GuiLabel;
import de.johni0702.minecraft.gui.element.advanced.GuiProgressBar;
import de.johni0702.minecraft.gui.layout.HorizontalLayout;
import de.johni0702.minecraft.gui.popup.AbstractGuiPopup;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.embedded.EmbeddedChannel;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.network.ClientLoginNetworkHandler;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.util.crash.CrashReport;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
@@ -36,6 +38,10 @@ import net.minecraft.network.ClientConnection;
import java.io.IOException;
import java.util.*;
//#if MC>=11500
//$$ import net.minecraft.client.util.math.MatrixStack;
//#endif
//#if MC>=11500
import com.mojang.blaze3d.systems.RenderSystem;
import org.lwjgl.opengl.GL11;
@@ -180,7 +186,7 @@ public class ReplayHandler {
//#else
//$$ // We need to re-set the GUI screen because having one with `allowsUserInput = true` active during world
//$$ // load (i.e. before player is set) will crash MC...
//$$ mc.displayGuiScreen(new GuiScreen() {});
//$$ mc.displayGuiScreen(new net.minecraft.client.gui.GuiScreen() {});
//$$ mc.loadWorld(null);
//#endif
@@ -592,22 +598,10 @@ public class ReplayHandler {
replaySender.jumpToTime(targetTime);
} else { // We either have to restart the replay or send a significant amount of packets
// Render our please-wait-screen
Screen guiScreen = new Screen(
//#if MC>=11400
null
//#endif
) {
@Override
//#if MC>=11400
public void render(int mouseX, int mouseY, float partialTicks) {
//#else
//$$ public void drawScreen(int mouseX, int mouseY, float partialTicks) {
//#endif
renderDirtBackground(0);
drawCenteredString(this.minecraft.textRenderer, I18n.translate("replaymod.gui.pleasewait"),
width / 2, height / 2, 0xffffffff);
}
};
GuiScreen guiScreen = new GuiScreen();
guiScreen.setBackground(AbstractGuiScreen.Background.DIRT);
guiScreen.addElements(new HorizontalLayout.Data(0.5),
new GuiLabel().setI18nText("replaymod.gui.pleasewait"));
// Make sure that the replaysender changes into sync mode
replaySender.setSyncModeAndWait();
@@ -648,12 +642,17 @@ public class ReplayHandler {
//$$ ScaledResolution
//#endif
resolution = newScaledResolution(mc);
guiScreen.init(mc, resolution.getScaledWidth(), resolution.getScaledHeight());
//#if MC>=11400
guiScreen.render(0, 0, 0);
guiScreen.toMinecraft().init(mc, resolution.getScaledWidth(), resolution.getScaledHeight());
//#if MC>=11600
//$$ guiScreen.toMinecraft().render(new MatrixStack(), 0, 0, 0);
//#else
//$$ guiScreen.drawScreen(0, 0, 0);
//#if MC>=11400
guiScreen.toMinecraft().render(0, 0, 0);
//#else
//$$ guiScreen.toMinecraft().drawScreen(0, 0, 0);
//#endif
//#endif
guiScreen.toMinecraft().removed();
mc.getFramebuffer().endWrite();
popMatrix();

View File

@@ -153,6 +153,10 @@ public class CameraEntity
//#if MC>=11200
, recipeBook
//#endif
//#if MC>=11600
//$$ , false
//$$ , false
//#endif
);
eventHandler.register();
if (ReplayModReplay.instance.getReplayHandler().getSpectatedUUID() == null) {

View File

@@ -10,6 +10,11 @@ import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.AbstractButtonWidget;
import net.minecraft.client.resource.language.I18n;
//#if MC>=11600
//$$ import net.minecraft.text.Text;
//$$ import net.minecraft.text.TranslatableText;
//#endif
//#if FABRIC>=1
import de.johni0702.minecraft.gui.versions.callbacks.InitScreenCallback;
//#else
@@ -56,6 +61,13 @@ public class GuiHandler extends EventRegistrations {
// Pause replay when menu is opened
mod.getReplayHandler().getReplaySender().setReplaySpeed(0);
//#if MC>=11600
//$$ final TranslatableText BUTTON_OPTIONS = new TranslatableText("menu.options");
//$$ final TranslatableText BUTTON_EXIT_SERVER = new TranslatableText("menu.disconnect");
//$$ final TranslatableText BUTTON_ADVANCEMENTS = new TranslatableText("gui.advancements");
//$$ final TranslatableText BUTTON_STATS = new TranslatableText("gui.stats");
//$$ final TranslatableText BUTTON_OPEN_TO_LAN = new TranslatableText("menu.shareToLan");
//#else
//#if MC>=11400
final String BUTTON_OPTIONS = I18n.translate("menu.options");
final String BUTTON_EXIT_SERVER = I18n.translate("menu.disconnect");
@@ -71,6 +83,7 @@ public class GuiHandler extends EventRegistrations {
//$$ final int BUTTON_STATS = 6;
//$$ final int BUTTON_OPEN_TO_LAN = 7;
//#endif
//#endif
//#if MC<11400
@@ -85,7 +98,11 @@ public class GuiHandler extends EventRegistrations {
//#endif
boolean remove = false;
//#if MC>=11400
//#if MC>=11600
//$$ Text id = b.getMessage();
//#else
String id = b.getMessage();
//#endif
if (id == null) {
// likely a button of some third-part mod
// e.g. https://github.com/Pokechu22/WorldDownloader/blob/b1b279f948beec2d7dac7524eea8f584a866d8eb/share_14/src/main/java/wdl/WDLHooks.java#L491
@@ -104,7 +121,7 @@ public class GuiHandler extends EventRegistrations {
b.y,
width(b),
height(b),
I18n.translate("replaymod.gui.exit"),
"replaymod.gui.exit",
this::onButton
));
} else if (id.equals(BUTTON_ADVANCEMENTS)) {
@@ -216,7 +233,7 @@ public class GuiHandler extends EventRegistrations {
guiScreen.height / 4 + 10 + 4 * 24,
200,
20,
I18n.translate("replaymod.gui.replayviewer"),
"replaymod.gui.replayviewer",
this::onButton
);
//#if FABRIC<=0
@@ -283,7 +300,11 @@ public class GuiHandler extends EventRegistrations {
y,
width,
height,
buttonText
//#if MC>=11600
//$$ new TranslatableText(buttonText)
//#else
I18n.translate(buttonText)
//#endif
//#if MC>=11400
, self -> onClick.accept((InjectedButton) self)
//#endif

View File

@@ -3,13 +3,18 @@ package com.replaymod.replay.mixin;
//#if MC>=10904
import net.minecraft.client.particle.Particle;
import net.minecraft.client.particle.ParticleManager;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
//#if MC>=11600
//$$ import net.minecraft.client.world.ClientWorld;
//#else
import net.minecraft.world.World;
//#endif
import java.util.Queue;
@Mixin(ParticleManager.class)
@@ -30,7 +35,13 @@ public abstract class MixinParticleManager {
* @param ci Callback info
*/
@Inject(method = "setWorld", at = @At("HEAD"))
public void replayModReplay_clearParticleQueue(World world, CallbackInfo ci) {
public void replayModReplay_clearParticleQueue(
//#if MC>=11600
//$$ ClientWorld world,
//#else
World world,
//#endif
CallbackInfo ci) {
//#if MC>=11400
this.newParticles.clear();
//#else

View File

@@ -60,6 +60,10 @@ public abstract class MixinPlayerControllerMP {
//#endif
StatHandler statisticsManager,
ClientRecipeBook recipeBookClient,
//#if MC>=11600
//$$ boolean lastIsHoldingSneakKey,
//$$ boolean lastSprinting,
//#endif
CallbackInfoReturnable<ClientPlayerEntity> ci
) {
if (ReplayModReplay.instance.getReplayHandler() != null) {