Added Keyframe Repository, which is stored in Replay File itself and allows Camera Path Presets to be saved and loaded

This commit is contained in:
CrushedPixel
2015-05-01 23:20:16 +02:00
parent 2cccbe424a
commit e8320ebd0f
17 changed files with 525 additions and 144 deletions

View File

@@ -2,10 +2,7 @@ package eu.crushedpixel.replaymod.events;
import eu.crushedpixel.replaymod.ReplayMod;
import eu.crushedpixel.replaymod.entities.CameraEntity;
import eu.crushedpixel.replaymod.gui.GuiCancelRender;
import eu.crushedpixel.replaymod.gui.GuiMouseInput;
import eu.crushedpixel.replaymod.gui.GuiReplaySpeedSlider;
import eu.crushedpixel.replaymod.gui.GuiSpectateSelection;
import eu.crushedpixel.replaymod.gui.*;
import eu.crushedpixel.replaymod.holders.Keyframe;
import eu.crushedpixel.replaymod.holders.Position;
import eu.crushedpixel.replaymod.holders.PositionKeyframe;
@@ -120,7 +117,8 @@ public class GuiReplayOverlay extends Gui {
@SubscribeEvent
public void onRenderGui(RenderGameOverlayEvent.Post event) throws IllegalArgumentException, IllegalAccessException {
if(!ReplayHandler.isInReplay() || FMLClientHandler.instance().isGUIOpen(GuiSpectateSelection.class) || VideoWriter.isRecording()) {
if(!ReplayHandler.isInReplay() || FMLClientHandler.instance().isGUIOpen(GuiSpectateSelection.class)
|| VideoWriter.isRecording() || FMLClientHandler.instance().isGUIOpen(GuiKeyframeRepository.class)) {
return;
}

View File

@@ -3,6 +3,7 @@ package eu.crushedpixel.replaymod.events;
import eu.crushedpixel.replaymod.ReplayMod;
import eu.crushedpixel.replaymod.entities.CameraEntity.MoveDirection;
import eu.crushedpixel.replaymod.gui.GuiCancelRender;
import eu.crushedpixel.replaymod.gui.GuiKeyframeRepository;
import eu.crushedpixel.replaymod.gui.GuiMouseInput;
import eu.crushedpixel.replaymod.registry.KeybindRegistry;
import eu.crushedpixel.replaymod.replay.ReplayHandler;
@@ -87,12 +88,12 @@ public class KeyInputHandler {
ReplayHandler.getCameraEntity().speedUp();
}
if(kb.getKeyDescription().equals("key.chat")) {
if(kb.getKeyDescription().equals("key.chat") && kb.isPressed()) {
mc.displayGuiScreen(new GuiMouseInput());
break;
}
handleCustomKeybindings(kb, found, null);
handleCustomKeybindings(kb, found, -1);
} catch(Exception e) {
e.printStackTrace();
@@ -101,11 +102,10 @@ public class KeyInputHandler {
}
}
public void handleCustomKeybindings(KeyBinding kb, boolean found, Integer keyCode) {
public void handleCustomKeybindings(KeyBinding kb, boolean found, int keyCode) {
//Custom registered handlers
if(kb.getKeyDescription().equals(KeybindRegistry.KEY_THUMBNAIL) && (kb.isPressed() || kb.getKeyCode() == keyCode) && !found) {
TickAndRenderListener.requestScreenshot();
//TODO: Make this properly work
}
if(kb.getKeyDescription().equals(KeybindRegistry.KEY_SPECTATE) && (kb.isPressed() || kb.getKeyCode() == keyCode) && !found) {
@@ -123,5 +123,9 @@ public class KeyInputHandler {
if(kb.getKeyDescription().equals(KeybindRegistry.KEY_SYNC_TIMELINE) && (kb.isPressed() || kb.getKeyCode() == keyCode)) {
ReplayHandler.syncTimeCursor(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT));
}
if(kb.getKeyDescription().equals(KeybindRegistry.KEY_KEYFRAME_PRESETS) && (kb.isPressed() || kb.getKeyCode() == keyCode)) {
mc.displayGuiScreen(new GuiKeyframeRepository(ReplayHandler.getKeyframeRepository()));
}
}
}

View File

@@ -2,15 +2,11 @@ package eu.crushedpixel.replaymod.events;
import eu.crushedpixel.replaymod.reflection.MCPNames;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiChat;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.crash.CrashReport;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.play.client.C16PacketClientStatus;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ReportedException;
import org.lwjgl.input.Keyboard;
@@ -260,31 +256,6 @@ public class MinecraftTicker {
}
}
boolean flag = mc.gameSettings.chatVisibility != EntityPlayer.EnumChatVisibility.HIDDEN;
while(mc.gameSettings.keyBindInventory.isPressed()) {
if(mc.playerController.isRidingHorse()) {
mc.thePlayer.sendHorseInventory();
} else {
mc.getNetHandler().addToSendQueue(new C16PacketClientStatus(C16PacketClientStatus.EnumState.OPEN_INVENTORY_ACHIEVEMENT));
mc.displayGuiScreen(new GuiInventory(mc.thePlayer));
}
}
while(mc.gameSettings.keyBindDrop.isPressed()) {
if(!mc.thePlayer.isSpectator()) {
mc.thePlayer.dropOneItem(GuiScreen.isCtrlKeyDown());
}
}
while(mc.gameSettings.keyBindChat.isPressed() && flag) {
mc.displayGuiScreen(new GuiChat());
}
if(mc.currentScreen == null && mc.gameSettings.keyBindCommand.isPressed() && flag) {
mc.displayGuiScreen(new GuiChat("/"));
}
if(mc.thePlayer != null && mc.thePlayer.isUsingItem()) {
if(!mc.gameSettings.keyBindUseItem.isKeyDown()) {
mc.playerController.onStoppedUsingItem(mc.thePlayer);