Release 2.4.1
This commit is contained in:
2
jGui
2
jGui
Submodule jGui updated: 20e11e0803...037d54f83a
@@ -7,6 +7,11 @@ 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.render.Camera;
|
||||
//$$ import net.minecraft.client.util.math.MatrixStack;
|
||||
//#endif
|
||||
|
||||
//#if MC>=11400
|
||||
import com.replaymod.core.events.PreRenderHandCallback;
|
||||
//#else
|
||||
@@ -21,8 +26,18 @@ import com.replaymod.core.events.PreRenderHandCallback;
|
||||
}, remap = false)
|
||||
public abstract class MixinShadersRender {
|
||||
|
||||
@Inject(method = "renderHand0", at = @At("HEAD"), cancellable = true, remap = false)
|
||||
private static void replayModCompat_disableRenderHand0(GameRenderer er, float partialTicks, int renderPass, CallbackInfo ci) {
|
||||
@Inject(method = { "renderHand0", "renderHand1" }, at = @At("HEAD"), cancellable = true, remap = false)
|
||||
private static void replayModCompat_disableRenderHand0(
|
||||
GameRenderer er,
|
||||
//#if MC>=11600
|
||||
//$$ MatrixStack stack,
|
||||
//$$ Camera camera,
|
||||
//#endif
|
||||
float partialTicks,
|
||||
//#if MC<11600
|
||||
int renderPass,
|
||||
//#endif
|
||||
CallbackInfo ci) {
|
||||
//#if MC>=11400
|
||||
if (PreRenderHandCallback.EVENT.invoker().preRenderHand()) {
|
||||
//#else
|
||||
|
||||
@@ -23,6 +23,7 @@ import static com.replaymod.core.ReplayMod.MOD_ID;
|
||||
import com.replaymod.core.events.KeyBindingEventCallback;
|
||||
import com.replaymod.core.events.KeyEventCallback;
|
||||
import com.replaymod.core.events.PreRenderCallback;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
//#else
|
||||
//$$ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
//$$ import net.minecraftforge.fml.common.gameevent.InputEvent;
|
||||
@@ -34,7 +35,9 @@ import com.replaymod.core.events.PreRenderCallback;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class KeyBindingRegistry extends EventRegistrations {
|
||||
private static final String CATEGORY = "replaymod.title";
|
||||
@@ -43,19 +46,20 @@ public class KeyBindingRegistry extends EventRegistrations {
|
||||
//#endif
|
||||
|
||||
private Map<String, KeyBinding> keyBindings = new HashMap<String, KeyBinding>();
|
||||
private Set<KeyBinding> onlyInReplay = new HashSet<>();
|
||||
private Multimap<KeyBinding, Runnable> keyBindingHandlers = ArrayListMultimap.create();
|
||||
private Multimap<KeyBinding, Runnable> repeatedKeyBindingHandlers = ArrayListMultimap.create();
|
||||
private Multimap<Integer, Runnable> rawHandlers = ArrayListMultimap.create();
|
||||
|
||||
public void registerKeyBinding(String name, int keyCode, Runnable whenPressed) {
|
||||
keyBindingHandlers.put(registerKeyBinding(name, keyCode), whenPressed);
|
||||
public void registerKeyBinding(String name, int keyCode, Runnable whenPressed, boolean onlyInRepay) {
|
||||
keyBindingHandlers.put(registerKeyBinding(name, keyCode, onlyInRepay), whenPressed);
|
||||
}
|
||||
|
||||
public void registerRepeatedKeyBinding(String name, int keyCode, Runnable whenPressed) {
|
||||
repeatedKeyBindingHandlers.put(registerKeyBinding(name, keyCode), whenPressed);
|
||||
public void registerRepeatedKeyBinding(String name, int keyCode, Runnable whenPressed, boolean onlyInRepay) {
|
||||
repeatedKeyBindingHandlers.put(registerKeyBinding(name, keyCode, onlyInRepay), whenPressed);
|
||||
}
|
||||
|
||||
private KeyBinding registerKeyBinding(String name, int keyCode) {
|
||||
private KeyBinding registerKeyBinding(String name, int keyCode, boolean onlyInRepay) {
|
||||
KeyBinding keyBinding = keyBindings.get(name);
|
||||
if (keyBinding == null) {
|
||||
//#if FABRIC>=1
|
||||
@@ -71,6 +75,11 @@ public class KeyBindingRegistry extends EventRegistrations {
|
||||
//$$ ClientRegistry.registerKeyBinding(keyBinding);
|
||||
//#endif
|
||||
keyBindings.put(name, keyBinding);
|
||||
if (onlyInRepay) {
|
||||
this.onlyInReplay.add(keyBinding);
|
||||
}
|
||||
} else if (!onlyInRepay) {
|
||||
this.onlyInReplay.remove(keyBinding);
|
||||
}
|
||||
return keyBinding;
|
||||
}
|
||||
@@ -83,6 +92,10 @@ public class KeyBindingRegistry extends EventRegistrations {
|
||||
return Collections.unmodifiableMap(keyBindings);
|
||||
}
|
||||
|
||||
public Set<KeyBinding> getOnlyInReplay() {
|
||||
return Collections.unmodifiableSet(onlyInReplay);
|
||||
}
|
||||
|
||||
//#if MC>=11400
|
||||
{ on(KeyBindingEventCallback.EVENT, this::handleKeyBindings); }
|
||||
{ on(KeyEventCallback.EVENT, (keyCode, scanCode, action, modifiers) -> handleRaw(keyCode, action)); }
|
||||
@@ -133,7 +146,7 @@ public class KeyBindingRegistry extends EventRegistrations {
|
||||
|
||||
//#if MC>=11400
|
||||
private void handleRaw(int keyCode, int action) {
|
||||
if (action != 0) return;
|
||||
if (action != GLFW.GLFW_PRESS) return;
|
||||
//#else
|
||||
//$$ private void handleRaw() {
|
||||
//$$ int keyCode = Keyboard.getEventKey() == 0 ? Keyboard.getEventCharacter() + 256 : Keyboard.getEventKey();
|
||||
|
||||
@@ -318,7 +318,7 @@ public class ReplayMod implements
|
||||
public void registerKeyBindings(KeyBindingRegistry registry) {
|
||||
registry.registerKeyBinding("replaymod.input.settings", 0, () -> {
|
||||
new GuiReplaySettings(null, settingsRegistry).display();
|
||||
});
|
||||
}, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
//#if MC>=11400
|
||||
package com.replaymod.core.mixin;
|
||||
|
||||
import com.replaymod.core.ReplayMod;
|
||||
import com.replaymod.replay.ReplayModReplay;
|
||||
import net.minecraft.client.options.KeyBinding;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* We have bunch of keybindings which only have an effect while in a replay but heavily conflict with vanilla ones
|
||||
* otherwise. To work around this, we prevent our keybindings (or conflicting ones) from making it into the keysByCode
|
||||
* map, depending on the current context.
|
||||
*/
|
||||
@Mixin(KeyBinding.class)
|
||||
public class Mixin_ContextualKeyBindings {
|
||||
@Shadow @Final private static Map<String, KeyBinding> keysById;
|
||||
|
||||
@Unique private static final List<KeyBinding> temporarilyRemoved = new ArrayList<>();
|
||||
|
||||
@Inject(method = "updateKeysByCode", at = @At("HEAD"))
|
||||
private static void preContextualKeyBindings(CallbackInfo ci) {
|
||||
Set<KeyBinding> onlyInReplay = ReplayMod.instance.getKeyBindingRegistry().getOnlyInReplay();
|
||||
if (ReplayModReplay.instance.getReplayHandler() != null) {
|
||||
// In replay, remove any conflicting key bindings, so that ours are guaranteed in
|
||||
Mixin_ContextualKeyBindings.keysById.values().removeIf(keyBinding -> {
|
||||
for (KeyBinding exclusiveBinding : onlyInReplay) {
|
||||
if (keyBinding.equals(exclusiveBinding) && keyBinding != exclusiveBinding) {
|
||||
temporarilyRemoved.add(keyBinding);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
} else {
|
||||
// Not in a replay, remove all replay-exclusive keybindings
|
||||
for (KeyBinding keyBinding : onlyInReplay) {
|
||||
if (Mixin_ContextualKeyBindings.keysById.remove(keyBinding.getId()) != null) {
|
||||
temporarilyRemoved.add(keyBinding);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "updateKeysByCode", at = @At("RETURN"))
|
||||
private static void postContextualKeyBindings(CallbackInfo ci) {
|
||||
for (KeyBinding keyBinding : temporarilyRemoved) {
|
||||
Mixin_ContextualKeyBindings.keysById.put(keyBinding.getId(), keyBinding);
|
||||
}
|
||||
temporarilyRemoved.clear();
|
||||
}
|
||||
}
|
||||
//#endif
|
||||
@@ -42,6 +42,12 @@ import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.gui.widget.AbstractButtonWidget;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
//#if MC>=11600
|
||||
//$$ import net.minecraft.text.TranslatableText;
|
||||
//#else
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
//#endif
|
||||
//#else
|
||||
//$$ import com.google.common.util.concurrent.FutureCallback;
|
||||
//$$ import com.google.common.util.concurrent.Futures;
|
||||
@@ -119,6 +125,7 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Abstraction over things that have changed between different MC versions.
|
||||
@@ -603,6 +610,31 @@ public class MCVer {
|
||||
//#endif
|
||||
}
|
||||
|
||||
//#if MC>=11400
|
||||
public static Optional<AbstractButtonWidget> findButton(List<AbstractButtonWidget> buttonList, @SuppressWarnings("unused") String text, @SuppressWarnings("unused") int id) {
|
||||
//#if MC>=11600
|
||||
//$$ final TranslatableText message = new TranslatableText(text);
|
||||
//#else
|
||||
final String message = I18n.translate(text);
|
||||
//#endif
|
||||
for (AbstractButtonWidget b : buttonList) {
|
||||
if (message.equals(b.getMessage())) {
|
||||
return Optional.of(b);
|
||||
}
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
//#else
|
||||
//$$ public static Optional<GuiButton> findButton(List<GuiButton> buttonList, @SuppressWarnings("unused") String text, int id) {
|
||||
//$$ for (GuiButton b : buttonList) {
|
||||
//$$ if (b.id == id) {
|
||||
//$$ return Optional.of(b);
|
||||
//$$ }
|
||||
//$$ }
|
||||
//$$ return Optional.empty();
|
||||
//$$ }
|
||||
//#endif
|
||||
|
||||
//#if MC>=11400
|
||||
public static void processKeyBinds() {
|
||||
((MinecraftMethodAccessor) getMinecraft()).replayModProcessKeyBinds();
|
||||
|
||||
@@ -53,7 +53,7 @@ public class FullBrightness extends EventRegistrations implements Extra {
|
||||
updateIndicator(replayHandler.getOverlay());
|
||||
}
|
||||
}
|
||||
});
|
||||
}, true);
|
||||
|
||||
register();
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ public class PlayerOverview extends EventRegistrations implements Extra {
|
||||
new PlayerOverviewGui(PlayerOverview.this, players).display();
|
||||
}
|
||||
}
|
||||
});
|
||||
}, true);
|
||||
|
||||
register();
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public class ReplayModRecording implements Module {
|
||||
core.printInfoToChat("replaymod.chat.addedmarker");
|
||||
}
|
||||
}
|
||||
});
|
||||
}, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,13 +7,13 @@ import com.replaymod.editor.gui.MarkerProcessor;
|
||||
import com.replaymod.recording.Setting;
|
||||
import com.replaymod.recording.packet.PacketListener;
|
||||
import de.johni0702.minecraft.gui.container.GuiPanel;
|
||||
import de.johni0702.minecraft.gui.container.GuiScreen;
|
||||
import de.johni0702.minecraft.gui.container.VanillaGuiScreen;
|
||||
import de.johni0702.minecraft.gui.element.GuiButton;
|
||||
import de.johni0702.minecraft.gui.layout.CustomLayout;
|
||||
import de.johni0702.minecraft.gui.layout.HorizontalLayout;
|
||||
import de.johni0702.minecraft.gui.utils.EventRegistrations;
|
||||
import net.minecraft.client.gui.screen.GameMenuScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
|
||||
//#if FABRIC>=1
|
||||
import de.johni0702.minecraft.gui.versions.callbacks.InitScreenCallback;
|
||||
@@ -25,6 +25,14 @@ import de.johni0702.minecraft.gui.versions.callbacks.InitScreenCallback;
|
||||
//$$ import static com.replaymod.core.versions.MCVer.getGui;
|
||||
//#endif
|
||||
|
||||
//#if MC>=11400
|
||||
import net.minecraft.client.gui.widget.AbstractButtonWidget;
|
||||
//#endif
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class GuiRecordingControls extends EventRegistrations {
|
||||
private ReplayMod core;
|
||||
private PacketListener packetListener;
|
||||
@@ -70,21 +78,6 @@ public class GuiRecordingControls extends EventRegistrations {
|
||||
updateState();
|
||||
}
|
||||
|
||||
//#if FABRIC>=1
|
||||
{ on(InitScreenCallback.EVENT, (screen, buttons) -> {
|
||||
if (screen instanceof GameMenuScreen) {
|
||||
show((GameMenuScreen) screen);
|
||||
}
|
||||
}); }
|
||||
//#else
|
||||
//$$ @SubscribeEvent
|
||||
//$$ public void onGuiInit(GuiScreenEvent.InitGuiEvent.Post event) {
|
||||
//$$ if (getGui(event) instanceof IngameMenuScreen) {
|
||||
//$$ show((IngameMenuScreen) getGui(event));
|
||||
//$$ }
|
||||
//$$ }
|
||||
//#endif
|
||||
|
||||
private void updateState() {
|
||||
buttonPauseResume.setI18nLabel("replaymod.gui.recording." + (paused ? "resume" : "pause"));
|
||||
buttonStartStop.setI18nLabel("replaymod.gui.recording." + (stopped ? "start" : "stop"));
|
||||
@@ -92,12 +85,32 @@ public class GuiRecordingControls extends EventRegistrations {
|
||||
buttonPauseResume.setEnabled(!stopped);
|
||||
}
|
||||
|
||||
public void show(GameMenuScreen gui) {
|
||||
int modMenuOffset = MCVer.isModLoaded("modmenu") ? 12 : 0;
|
||||
VanillaGuiScreen.setup(gui).setLayout(new CustomLayout<GuiScreen>() {
|
||||
//#if FABRIC>=1
|
||||
{ on(InitScreenCallback.EVENT, this::injectIntoIngameMenu); }
|
||||
private void injectIntoIngameMenu(Screen guiScreen, List<AbstractButtonWidget> buttonList) {
|
||||
//#else
|
||||
//$$ @SubscribeEvent
|
||||
//$$ public void injectIntoIngameMenu(GuiScreenEvent.InitGuiEvent.Post event) {
|
||||
//$$ Screen guiScreen = getGui(event);
|
||||
//#if MC>=11400
|
||||
//$$ List<Widget> buttonList = MCVer.getButtonList(event);
|
||||
//#else
|
||||
//$$ List<net.minecraft.client.gui.GuiButton> buttonList = MCVer.getButtonList(event);
|
||||
//#endif
|
||||
//#endif
|
||||
if (!(guiScreen instanceof GameMenuScreen)) {
|
||||
return;
|
||||
}
|
||||
Function<Integer, Integer> yPos =
|
||||
MCVer.findButton(buttonList, "menu.returnToMenu", 1)
|
||||
.map(Optional::of)
|
||||
.orElse(MCVer.findButton(buttonList, "menu.disconnect", 1))
|
||||
.<Function<Integer, Integer>>map(it -> (height) -> it.y)
|
||||
.orElse((height) -> height / 4 + 120 - 16);
|
||||
VanillaGuiScreen.setup(guiScreen).setLayout(new CustomLayout<de.johni0702.minecraft.gui.container.GuiScreen>() {
|
||||
@Override
|
||||
protected void layout(GuiScreen container, int width, int height) {
|
||||
pos(panel, width / 2 - 100, height / 4 + 128 + modMenuOffset);
|
||||
protected void layout(de.johni0702.minecraft.gui.container.GuiScreen container, int width, int height) {
|
||||
pos(panel, width / 2 - 100, yPos.apply(height) + 16 + 8);
|
||||
}
|
||||
}).addElements(null, panel);
|
||||
}
|
||||
|
||||
@@ -47,6 +47,21 @@ public class RenderSettings {
|
||||
public boolean hasFixedAspectRatio() {
|
||||
return this == EQUIRECTANGULAR || this == ODS || this == CUBIC;
|
||||
}
|
||||
|
||||
@SuppressWarnings("RedundantIfStatement")
|
||||
public boolean isSupported() {
|
||||
//#if MC<10800 || MC>=11500
|
||||
if (this == BLEND) {
|
||||
return false;
|
||||
}
|
||||
//#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static RenderMethod[] getSupported() {
|
||||
return Arrays.stream(values()).filter(RenderMethod::isSupported).toArray(RenderMethod[]::new);
|
||||
}
|
||||
}
|
||||
|
||||
public enum EncodingPreset {
|
||||
@@ -90,6 +105,18 @@ public class RenderSettings {
|
||||
public String toString() {
|
||||
return I18n.translate("replaymod.gui.rendersettings.presets." + name().replace('_', '.').toLowerCase());
|
||||
}
|
||||
|
||||
public boolean isSupported() {
|
||||
if (this == BLEND) {
|
||||
return RenderMethod.BLEND.isSupported();
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static EncodingPreset[] getSupported() {
|
||||
return Arrays.stream(values()).filter(EncodingPreset::isSupported).toArray(EncodingPreset[]::new);
|
||||
}
|
||||
}
|
||||
|
||||
@AllArgsConstructor
|
||||
|
||||
@@ -75,7 +75,7 @@ public class GuiRenderSettings extends GuiScreen implements Closeable {
|
||||
}
|
||||
updateInputs();
|
||||
}
|
||||
}).setMinSize(new Dimension(0, 20)).setValues(RenderSettings.RenderMethod.values());
|
||||
}).setMinSize(new Dimension(0, 20)).setValues(RenderSettings.RenderMethod.getSupported());
|
||||
|
||||
{
|
||||
for (Map.Entry<RenderSettings.RenderMethod, IGuiClickable> entry :
|
||||
@@ -102,7 +102,7 @@ public class GuiRenderSettings extends GuiScreen implements Closeable {
|
||||
}
|
||||
updateInputs();
|
||||
}
|
||||
}).setMinSize(new Dimension(0, 20)).setValues(RenderSettings.EncodingPreset.values());
|
||||
}).setMinSize(new Dimension(0, 20)).setValues(RenderSettings.EncodingPreset.getSupported());
|
||||
|
||||
public final GuiNumberField videoWidth = new GuiNumberField().setSize(50, 20).setMinValue(1).setValidateOnFocusChange(true);
|
||||
public final GuiNumberField videoHeight = new GuiNumberField().setSize(50, 20).setMinValue(1).setValidateOnFocusChange(true);
|
||||
@@ -450,12 +450,6 @@ public class GuiRenderSettings extends GuiScreen implements Closeable {
|
||||
}
|
||||
}
|
||||
|
||||
//#if MC<10800 || MC>=11500
|
||||
if (method == RenderSettings.RenderMethod.BLEND) {
|
||||
return "replaymod.gui.rendersettings.no_blend_on_1_7_10";
|
||||
}
|
||||
//#endif
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -489,8 +483,13 @@ public class GuiRenderSettings extends GuiScreen implements Closeable {
|
||||
}
|
||||
|
||||
public void load(RenderSettings settings) {
|
||||
renderMethodDropdown.setSelected(settings.getRenderMethod());
|
||||
if (settings.getRenderMethod().isSupported()) {
|
||||
renderMethodDropdown.setSelected(settings.getRenderMethod());
|
||||
}
|
||||
RenderSettings.EncodingPreset encodingPreset = settings.getEncodingPreset();
|
||||
if (!encodingPreset.isSupported()) {
|
||||
encodingPreset = null;
|
||||
}
|
||||
if (encodingPreset == null) {
|
||||
encodingPreset = getDefaultRenderSettings().getEncodingPreset();
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.replaymod.render.RenderSettings;
|
||||
import com.replaymod.render.capturer.CaptureData;
|
||||
import com.replaymod.render.capturer.RenderInfo;
|
||||
import com.replaymod.render.capturer.WorldRenderer;
|
||||
import de.johni0702.minecraft.gui.utils.EventRegistrations;
|
||||
import lombok.Getter;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
|
||||
@@ -15,6 +16,7 @@ import net.minecraft.client.util.math.MatrixStack;
|
||||
//#if MC>=11400
|
||||
import com.replaymod.core.events.PostRenderCallback;
|
||||
import com.replaymod.core.events.PreRenderCallback;
|
||||
import com.replaymod.core.events.PreRenderHandCallback;
|
||||
//#else
|
||||
//#if MC>=11400
|
||||
//$$ import net.minecraftforge.fml.hooks.BasicEventHooks;
|
||||
@@ -25,7 +27,7 @@ import com.replaymod.core.events.PreRenderCallback;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class EntityRendererHandler implements WorldRenderer {
|
||||
public class EntityRendererHandler extends EventRegistrations implements WorldRenderer {
|
||||
public final MinecraftClient mc = MCVer.getMinecraft();
|
||||
|
||||
@Getter
|
||||
@@ -42,7 +44,12 @@ public class EntityRendererHandler implements WorldRenderer {
|
||||
this.settings = settings;
|
||||
this.renderInfo = renderInfo;
|
||||
|
||||
//#if MC>=11400
|
||||
on(PreRenderHandCallback.EVENT, () -> omnidirectional);
|
||||
//#endif
|
||||
|
||||
((IEntityRenderer) mc.gameRenderer).replayModRender_setHandler(this);
|
||||
register();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -84,6 +91,7 @@ public class EntityRendererHandler implements WorldRenderer {
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
((IEntityRenderer) mc.gameRenderer).replayModRender_setHandler(null);
|
||||
unregister();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -236,14 +236,15 @@ public class VideoRenderer implements RenderInfo {
|
||||
RenderTickCounter timer = ((MinecraftAccessor) mc).getTimer();
|
||||
//#if MC>=11600
|
||||
//$$ int elapsedTicks =
|
||||
//#else
|
||||
int elapsedTicks = timer.ticksThisFrame;
|
||||
//#endif
|
||||
timer.beginRenderTick(
|
||||
//#if MC>=11400
|
||||
MCVer.milliTime()
|
||||
//#endif
|
||||
);
|
||||
//#if MC<11600
|
||||
int elapsedTicks = timer.ticksThisFrame;
|
||||
//#endif
|
||||
|
||||
executeTaskQueue();
|
||||
|
||||
|
||||
@@ -237,7 +237,7 @@ public class ReplayHandler {
|
||||
//#endif
|
||||
overlay.setVisible(false);
|
||||
|
||||
ReplayModReplay.instance.replayHandler = null;
|
||||
ReplayModReplay.instance.forcefullyStopReplay();
|
||||
|
||||
mc.openScreen(null);
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.replaymod.replaystudio.replay.ReplayFile;
|
||||
import com.replaymod.replaystudio.replay.ZipReplayFile;
|
||||
import com.replaymod.replaystudio.studio.ReplayStudio;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.options.KeyBinding;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -46,7 +47,7 @@ public class ReplayModReplay implements Module {
|
||||
|
||||
public static Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
protected ReplayHandler replayHandler;
|
||||
private ReplayHandler replayHandler;
|
||||
|
||||
public ReplayHandler getReplayHandler() {
|
||||
return replayHandler;
|
||||
@@ -78,7 +79,7 @@ public class ReplayModReplay implements Module {
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}, true);
|
||||
|
||||
registry.registerKeyBinding("replaymod.input.thumbnail", Keyboard.KEY_N, new Runnable() {
|
||||
@Override
|
||||
@@ -113,7 +114,7 @@ public class ReplayModReplay implements Module {
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}, true);
|
||||
|
||||
registry.registerKeyBinding("replaymod.input.playpause", Keyboard.KEY_P, new Runnable() {
|
||||
@Override
|
||||
@@ -122,7 +123,7 @@ public class ReplayModReplay implements Module {
|
||||
replayHandler.getOverlay().playPauseButton.onClick();
|
||||
}
|
||||
}
|
||||
});
|
||||
}, true);
|
||||
|
||||
registry.registerKeyBinding("replaymod.input.quickmode", Keyboard.KEY_Q, () -> {
|
||||
if (replayHandler != null) {
|
||||
@@ -133,19 +134,19 @@ public class ReplayModReplay implements Module {
|
||||
replayHandler.getReplaySender().setAsyncMode(true);
|
||||
}));
|
||||
}
|
||||
});
|
||||
}, true);
|
||||
|
||||
core.getKeyBindingRegistry().registerKeyBinding("replaymod.input.rollclockwise", Keyboard.KEY_L, () -> {
|
||||
// Noop, actual handling logic in CameraEntity#update
|
||||
});
|
||||
}, true);
|
||||
|
||||
core.getKeyBindingRegistry().registerKeyBinding("replaymod.input.rollcounterclockwise", Keyboard.KEY_J, () -> {
|
||||
// Noop, actual handling logic in CameraEntity#update
|
||||
});
|
||||
}, true);
|
||||
|
||||
core.getKeyBindingRegistry().registerKeyBinding("replaymod.input.resettilt", Keyboard.KEY_K, () -> {
|
||||
Optional.ofNullable(replayHandler).map(ReplayHandler::getCameraEntity).ifPresent(c -> c.roll = 0);
|
||||
});
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -191,10 +192,16 @@ public class ReplayModReplay implements Module {
|
||||
}
|
||||
}
|
||||
replayHandler = new ReplayHandler(replayFile, true);
|
||||
//#if MC>=11400
|
||||
KeyBinding.updateKeysByCode(); // see Mixin_ContextualKeyBindings
|
||||
//#endif
|
||||
}
|
||||
|
||||
public void forcefullyStopReplay() {
|
||||
replayHandler = null;
|
||||
//#if MC>=11400
|
||||
KeyBinding.updateKeysByCode(); // see Mixin_ContextualKeyBindings
|
||||
//#endif
|
||||
}
|
||||
|
||||
public ReplayMod getCore() {
|
||||
|
||||
@@ -82,13 +82,13 @@ public class ReplayModSimplePathing extends EventRegistrations implements Module
|
||||
pathPreview.registerKeyBindings(registry);
|
||||
core.getKeyBindingRegistry().registerKeyBinding("replaymod.input.keyframerepository", Keyboard.KEY_X, () -> {
|
||||
if (guiPathing != null) guiPathing.keyframeRepoButtonPressed();
|
||||
});
|
||||
}, true);
|
||||
core.getKeyBindingRegistry().registerKeyBinding("replaymod.input.clearkeyframes", Keyboard.KEY_C, () -> {
|
||||
if (guiPathing != null) guiPathing.clearKeyframesButtonPressed();
|
||||
});
|
||||
}, true);
|
||||
core.getKeyBindingRegistry().registerRepeatedKeyBinding("replaymod.input.synctimeline", Keyboard.KEY_V, () -> {
|
||||
if (guiPathing != null) guiPathing.syncTimeButtonPressed();
|
||||
});
|
||||
}, true);
|
||||
core.getKeyBindingRegistry().registerRaw(Keyboard.KEY_DELETE, () -> {
|
||||
if (guiPathing != null) guiPathing.deleteButtonPressed();
|
||||
});
|
||||
|
||||
@@ -42,7 +42,7 @@ public class PathPreview extends EventRegistrations {
|
||||
SettingsRegistry settings = mod.getCore().getSettingsRegistry();
|
||||
settings.set(Setting.PATH_PREVIEW, !settings.get(Setting.PATH_PREVIEW));
|
||||
settings.save();
|
||||
});
|
||||
}, true);
|
||||
}
|
||||
|
||||
private void update() {
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
"client": [
|
||||
//#if MC>=11400
|
||||
"AbstractButtonWidgetAccessor",
|
||||
"Mixin_ContextualKeyBindings",
|
||||
"MixinGameRenderer",
|
||||
"MixinModResourcePackUtil",
|
||||
//#endif
|
||||
|
||||
@@ -1 +1 @@
|
||||
2.4.0
|
||||
2.4.1
|
||||
|
||||
Reference in New Issue
Block a user