Reworked Camera Movement in Replay Viewer
Finally made Replay Trimming work Fixed and dried ReplayProcess pathTick() method
This commit is contained in:
@@ -36,6 +36,7 @@ import eu.crushedpixel.replaymod.replay.ReplayHandler;
|
||||
import eu.crushedpixel.replaymod.studio.VersionValidator;
|
||||
import eu.crushedpixel.replaymod.timer.MCTimerHandler;
|
||||
import eu.crushedpixel.replaymod.utils.MouseUtils;
|
||||
import eu.crushedpixel.replaymod.utils.ReplayFileIO;
|
||||
import eu.crushedpixel.replaymod.utils.ResourceHelper;
|
||||
import eu.crushedpixel.replaymod.video.VideoWriter;
|
||||
|
||||
@@ -43,6 +44,8 @@ public class GuiEventHandler {
|
||||
|
||||
private static Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
private static int replayCount = 0;
|
||||
|
||||
private static List<Class> allowedGUIs = new ArrayList<Class>() {
|
||||
{
|
||||
add(GuiReplaySettings.class);
|
||||
@@ -107,7 +110,12 @@ public class GuiEventHandler {
|
||||
e.gui.drawString(mc.fontRendererObj, "LOGGED OUT", 5, 15, DARK_RED.getRGB());
|
||||
}
|
||||
|
||||
if(!VersionValidator.isValid) {
|
||||
if(replayCount == 0) {
|
||||
if(editorButton.isMouseOver()) {
|
||||
Point mouse = MouseUtils.getMousePos();
|
||||
e.gui.drawCenteredString(mc.fontRendererObj, "At least one Replay required", (int)mouse.getX(), (int)mouse.getY()+4, Color.RED.getRGB());
|
||||
}
|
||||
} else if(!VersionValidator.isValid) {
|
||||
if(editorButton.isMouseOver()) {
|
||||
Point mouse = MouseUtils.getMousePos();
|
||||
e.gui.drawCenteredString(mc.fontRendererObj, "Java 1.7 or newer required", (int)mouse.getX(), (int)mouse.getY()+4, Color.RED.getRGB());
|
||||
@@ -146,9 +154,11 @@ public class GuiEventHandler {
|
||||
//rm.enabled = AuthenticationHandler.isAuthenticated();
|
||||
event.buttonList.add(rm);
|
||||
|
||||
replayCount = ReplayFileIO.getAllReplayFiles().size();
|
||||
|
||||
GuiButton re = new GuiButton(GuiConstants.REPLAY_EDITOR_BUTTON_ID, event.gui.width / 2 + 2, i1 + 2*24, "Replay Editor");
|
||||
re.width = re.width/2 - 2;
|
||||
re.enabled = VersionValidator.isValid;
|
||||
re.enabled = VersionValidator.isValid && replayCount > 0;
|
||||
event.buttonList.add(re);
|
||||
|
||||
editorButton = re;
|
||||
|
||||
@@ -10,6 +10,7 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.GuiChat;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
@@ -83,9 +84,9 @@ public class GuiReplayOverlay extends Gui {
|
||||
private boolean mouseDown = false;
|
||||
|
||||
private static boolean requestScreenshot = false;
|
||||
|
||||
|
||||
private static Field isGamePaused;
|
||||
|
||||
|
||||
static {
|
||||
try {
|
||||
isGamePaused = Minecraft.class.getDeclaredField(MCPNames.field("field_71445_n"));
|
||||
@@ -103,9 +104,9 @@ public class GuiReplayOverlay extends Gui {
|
||||
|
||||
public GuiReplayOverlay() {
|
||||
try {
|
||||
// drawBlockOutline = EntityRenderer.class.getDeclaredField(MCPNames.field("field_175073_D"));
|
||||
// drawBlockOutline.setAccessible(true);
|
||||
// drawBlockOutline.set(Minecraft.getMinecraft().entityRenderer, false);
|
||||
// drawBlockOutline = EntityRenderer.class.getDeclaredField(MCPNames.field("field_175073_D"));
|
||||
// drawBlockOutline.setAccessible(true);
|
||||
// drawBlockOutline.set(Minecraft.getMinecraft().entityRenderer, false);
|
||||
} catch(Exception e) {}
|
||||
}
|
||||
|
||||
@@ -125,20 +126,20 @@ public class GuiReplayOverlay extends Gui {
|
||||
ReplayHandler.getCameraEntity().updateMovement();
|
||||
if(!ReplayHandler.isInPath()) onMouseMove(new MouseEvent());
|
||||
FMLCommonHandler.instance().bus().post(new InputEvent.KeyInputEvent());
|
||||
|
||||
|
||||
}
|
||||
|
||||
private double lastX, lastY, lastZ;
|
||||
private float lastPitch, lastYaw;
|
||||
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void onChangeView(MouseEvent event) {
|
||||
if(ReplayHandler.isInPath()) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void onRenderWorld(RenderWorldLastEvent event)
|
||||
throws IllegalAccessException, IllegalArgumentException,
|
||||
@@ -187,7 +188,7 @@ 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()) {
|
||||
return;
|
||||
}
|
||||
@@ -195,7 +196,11 @@ public class GuiReplayOverlay extends Gui {
|
||||
//System.out.println(System.currentTimeMillis()+" | "+MCTimerHandler.getTicks()+" | "+MCTimerHandler.getPartialTicks());
|
||||
|
||||
if(!ReplayGuiRegistry.hidden) ReplayGuiRegistry.hide();
|
||||
|
||||
|
||||
if(FMLClientHandler.instance().isGUIOpen(GuiChat.class)) {
|
||||
mc.displayGuiScreen(new GuiMouseInput());
|
||||
}
|
||||
|
||||
if(event.type == ElementType.PLAYER_LIST) {
|
||||
if(event.isCancelable()) {
|
||||
event.setCanceled(true);
|
||||
@@ -204,7 +209,7 @@ public class GuiReplayOverlay extends Gui {
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
// drawBlockOutline.set(Minecraft.getMinecraft().entityRenderer, false);
|
||||
// drawBlockOutline.set(Minecraft.getMinecraft().entityRenderer, false);
|
||||
|
||||
if(!ReplayHandler.isInReplay()) {
|
||||
return;
|
||||
@@ -217,7 +222,7 @@ public class GuiReplayOverlay extends Gui {
|
||||
Point scaled = MouseUtils.getScaledDimensions();
|
||||
final int width = (int)scaled.getX();
|
||||
final int height = (int)scaled.getY();
|
||||
|
||||
|
||||
//Draw Timeline
|
||||
drawTimeline(timelineX, width - 14, 9);
|
||||
drawRealTimeline(realTimelineX, width - 14 - 11, realTimelineY, mouseX, mouseY);
|
||||
@@ -872,8 +877,9 @@ public class GuiReplayOverlay extends Gui {
|
||||
b0 = -1;
|
||||
}
|
||||
|
||||
ReplayHandler.getCameraEntity().setAngles(f3, f4 * (float)b0);
|
||||
|
||||
if(ReplayHandler.getCameraEntity() != null) {
|
||||
ReplayHandler.getCameraEntity().setAngles(f3, f4 * (float)b0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,38 +34,50 @@ public class KeyInputHandler {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
|
||||
boolean speedup = false;
|
||||
|
||||
if(ReplayHandler.isCamera()) {
|
||||
if(kb.getKeyDescription().equals("key.forward")) {
|
||||
ReplayHandler.getCameraEntity().setMovement(MoveDirection.FORWARD);
|
||||
speedup = true;
|
||||
}
|
||||
|
||||
if(kb.getKeyDescription().equals("key.back")) {
|
||||
ReplayHandler.getCameraEntity().setMovement(MoveDirection.BACKWARD);
|
||||
speedup = true;
|
||||
}
|
||||
|
||||
if(kb.getKeyDescription().equals("key.jump")) {
|
||||
ReplayHandler.getCameraEntity().setMovement(MoveDirection.UP);
|
||||
speedup = true;
|
||||
}
|
||||
|
||||
if(kb.getKeyDescription().equals("key.left")) {
|
||||
ReplayHandler.getCameraEntity().setMovement(MoveDirection.LEFT);
|
||||
speedup = true;
|
||||
}
|
||||
|
||||
if(kb.getKeyDescription().equals("key.right")) {
|
||||
ReplayHandler.getCameraEntity().setMovement(MoveDirection.RIGHT);
|
||||
speedup = true;
|
||||
}
|
||||
}
|
||||
if(kb.getKeyDescription().equals("key.sneak")) {
|
||||
if(ReplayHandler.isCamera()) {
|
||||
ReplayHandler.getCameraEntity().setMovement(MoveDirection.DOWN);
|
||||
speedup = true;
|
||||
} else {
|
||||
ReplayHandler.spectateCamera();
|
||||
}
|
||||
}
|
||||
|
||||
if(speedup) {
|
||||
ReplayHandler.getCameraEntity().speedUp();
|
||||
}
|
||||
|
||||
if(kb.getKeyDescription().equals("key.chat")) {
|
||||
mc.displayGuiScreen(new GuiMouseInput());
|
||||
break;
|
||||
}
|
||||
|
||||
//Custom registered handlers
|
||||
|
||||
Reference in New Issue
Block a user