Added prerequisites for future Camera Tilt feature
This commit is contained in:
@@ -657,7 +657,7 @@ public class GuiReplayOverlay extends Gui {
|
|||||||
private void addPlaceKeyframe() {
|
private void addPlaceKeyframe() {
|
||||||
Entity cam = mc.getRenderViewEntity();
|
Entity cam = mc.getRenderViewEntity();
|
||||||
if(cam == null) return;
|
if(cam == null) return;
|
||||||
ReplayHandler.addKeyframe(new PositionKeyframe(ReplayHandler.getRealTimelineCursor(), new Position(cam.posX, cam.posY, cam.posZ, cam.rotationPitch, cam.rotationYaw)));
|
ReplayHandler.addKeyframe(new PositionKeyframe(ReplayHandler.getRealTimelineCursor(), new Position(cam.posX, cam.posY, cam.posZ, cam.rotationPitch, cam.rotationYaw, ReplayHandler.getCameraTilt())));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addTimeKeyframe() {
|
private void addTimeKeyframe() {
|
||||||
@@ -677,7 +677,7 @@ public class GuiReplayOverlay extends Gui {
|
|||||||
|
|
||||||
private boolean isClick() {
|
private boolean isClick() {
|
||||||
if(Mouse.isButtonDown(0)) {
|
if(Mouse.isButtonDown(0)) {
|
||||||
boolean bef = new Boolean(mouseDwn);
|
boolean bef = mouseDwn;
|
||||||
mouseDwn = true;
|
mouseDwn = true;
|
||||||
return !bef;
|
return !bef;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -104,6 +104,14 @@ public class KeyInputHandler {
|
|||||||
|
|
||||||
public void handleCustomKeybindings(KeyBinding kb, boolean found, int keyCode) {
|
public void handleCustomKeybindings(KeyBinding kb, boolean found, int keyCode) {
|
||||||
//Custom registered handlers
|
//Custom registered handlers
|
||||||
|
if(kb.getKeyDescription().equals(KeybindRegistry.KEY_ROTATE_CLOCKWISE) && (kb.isKeyDown() || kb.getKeyCode() == keyCode) && !found) {
|
||||||
|
ReplayHandler.addCameraTilt(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(kb.getKeyDescription().equals(KeybindRegistry.KEY_ROTATE_COUNTERCLOCKWISE) && (kb.isKeyDown() || kb.getKeyCode() == keyCode) && !found) {
|
||||||
|
ReplayHandler.addCameraTilt(-1);
|
||||||
|
}
|
||||||
|
|
||||||
if(kb.getKeyDescription().equals(KeybindRegistry.KEY_THUMBNAIL) && (kb.isPressed() || kb.getKeyCode() == keyCode) && !found) {
|
if(kb.getKeyDescription().equals(KeybindRegistry.KEY_THUMBNAIL) && (kb.isPressed() || kb.getKeyCode() == keyCode) && !found) {
|
||||||
TickAndRenderListener.requestScreenshot();
|
TickAndRenderListener.requestScreenshot();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ public class Position {
|
|||||||
|
|
||||||
private double x, y, z;
|
private double x, y, z;
|
||||||
private float pitch, yaw;
|
private float pitch, yaw;
|
||||||
|
private float rotation = 0;
|
||||||
|
|
||||||
public Position(Entity e) {
|
public Position(Entity e) {
|
||||||
this.x = e.posX;
|
this.x = e.posX;
|
||||||
@@ -16,6 +17,15 @@ public class Position {
|
|||||||
this.yaw = e.rotationYaw;
|
this.yaw = e.rotationYaw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Position(double x, double y, double z, float pitch, float yaw, float rotation) {
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.z = z;
|
||||||
|
this.pitch = pitch;
|
||||||
|
this.yaw = yaw;
|
||||||
|
this.rotation = rotation;
|
||||||
|
}
|
||||||
|
|
||||||
public Position(double x, double y, double z, float pitch, float yaw) {
|
public Position(double x, double y, double z, float pitch, float yaw) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
@@ -64,6 +74,10 @@ public class Position {
|
|||||||
this.yaw = yaw;
|
this.yaw = yaw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float getRotation() { return rotation; }
|
||||||
|
|
||||||
|
public void setRotation(float rotation) { this.rotation = rotation; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "X=" + x + ", Y=" + y + ", Z=" + z + ", Yaw=" + yaw + ", Pitch=" + pitch;
|
return "X=" + x + ", Y=" + y + ", Z=" + z + ", Yaw=" + yaw + ", Pitch=" + pitch;
|
||||||
@@ -85,6 +99,7 @@ public class Position {
|
|||||||
.append(z)
|
.append(z)
|
||||||
.append(pitch)
|
.append(pitch)
|
||||||
.append(yaw)
|
.append(yaw)
|
||||||
|
.append(rotation)
|
||||||
.toHashCode();
|
.toHashCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,11 +14,13 @@ public class SplinePoint extends BasicSpline {
|
|||||||
private Vector<Cubic> zCubics;
|
private Vector<Cubic> zCubics;
|
||||||
private Vector<Cubic> pitchCubics;
|
private Vector<Cubic> pitchCubics;
|
||||||
private Vector<Cubic> yawCubics;
|
private Vector<Cubic> yawCubics;
|
||||||
|
private Vector<Cubic> rotCubics;
|
||||||
private Field vectorX;
|
private Field vectorX;
|
||||||
private Field vectorY;
|
private Field vectorY;
|
||||||
private Field vectorZ;
|
private Field vectorZ;
|
||||||
private Field vectorPitch;
|
private Field vectorPitch;
|
||||||
private Field vectorYaw;
|
private Field vectorYaw;
|
||||||
|
private Field vectorRot;
|
||||||
|
|
||||||
public SplinePoint() {
|
public SplinePoint() {
|
||||||
this.points = new Vector<Position>();
|
this.points = new Vector<Position>();
|
||||||
@@ -28,6 +30,7 @@ public class SplinePoint extends BasicSpline {
|
|||||||
this.zCubics = new Vector<Cubic>();
|
this.zCubics = new Vector<Cubic>();
|
||||||
this.pitchCubics = new Vector<Cubic>();
|
this.pitchCubics = new Vector<Cubic>();
|
||||||
this.yawCubics = new Vector<Cubic>();
|
this.yawCubics = new Vector<Cubic>();
|
||||||
|
this.rotCubics = new Vector<Cubic>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
vectorX = Position.class.getDeclaredField("x");
|
vectorX = Position.class.getDeclaredField("x");
|
||||||
@@ -35,11 +38,13 @@ public class SplinePoint extends BasicSpline {
|
|||||||
vectorZ = Position.class.getDeclaredField("z");
|
vectorZ = Position.class.getDeclaredField("z");
|
||||||
vectorPitch = Position.class.getDeclaredField("pitch");
|
vectorPitch = Position.class.getDeclaredField("pitch");
|
||||||
vectorYaw = Position.class.getDeclaredField("yaw");
|
vectorYaw = Position.class.getDeclaredField("yaw");
|
||||||
|
vectorRot = Position.class.getDeclaredField("rotation");
|
||||||
vectorX.setAccessible(true);
|
vectorX.setAccessible(true);
|
||||||
vectorY.setAccessible(true);
|
vectorY.setAccessible(true);
|
||||||
vectorZ.setAccessible(true);
|
vectorZ.setAccessible(true);
|
||||||
vectorPitch.setAccessible(true);
|
vectorPitch.setAccessible(true);
|
||||||
vectorYaw.setAccessible(true);
|
vectorYaw.setAccessible(true);
|
||||||
|
vectorRot.setAccessible(true);
|
||||||
} catch(SecurityException e) {
|
} catch(SecurityException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch(NoSuchFieldException e) {
|
} catch(NoSuchFieldException e) {
|
||||||
@@ -62,6 +67,7 @@ public class SplinePoint extends BasicSpline {
|
|||||||
calcNaturalCubic(points, vectorZ, zCubics);
|
calcNaturalCubic(points, vectorZ, zCubics);
|
||||||
calcNaturalCubic(points, vectorPitch, pitchCubics);
|
calcNaturalCubic(points, vectorPitch, pitchCubics);
|
||||||
calcNaturalCubic(points, vectorYaw, yawCubics);
|
calcNaturalCubic(points, vectorYaw, yawCubics);
|
||||||
|
calcNaturalCubic(points, vectorRot, rotCubics);
|
||||||
} catch(IllegalArgumentException e) {
|
} catch(IllegalArgumentException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch(IllegalAccessException e) {
|
} catch(IllegalAccessException e) {
|
||||||
@@ -80,7 +86,8 @@ public class SplinePoint extends BasicSpline {
|
|||||||
yCubics.get(cubicNum).eval(cubicPos),
|
yCubics.get(cubicNum).eval(cubicPos),
|
||||||
zCubics.get(cubicNum).eval(cubicPos),
|
zCubics.get(cubicNum).eval(cubicPos),
|
||||||
(float) pitchCubics.get(cubicNum).eval(cubicPos),
|
(float) pitchCubics.get(cubicNum).eval(cubicPos),
|
||||||
(float) yawCubics.get(cubicNum).eval(cubicPos));
|
(float) yawCubics.get(cubicNum).eval(cubicPos),
|
||||||
|
(float) rotCubics.get(cubicNum).eval(cubicPos));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ public class KeybindRegistry {
|
|||||||
public static final String KEY_CLEAR_KEYFRAMES = "replaymod.input.clearkeyframes";
|
public static final String KEY_CLEAR_KEYFRAMES = "replaymod.input.clearkeyframes";
|
||||||
public static final String KEY_SYNC_TIMELINE = "replaymod.input.synctimeline";
|
public static final String KEY_SYNC_TIMELINE = "replaymod.input.synctimeline";
|
||||||
public static final String KEY_KEYFRAME_PRESETS = "replaymod.input.keyframerepository";
|
public static final String KEY_KEYFRAME_PRESETS = "replaymod.input.keyframerepository";
|
||||||
|
public static final String KEY_ROTATE_CLOCKWISE = "replaymod.input.rotateclockwise";
|
||||||
|
public static final String KEY_ROTATE_COUNTERCLOCKWISE = "replaymod.input.rotatecounterclockwise";
|
||||||
private static Minecraft mc = Minecraft.getMinecraft();
|
private static Minecraft mc = Minecraft.getMinecraft();
|
||||||
|
|
||||||
public static void initialize() {
|
public static void initialize() {
|
||||||
@@ -27,6 +29,8 @@ public class KeybindRegistry {
|
|||||||
bindings.add(new KeyBinding(KEY_SYNC_TIMELINE, Keyboard.KEY_V, "replaymod.title"));
|
bindings.add(new KeyBinding(KEY_SYNC_TIMELINE, Keyboard.KEY_V, "replaymod.title"));
|
||||||
bindings.add(new KeyBinding(KEY_CLEAR_KEYFRAMES, Keyboard.KEY_C, "replaymod.title"));
|
bindings.add(new KeyBinding(KEY_CLEAR_KEYFRAMES, Keyboard.KEY_C, "replaymod.title"));
|
||||||
bindings.add(new KeyBinding(KEY_KEYFRAME_PRESETS, Keyboard.KEY_X, "replaymod.title"));
|
bindings.add(new KeyBinding(KEY_KEYFRAME_PRESETS, Keyboard.KEY_X, "replaymod.title"));
|
||||||
|
bindings.add(new KeyBinding(KEY_ROTATE_CLOCKWISE, Keyboard.KEY_L, "replaymod.title"));
|
||||||
|
bindings.add(new KeyBinding(KEY_ROTATE_COUNTERCLOCKWISE, Keyboard.KEY_K, "replaymod.title"));
|
||||||
|
|
||||||
mc.gameSettings.keyBindings = bindings.toArray(new KeyBinding[bindings.size()]);
|
mc.gameSettings.keyBindings = bindings.toArray(new KeyBinding[bindings.size()]);
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ public class ReplayHandler {
|
|||||||
private static Entity currentEntity = null;
|
private static Entity currentEntity = null;
|
||||||
private static Position lastPosition = null;
|
private static Position lastPosition = null;
|
||||||
|
|
||||||
|
private static float cameraTilt = 0;
|
||||||
|
|
||||||
private static KeyframeSet[] keyframeRepository = new KeyframeSet[]{};
|
private static KeyframeSet[] keyframeRepository = new KeyframeSet[]{};
|
||||||
|
|
||||||
public static KeyframeSet[] getKeyframeRepository() {
|
public static KeyframeSet[] getKeyframeRepository() {
|
||||||
@@ -102,6 +104,18 @@ public class ReplayHandler {
|
|||||||
spectateCamera();
|
spectateCamera();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static float getCameraTilt() {
|
||||||
|
return cameraTilt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setCameraTilt(float tilt) {
|
||||||
|
cameraTilt = tilt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addCameraTilt(float tilt) {
|
||||||
|
cameraTilt += tilt;
|
||||||
|
}
|
||||||
|
|
||||||
public static void sortKeyframes() {
|
public static void sortKeyframes() {
|
||||||
Collections.sort(keyframes, new KeyframeComparator());
|
Collections.sort(keyframes, new KeyframeComparator());
|
||||||
}
|
}
|
||||||
@@ -281,6 +295,8 @@ public class ReplayHandler {
|
|||||||
channel.close();
|
channel.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setCameraTilt(0);
|
||||||
|
|
||||||
networkManager = new NetworkManager(EnumPacketDirection.CLIENTBOUND);
|
networkManager = new NetworkManager(EnumPacketDirection.CLIENTBOUND);
|
||||||
INetHandlerPlayClient pc = new NetHandlerPlayClient(mc, null, networkManager, new GameProfile(UUID.randomUUID(), "Player"));
|
INetHandlerPlayClient pc = new NetHandlerPlayClient(mc, null, networkManager, new GameProfile(UUID.randomUUID(), "Player"));
|
||||||
networkManager.setNetHandler(pc);
|
networkManager.setNetHandler(pc);
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ replaymod.api.unknownlang=This language has not been translated
|
|||||||
replaymod.api.zippingerror=An error occured while zipping the language files
|
replaymod.api.zippingerror=An error occured while zipping the language files
|
||||||
replaymod.api.usernameexists=This username is already taken
|
replaymod.api.usernameexists=This username is already taken
|
||||||
replaymod.api.mailexists=This email address is already linked to an account
|
replaymod.api.mailexists=This email address is already linked to an account
|
||||||
|
replaymod.api.invalidmail=Invalid e-Mail Address
|
||||||
|
|
||||||
|
|
||||||
#All of the chat messages
|
#All of the chat messages
|
||||||
@@ -97,7 +98,6 @@ replaymod.gui.register.confirmpw=Confirm Password
|
|||||||
replaymod.gui.register.error.nomatch=Passwords don't match
|
replaymod.gui.register.error.nomatch=Passwords don't match
|
||||||
replaymod.gui.register.error.shortusername=Username has to be at least 5 characters long
|
replaymod.gui.register.error.shortusername=Username has to be at least 5 characters long
|
||||||
replaymod.gui.register.error.shortpw=Password has to be at least 5 characters long
|
replaymod.gui.register.error.shortpw=Password has to be at least 5 characters long
|
||||||
replaymod.gui.register.error.invalidmail=Invalid e-Mail Address
|
|
||||||
|
|
||||||
|
|
||||||
#Replay Viewer GUI
|
#Replay Viewer GUI
|
||||||
@@ -187,6 +187,8 @@ replaymod.input.spectate=Spectate Players
|
|||||||
replaymod.input.clearkeyframes=Clear Keyframes
|
replaymod.input.clearkeyframes=Clear Keyframes
|
||||||
replaymod.input.synctimeline=Synchronize Timeline
|
replaymod.input.synctimeline=Synchronize Timeline
|
||||||
replaymod.input.keyframerepository=Open Keyframe Presets
|
replaymod.input.keyframerepository=Open Keyframe Presets
|
||||||
|
replaymod.input.rotateclockwise=Rotate Clockwise
|
||||||
|
replaymod.input.rotatecounterclockwise=Rotate Counterclockwise
|
||||||
|
|
||||||
#Keyframe Presets GUI
|
#Keyframe Presets GUI
|
||||||
replaymod.gui.keyframerepository.title=Keyframe Repository
|
replaymod.gui.keyframerepository.title=Keyframe Repository
|
||||||
|
|||||||
Reference in New Issue
Block a user