Changed Replay Viewer panel button (from play button to hamburger)
Added quickmode indicator (bottom-right with night vision indicator)
This commit is contained in:
@@ -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() {
|
||||
@@ -74,7 +74,7 @@ public class HotkeyButtons extends EventRegistrations implements Extra {
|
||||
|
||||
final KeyBindingRegistry keyBindingRegistry = mod.getKeyBindingRegistry();
|
||||
keyBindingRegistry.getKeyBindings().values().stream()
|
||||
.sorted(Comparator.comparing(it -> I18n.translate(it.getId())))
|
||||
.sorted(Comparator.comparing(it -> I18n.translate(it.getTranslationKey())))
|
||||
.forEachOrdered(keyBinding -> {
|
||||
GuiButton button = new GuiButton(){
|
||||
@Override
|
||||
@@ -83,10 +83,10 @@ public class HotkeyButtons extends EventRegistrations implements Extra {
|
||||
String keyName = "???";
|
||||
try {
|
||||
//#if MC>=11600
|
||||
//$$ keyName = keyBinding.getBoundKeyLocalizedText().asString();
|
||||
keyName = keyBinding.getBoundKeyLocalizedText().asString();
|
||||
//#else
|
||||
//#if MC>=11400
|
||||
keyName = keyBinding.getLocalizedName();
|
||||
//$$ keyName = keyBinding.getLocalizedName();
|
||||
//#else
|
||||
//$$ keyName = Keyboard.getKeyName(keyBinding.getKeyCode());
|
||||
//#endif
|
||||
@@ -115,7 +115,7 @@ public class HotkeyButtons extends EventRegistrations implements Extra {
|
||||
return new Dimension(Math.max(10, button.getMinSize().getWidth()) + 10, 20);
|
||||
}
|
||||
}).addElements(null, button),
|
||||
new GuiLabel().setI18nText(keyBinding.getId())
|
||||
new GuiLabel().setI18nText(keyBinding.getTranslationKey())
|
||||
));
|
||||
});
|
||||
|
||||
|
||||
65
src/main/java/com/replaymod/extras/QuickMode.java
Normal file
65
src/main/java/com/replaymod/extras/QuickMode.java
Normal file
@@ -0,0 +1,65 @@
|
||||
package com.replaymod.extras;
|
||||
|
||||
import com.replaymod.core.ReplayMod;
|
||||
import com.replaymod.core.events.PostRenderCallback;
|
||||
import com.replaymod.core.events.PreRenderCallback;
|
||||
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.element.IGuiImage;
|
||||
import de.johni0702.minecraft.gui.layout.HorizontalLayout;
|
||||
import de.johni0702.minecraft.gui.utils.EventRegistrations;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
|
||||
public class QuickMode extends EventRegistrations implements Extra {
|
||||
private ReplayModReplay module;
|
||||
|
||||
private final IGuiImage indicator = new GuiImage().setTexture(ReplayMod.TEXTURE, 40, 100, 16, 16).setSize(16, 16);
|
||||
|
||||
private MinecraftClient mc;
|
||||
private boolean active;
|
||||
//#if MC>=11400
|
||||
private double originalGamma;
|
||||
//#else
|
||||
//$$ private float originalGamma;
|
||||
//#endif
|
||||
|
||||
@Override
|
||||
public void register(final ReplayMod mod) throws Exception {
|
||||
this.module = ReplayModReplay.instance;
|
||||
this.mc = mod.getMinecraft();
|
||||
|
||||
mod.getKeyBindingRegistry().registerKeyBinding("replaymod.input.quickmode", Keyboard.KEY_Q, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
active = !active;
|
||||
ReplayHandler replayHandler = module.getReplayHandler();
|
||||
if (replayHandler == null) return;
|
||||
updateIndicator(replayHandler.getOverlay());
|
||||
replayHandler.getReplaySender().setSyncModeAndWait();
|
||||
mod.runLater(() ->
|
||||
replayHandler.ensureQuickModeInitialized(() -> {
|
||||
replayHandler.setQuickMode(active);
|
||||
replayHandler.getReplaySender().setAsyncMode(true);
|
||||
})
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
register();
|
||||
}
|
||||
|
||||
{ on(ReplayOpenedCallback.EVENT, replayHandler -> updateIndicator(replayHandler.getOverlay())); }
|
||||
private void updateIndicator(GuiReplayOverlay overlay) {
|
||||
System.out.println("QuickMode::updateIndicator; active=" + (active ? "T" : "F"));
|
||||
if (active) {
|
||||
overlay.statusIndicatorPanel.addElements(new HorizontalLayout.Data(2), 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
|
||||
);
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 12 KiB |
Reference in New Issue
Block a user