Using the DELETE Key, selected Keyframes can now be removed
Added StaticKeybindings to provide non-changeable KeyBindings
This commit is contained in:
@@ -5,6 +5,7 @@ import eu.crushedpixel.replaymod.api.ApiClient;
|
|||||||
import eu.crushedpixel.replaymod.api.replay.holders.FileInfo;
|
import eu.crushedpixel.replaymod.api.replay.holders.FileInfo;
|
||||||
import eu.crushedpixel.replaymod.chat.ChatMessageHandler;
|
import eu.crushedpixel.replaymod.chat.ChatMessageHandler;
|
||||||
import eu.crushedpixel.replaymod.events.handlers.*;
|
import eu.crushedpixel.replaymod.events.handlers.*;
|
||||||
|
import eu.crushedpixel.replaymod.events.handlers.keyboard.KeyInputHandler;
|
||||||
import eu.crushedpixel.replaymod.gui.online.GuiReplayDownloading;
|
import eu.crushedpixel.replaymod.gui.online.GuiReplayDownloading;
|
||||||
import eu.crushedpixel.replaymod.gui.overlay.GuiReplayOverlay;
|
import eu.crushedpixel.replaymod.gui.overlay.GuiReplayOverlay;
|
||||||
import eu.crushedpixel.replaymod.holders.KeyframeSet;
|
import eu.crushedpixel.replaymod.holders.KeyframeSet;
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
package eu.crushedpixel.replaymod.events.handlers;
|
package eu.crushedpixel.replaymod.events.handlers.keyboard;
|
||||||
|
|
||||||
import eu.crushedpixel.replaymod.ReplayMod;
|
import eu.crushedpixel.replaymod.ReplayMod;
|
||||||
import eu.crushedpixel.replaymod.entities.CameraEntity.MoveDirection;
|
import eu.crushedpixel.replaymod.entities.CameraEntity.MoveDirection;
|
||||||
|
import eu.crushedpixel.replaymod.events.handlers.TickAndRenderListener;
|
||||||
import eu.crushedpixel.replaymod.gui.GuiAssetManager;
|
import eu.crushedpixel.replaymod.gui.GuiAssetManager;
|
||||||
import eu.crushedpixel.replaymod.gui.GuiKeyframeRepository;
|
import eu.crushedpixel.replaymod.gui.GuiKeyframeRepository;
|
||||||
import eu.crushedpixel.replaymod.gui.GuiMouseInput;
|
import eu.crushedpixel.replaymod.gui.GuiMouseInput;
|
||||||
@@ -120,6 +121,24 @@ public class KeyInputHandler {
|
|||||||
handleCustomKeybindings(kb, found, -1);
|
handleCustomKeybindings(kb, found, -1);
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!ReplayHandler.isInReplay() || (mc.currentScreen != null && !(mc.currentScreen instanceof GuiMouseInput))) return;
|
||||||
|
|
||||||
|
for(StaticKeybinding staticKeybinding : KeybindRegistry.staticKeybindings) {
|
||||||
|
if(!Keyboard.isKeyDown(staticKeybinding.getKeyCode())) {
|
||||||
|
staticKeybinding.setDown(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(staticKeybinding.isDown()) return;
|
||||||
|
staticKeybinding.setDown(true);
|
||||||
|
|
||||||
|
switch(staticKeybinding.getId()) {
|
||||||
|
case KeybindRegistry.STATIC_DELETE_KEYFRAME:
|
||||||
|
if(ReplayHandler.getSelectedKeyframe() != null) ReplayHandler.removeKeyframe(ReplayHandler.getSelectedKeyframe());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void forwardCameraMovement(boolean forward, boolean backward, boolean left, boolean right, boolean up, boolean down) {
|
private void forwardCameraMovement(boolean forward, boolean backward, boolean left, boolean right, boolean up, boolean down) {
|
||||||
@@ -155,12 +174,6 @@ public class KeyInputHandler {
|
|||||||
|
|
||||||
if(!ReplayHandler.isInReplay() || (mc.currentScreen != null && !(mc.currentScreen instanceof GuiMouseInput))) return;
|
if(!ReplayHandler.isInReplay() || (mc.currentScreen != null && !(mc.currentScreen instanceof GuiMouseInput))) return;
|
||||||
|
|
||||||
if(kb.getKeyCode() == Keyboard.KEY_DELETE) {
|
|
||||||
if(ReplayHandler.getSelectedKeyframe() != null) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(kb.getKeyDescription().equals("key.chat") && (kb.isPressed() || kb.getKeyCode() == keyCode)) {
|
if(kb.getKeyDescription().equals("key.chat") && (kb.isPressed() || kb.getKeyCode() == keyCode)) {
|
||||||
mc.displayGuiScreen(new GuiMouseInput(ReplayMod.overlay));
|
mc.displayGuiScreen(new GuiMouseInput(ReplayMod.overlay));
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package eu.crushedpixel.replaymod.events.handlers.keyboard;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class StaticKeybinding {
|
||||||
|
|
||||||
|
private final int id;
|
||||||
|
private final int keyCode;
|
||||||
|
private boolean down;
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package eu.crushedpixel.replaymod.registry;
|
package eu.crushedpixel.replaymod.registry;
|
||||||
|
|
||||||
|
import eu.crushedpixel.replaymod.events.handlers.keyboard.StaticKeybinding;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.settings.KeyBinding;
|
import net.minecraft.client.settings.KeyBinding;
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
@@ -57,4 +58,8 @@ public class KeybindRegistry {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final int STATIC_DELETE_KEYFRAME = 0;
|
||||||
|
|
||||||
|
public static final StaticKeybinding[] staticKeybindings = new StaticKeybinding[]{new StaticKeybinding(STATIC_DELETE_KEYFRAME, Keyboard.KEY_DELETE)};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ public class ReplayHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleMarker() {
|
public static void toggleMarker() {
|
||||||
if(selectedKeyframe.getValue() instanceof Marker) markerKeyframes.remove(selectedKeyframe);
|
if(selectedKeyframe != null && selectedKeyframe.getValue() instanceof Marker) markerKeyframes.remove(selectedKeyframe);
|
||||||
else {
|
else {
|
||||||
AdvancedPosition pos = new AdvancedPosition(mc.getRenderViewEntity(), false);
|
AdvancedPosition pos = new AdvancedPosition(mc.getRenderViewEntity(), false);
|
||||||
int timestamp = ReplayMod.replaySender.currentTimeStamp();
|
int timestamp = ReplayMod.replaySender.currentTimeStamp();
|
||||||
@@ -281,6 +281,8 @@ public class ReplayHandler {
|
|||||||
positionKeyframes.remove(keyframe);
|
positionKeyframes.remove(keyframe);
|
||||||
} else if(keyframe.getValue() instanceof TimestampValue) {
|
} else if(keyframe.getValue() instanceof TimestampValue) {
|
||||||
timeKeyframes.remove(keyframe);
|
timeKeyframes.remove(keyframe);
|
||||||
|
} else if(keyframe.getValue() instanceof Marker) {
|
||||||
|
markerKeyframes.remove(keyframe);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(keyframe == selectedKeyframe) {
|
if(keyframe == selectedKeyframe) {
|
||||||
|
|||||||
Reference in New Issue
Block a user