diff --git a/src/main/java/eu/crushedpixel/replaymod/events/GuiReplayOverlay.java b/src/main/java/eu/crushedpixel/replaymod/events/GuiReplayOverlay.java index 1c4da8c9..3c81d904 100755 --- a/src/main/java/eu/crushedpixel/replaymod/events/GuiReplayOverlay.java +++ b/src/main/java/eu/crushedpixel/replaymod/events/GuiReplayOverlay.java @@ -176,13 +176,7 @@ public class GuiReplayOverlay extends Gui { if(!mouseDown) { mouseDown = true; if(hover) { - boolean paused = !ReplayMod.replaySender.paused(); - if(paused) { - ReplayMod.replaySender.setReplaySpeed(0); - } else { - ReplayMod.replaySender.setReplaySpeed(speedSlider.getSliderValue()); - } - + playOrPause(); } else if(mouseX >= exportButtonX && mouseX <= exportButtonX + 20 && mouseY >= exportButtonY && exportButtonY <= exportButtonY + 20) { ReplayHandler.startPath(true); } @@ -728,4 +722,13 @@ public class GuiReplayOverlay extends Gui { return small_min; } } + + public void playOrPause() { + boolean paused = !ReplayMod.replaySender.paused(); + if(paused) { + ReplayMod.replaySender.setReplaySpeed(0); + } else { + ReplayMod.replaySender.setReplaySpeed(speedSlider.getSliderValue()); + } + } } diff --git a/src/main/java/eu/crushedpixel/replaymod/events/KeyInputHandler.java b/src/main/java/eu/crushedpixel/replaymod/events/KeyInputHandler.java index 2a7b0b79..8b3ec75e 100755 --- a/src/main/java/eu/crushedpixel/replaymod/events/KeyInputHandler.java +++ b/src/main/java/eu/crushedpixel/replaymod/events/KeyInputHandler.java @@ -104,6 +104,10 @@ public class KeyInputHandler { public void handleCustomKeybindings(KeyBinding kb, boolean found, int keyCode) { //Custom registered handlers + if(kb.getKeyDescription().equals(KeybindRegistry.KEY_PLAY_PAUSE) && (kb.isPressed() || kb.getKeyCode() == keyCode) && !ReplayHandler.isInPath()) { + ReplayMod.overlay.playOrPause(); + } + if(kb.getKeyDescription().equals(KeybindRegistry.KEY_ROTATE_CLOCKWISE) && (kb.isKeyDown() || kb.getKeyCode() == keyCode) && !ReplayHandler.isInPath()) { ReplayHandler.addCameraTilt(Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL) ? 1 : 5); } diff --git a/src/main/java/eu/crushedpixel/replaymod/registry/KeybindRegistry.java b/src/main/java/eu/crushedpixel/replaymod/registry/KeybindRegistry.java index 582ddf73..019750a3 100755 --- a/src/main/java/eu/crushedpixel/replaymod/registry/KeybindRegistry.java +++ b/src/main/java/eu/crushedpixel/replaymod/registry/KeybindRegistry.java @@ -19,6 +19,7 @@ public class KeybindRegistry { public static final String KEY_ROTATE_CLOCKWISE = "replaymod.input.rotateclockwise"; public static final String KEY_ROTATE_COUNTERCLOCKWISE = "replaymod.input.rotatecounterclockwise"; public static final String KEY_RESET_TILT = "replaymod.input.resettilt"; + public static final String KEY_PLAY_PAUSE = "replaymod.input.playpause"; private static Minecraft mc = Minecraft.getMinecraft(); public static void initialize() { @@ -33,6 +34,7 @@ public class KeybindRegistry { bindings.add(new KeyBinding(KEY_ROTATE_CLOCKWISE, Keyboard.KEY_L, "replaymod.title")); bindings.add(new KeyBinding(KEY_RESET_TILT, Keyboard.KEY_K, "replaymod.title")); bindings.add(new KeyBinding(KEY_ROTATE_COUNTERCLOCKWISE, Keyboard.KEY_J, "replaymod.title")); + bindings.add(new KeyBinding(KEY_PLAY_PAUSE, Keyboard.KEY_P, "replaymod.title")); mc.gameSettings.keyBindings = bindings.toArray(new KeyBinding[bindings.size()]); diff --git a/src/main/resources/assets/replaymod/lang/en_US.lang b/src/main/resources/assets/replaymod/lang/en_US.lang index 826eb1f2..15f253c5 100644 --- a/src/main/resources/assets/replaymod/lang/en_US.lang +++ b/src/main/resources/assets/replaymod/lang/en_US.lang @@ -196,6 +196,7 @@ replaymod.input.keyframerepository=Open Keyframe Presets replaymod.input.rotateclockwise=Rotate Clockwise replaymod.input.rotatecounterclockwise=Rotate Counterclockwise replaymod.input.resettilt=Reset Camera Tilt +replaymod.input.playpause=Play/Pause Replay #Keyframe Presets GUI replaymod.gui.keyframerepository.title=Keyframe Repository