Merge pull request #257 from LindaJuffermans:develop
This commit is contained in:
@@ -23,7 +23,7 @@ import com.replaymod.core.events.PostRenderCallback;
|
||||
public class FullBrightness extends EventRegistrations implements Extra {
|
||||
private ReplayModReplay module;
|
||||
|
||||
private final IGuiImage indicator = new GuiImage().setTexture(ReplayMod.TEXTURE, 90, 20, 19, 13).setSize(19, 13);
|
||||
private final IGuiImage indicator = new GuiImage().setTexture(ReplayMod.TEXTURE, 90, 20, 19, 16).setSize(19, 16);
|
||||
|
||||
private MinecraftClient mc;
|
||||
private boolean active;
|
||||
|
||||
@@ -52,7 +52,7 @@ public class HotkeyButtons extends EventRegistrations implements Extra {
|
||||
|
||||
public Gui(ReplayMod mod, GuiReplayOverlay overlay) {
|
||||
toggleButton = new GuiTexturedButton(overlay).setSize(20, 20)
|
||||
.setTexture(ReplayMod.TEXTURE, ReplayMod.TEXTURE_SIZE).setTexturePosH(0, 0)
|
||||
.setTexture(ReplayMod.TEXTURE, ReplayMod.TEXTURE_SIZE).setTexturePosH(0, 120)
|
||||
.onClick(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
52
src/main/java/com/replaymod/extras/QuickMode.java
Normal file
52
src/main/java/com/replaymod/extras/QuickMode.java
Normal file
@@ -0,0 +1,52 @@
|
||||
package com.replaymod.extras;
|
||||
|
||||
import com.replaymod.core.ReplayMod;
|
||||
import com.replaymod.core.versions.MCVer.Keyboard;
|
||||
import com.replaymod.replay.ReplayHandler;
|
||||
import com.replaymod.replay.ReplayModReplay;
|
||||
import com.replaymod.replay.events.ReplayOpenedCallback;
|
||||
import com.replaymod.replay.gui.overlay.GuiReplayOverlay;
|
||||
import de.johni0702.minecraft.gui.element.GuiImage;
|
||||
import de.johni0702.minecraft.gui.layout.HorizontalLayout;
|
||||
import de.johni0702.minecraft.gui.utils.EventRegistrations;
|
||||
|
||||
public class QuickMode extends EventRegistrations implements Extra {
|
||||
private ReplayModReplay module;
|
||||
|
||||
private final GuiImage indicator = new GuiImage().setTexture(ReplayMod.TEXTURE, 40, 100, 16, 16).setSize(16, 16);
|
||||
|
||||
@Override
|
||||
public void register(final ReplayMod mod) {
|
||||
this.module = ReplayModReplay.instance;
|
||||
|
||||
mod.getKeyBindingRegistry().registerKeyBinding("replaymod.input.quickmode", Keyboard.KEY_Q, () -> {
|
||||
ReplayHandler replayHandler = module.getReplayHandler();
|
||||
if (replayHandler == null) {
|
||||
return;
|
||||
}
|
||||
replayHandler.getReplaySender().setSyncModeAndWait();
|
||||
mod.runLater(() -> {
|
||||
replayHandler.ensureQuickModeInitialized(() -> {
|
||||
boolean enabled = !replayHandler.isQuickMode();
|
||||
updateIndicator(replayHandler.getOverlay(), enabled);
|
||||
replayHandler.setQuickMode(enabled);
|
||||
replayHandler.getReplaySender().setAsyncMode(true);
|
||||
});
|
||||
});
|
||||
}, true);
|
||||
|
||||
register();
|
||||
}
|
||||
|
||||
{
|
||||
on(ReplayOpenedCallback.EVENT, replayHandler -> updateIndicator(replayHandler.getOverlay(), replayHandler.isQuickMode()));
|
||||
}
|
||||
|
||||
private void updateIndicator(GuiReplayOverlay overlay, boolean enabled) {
|
||||
if (enabled) {
|
||||
overlay.statusIndicatorPanel.addElements(new HorizontalLayout.Data(1), indicator);
|
||||
} else {
|
||||
overlay.statusIndicatorPanel.removeElement(indicator);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ public class ReplayModExtras implements Module {
|
||||
PlayerOverview.class,
|
||||
YoutubeUpload.class,
|
||||
FullBrightness.class,
|
||||
QuickMode.class,
|
||||
HotkeyButtons.class,
|
||||
OpenEyeExtra.class
|
||||
);
|
||||
|
||||
@@ -125,17 +125,6 @@ public class ReplayModReplay implements Module {
|
||||
}
|
||||
}, true);
|
||||
|
||||
registry.registerKeyBinding("replaymod.input.quickmode", Keyboard.KEY_Q, () -> {
|
||||
if (replayHandler != null) {
|
||||
replayHandler.getReplaySender().setSyncModeAndWait();
|
||||
core.runLater(() ->
|
||||
replayHandler.ensureQuickModeInitialized(() -> {
|
||||
replayHandler.setQuickMode(!replayHandler.isQuickMode());
|
||||
replayHandler.getReplaySender().setAsyncMode(true);
|
||||
}));
|
||||
}
|
||||
}, true);
|
||||
|
||||
core.getKeyBindingRegistry().registerKeyBinding("replaymod.input.rollclockwise", Keyboard.KEY_L, () -> {
|
||||
// Noop, actual handling logic in CameraEntity#update
|
||||
}, true);
|
||||
|
||||
@@ -57,7 +57,7 @@ public class GuiReplayOverlay extends AbstractGuiOverlay<GuiReplayOverlay> {
|
||||
* This is not used by the replay module itself but may be used by other modules/extras to show
|
||||
* when they're active.
|
||||
*/
|
||||
public final GuiPanel statusIndicatorPanel = new GuiPanel(this).setSize(100, 20)
|
||||
public final GuiPanel statusIndicatorPanel = new GuiPanel(this).setSize(100, 16)
|
||||
.setLayout(new HorizontalLayout(HorizontalLayout.Alignment.RIGHT).setSpacing(5));
|
||||
|
||||
private final EventHandler eventHandler = new EventHandler();
|
||||
@@ -78,7 +78,7 @@ public class GuiReplayOverlay extends AbstractGuiOverlay<GuiReplayOverlay> {
|
||||
pos(topPanel, 10, 10);
|
||||
size(topPanel, width - 20, 20);
|
||||
|
||||
pos(statusIndicatorPanel, width / 2, height - 25);
|
||||
pos(statusIndicatorPanel, width / 2, height - 21);
|
||||
width(statusIndicatorPanel, width / 2 - 5);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user