Instead of using AdvancedPosition objects with a value for spectatedEntityID, use SpectatorData objects for Spectator Keyframes. This allows us to add more options to Spectator Keyframes.
This commit is contained in:
@@ -3,10 +3,7 @@ package eu.crushedpixel.replaymod.gui;
|
|||||||
import eu.crushedpixel.replaymod.ReplayMod;
|
import eu.crushedpixel.replaymod.ReplayMod;
|
||||||
import eu.crushedpixel.replaymod.gui.elements.*;
|
import eu.crushedpixel.replaymod.gui.elements.*;
|
||||||
import eu.crushedpixel.replaymod.gui.elements.listeners.NumberValueChangeListener;
|
import eu.crushedpixel.replaymod.gui.elements.listeners.NumberValueChangeListener;
|
||||||
import eu.crushedpixel.replaymod.holders.AdvancedPosition;
|
import eu.crushedpixel.replaymod.holders.*;
|
||||||
import eu.crushedpixel.replaymod.holders.Keyframe;
|
|
||||||
import eu.crushedpixel.replaymod.holders.Marker;
|
|
||||||
import eu.crushedpixel.replaymod.holders.TimestampValue;
|
|
||||||
import eu.crushedpixel.replaymod.interpolation.KeyframeList;
|
import eu.crushedpixel.replaymod.interpolation.KeyframeList;
|
||||||
import eu.crushedpixel.replaymod.interpolation.KeyframeValue;
|
import eu.crushedpixel.replaymod.interpolation.KeyframeValue;
|
||||||
import eu.crushedpixel.replaymod.replay.ReplayHandler;
|
import eu.crushedpixel.replaymod.replay.ReplayHandler;
|
||||||
@@ -323,7 +320,8 @@ public abstract class GuiEditKeyframe<T extends KeyframeValue> extends GuiScreen
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initGui() {
|
public void initGui() {
|
||||||
if (keyframe.getValue().getSpectatedEntityID() != null) {
|
if (keyframe.getValue() instanceof SpectatorData) {
|
||||||
|
//TODO: Spectator Keyframe Settings
|
||||||
super.initGui();
|
super.initGui();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -347,7 +345,7 @@ public abstract class GuiEditKeyframe<T extends KeyframeValue> extends GuiScreen
|
|||||||
public void onValueChange(double value) {
|
public void onValueChange(double value) {
|
||||||
keyframe.setValue(new AdvancedPosition(xCoord.getPreciseValue(), yCoord.getPreciseValue(),
|
keyframe.setValue(new AdvancedPosition(xCoord.getPreciseValue(), yCoord.getPreciseValue(),
|
||||||
zCoord.getPreciseValue(), new Float(pitch.getPreciseValue()), (float) yaw.getPreciseValue(),
|
zCoord.getPreciseValue(), new Float(pitch.getPreciseValue()), (float) yaw.getPreciseValue(),
|
||||||
(float) roll.getPreciseValue(), null));
|
(float) roll.getPreciseValue()));
|
||||||
|
|
||||||
super.onValueChange(value);
|
super.onValueChange(value);
|
||||||
}
|
}
|
||||||
@@ -387,7 +385,7 @@ public abstract class GuiEditKeyframe<T extends KeyframeValue> extends GuiScreen
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawScreen0() {
|
protected void drawScreen0() {
|
||||||
if (keyframe.getValue().getSpectatedEntityID() != null) return;
|
if (keyframe.getValue() instanceof SpectatorData) return;
|
||||||
drawString(fontRendererObj, I18n.format("replaymod.gui.editkeyframe.xpos"), left, virtualY + 27, Color.WHITE.getRGB());
|
drawString(fontRendererObj, I18n.format("replaymod.gui.editkeyframe.xpos"), left, virtualY + 27, Color.WHITE.getRGB());
|
||||||
drawString(fontRendererObj, I18n.format("replaymod.gui.editkeyframe.ypos"), left, virtualY + 57, Color.WHITE.getRGB());
|
drawString(fontRendererObj, I18n.format("replaymod.gui.editkeyframe.ypos"), left, virtualY + 57, Color.WHITE.getRGB());
|
||||||
drawString(fontRendererObj, I18n.format("replaymod.gui.editkeyframe.zpos"), left, virtualY + 87, Color.WHITE.getRGB());
|
drawString(fontRendererObj, I18n.format("replaymod.gui.editkeyframe.zpos"), left, virtualY + 87, Color.WHITE.getRGB());
|
||||||
|
|||||||
@@ -2,10 +2,7 @@ package eu.crushedpixel.replaymod.gui.elements.timelines;
|
|||||||
|
|
||||||
import eu.crushedpixel.replaymod.ReplayMod;
|
import eu.crushedpixel.replaymod.ReplayMod;
|
||||||
import eu.crushedpixel.replaymod.gui.GuiEditKeyframe;
|
import eu.crushedpixel.replaymod.gui.GuiEditKeyframe;
|
||||||
import eu.crushedpixel.replaymod.holders.AdvancedPosition;
|
import eu.crushedpixel.replaymod.holders.*;
|
||||||
import eu.crushedpixel.replaymod.holders.Keyframe;
|
|
||||||
import eu.crushedpixel.replaymod.holders.Marker;
|
|
||||||
import eu.crushedpixel.replaymod.holders.TimestampValue;
|
|
||||||
import eu.crushedpixel.replaymod.replay.ReplayHandler;
|
import eu.crushedpixel.replaymod.replay.ReplayHandler;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
||||||
@@ -131,7 +128,7 @@ public class GuiKeyframeTimeline extends GuiTimeline {
|
|||||||
while(iterator.hasNext()) {
|
while(iterator.hasNext()) {
|
||||||
Keyframe<AdvancedPosition> kf = iterator.next();
|
Keyframe<AdvancedPosition> kf = iterator.next();
|
||||||
|
|
||||||
if(kf.getValue().getSpectatedEntityID() == null)
|
if(!(kf.getValue() instanceof SpectatorData))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int i = iterator.nextIndex();
|
int i = iterator.nextIndex();
|
||||||
@@ -139,10 +136,14 @@ public class GuiKeyframeTimeline extends GuiTimeline {
|
|||||||
|
|
||||||
if (iterator.hasNext()) {
|
if (iterator.hasNext()) {
|
||||||
Keyframe<AdvancedPosition> kf2 = iterator.next();
|
Keyframe<AdvancedPosition> kf2 = iterator.next();
|
||||||
if(kf.getValue().getSpectatedEntityID()
|
|
||||||
.equals(kf2.getValue().getSpectatedEntityID())) {
|
|
||||||
|
|
||||||
nextSpectatorKeyframeRealTime = kf2.getRealTimestamp();
|
if(kf2.getValue() instanceof SpectatorData) {
|
||||||
|
SpectatorData spectatorData1 = (SpectatorData)kf.getValue();
|
||||||
|
SpectatorData spectatorData2 = (SpectatorData)kf2.getValue();
|
||||||
|
|
||||||
|
if(spectatorData1.getSpectatedEntityID() == spectatorData2.getSpectatedEntityID()) {
|
||||||
|
nextSpectatorKeyframeRealTime = kf2.getRealTimestamp();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,7 +232,7 @@ public class GuiKeyframeTimeline extends GuiTimeline {
|
|||||||
y += 0;
|
y += 0;
|
||||||
|
|
||||||
//If Spectator Keyframe, use different texture
|
//If Spectator Keyframe, use different texture
|
||||||
if(((AdvancedPosition) kf.getValue()).getSpectatedEntityID() != null) {
|
if(kf.getValue() instanceof SpectatorData) {
|
||||||
textureX = KEYFRAME_SPEC_X;
|
textureX = KEYFRAME_SPEC_X;
|
||||||
textureY = KEYFRAME_SPEC_Y;
|
textureY = KEYFRAME_SPEC_Y;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import eu.crushedpixel.replaymod.gui.elements.timelines.GuiKeyframeTimeline;
|
|||||||
import eu.crushedpixel.replaymod.gui.elements.timelines.GuiMarkerTimeline;
|
import eu.crushedpixel.replaymod.gui.elements.timelines.GuiMarkerTimeline;
|
||||||
import eu.crushedpixel.replaymod.holders.AdvancedPosition;
|
import eu.crushedpixel.replaymod.holders.AdvancedPosition;
|
||||||
import eu.crushedpixel.replaymod.holders.Keyframe;
|
import eu.crushedpixel.replaymod.holders.Keyframe;
|
||||||
|
import eu.crushedpixel.replaymod.holders.SpectatorData;
|
||||||
import eu.crushedpixel.replaymod.holders.TimestampValue;
|
import eu.crushedpixel.replaymod.holders.TimestampValue;
|
||||||
import eu.crushedpixel.replaymod.registry.KeybindRegistry;
|
import eu.crushedpixel.replaymod.registry.KeybindRegistry;
|
||||||
import eu.crushedpixel.replaymod.registry.ReplayGuiRegistry;
|
import eu.crushedpixel.replaymod.registry.ReplayGuiRegistry;
|
||||||
@@ -150,12 +151,12 @@ public class GuiReplayOverlay extends Gui {
|
|||||||
Entity cam = mc.getRenderViewEntity();
|
Entity cam = mc.getRenderViewEntity();
|
||||||
if (cam != null) {
|
if (cam != null) {
|
||||||
AdvancedPosition position = new AdvancedPosition(cam.posX, cam.posY, cam.posZ, cam.rotationPitch,
|
AdvancedPosition position = new AdvancedPosition(cam.posX, cam.posY, cam.posZ, cam.rotationPitch,
|
||||||
cam.rotationYaw % 360, ReplayHandler.getCameraTilt(), null);
|
cam.rotationYaw % 360, ReplayHandler.getCameraTilt());
|
||||||
|
|
||||||
if (ReplayHandler.isCamera())
|
if (ReplayHandler.isCamera())
|
||||||
ReplayHandler.addKeyframe(new Keyframe<AdvancedPosition>(ReplayHandler.getRealTimelineCursor(), position));
|
ReplayHandler.addKeyframe(new Keyframe<AdvancedPosition>(ReplayHandler.getRealTimelineCursor(), position));
|
||||||
else
|
else
|
||||||
ReplayHandler.addKeyframe(new Keyframe<AdvancedPosition>(ReplayHandler.getRealTimelineCursor(), new AdvancedPosition(cam.getEntityId(), true)));
|
ReplayHandler.addKeyframe(new Keyframe<AdvancedPosition>(ReplayHandler.getRealTimelineCursor(), new SpectatorData(cam)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, "replaymod.gui.ingame.menu.addposkeyframe");
|
}, "replaymod.gui.ingame.menu.addposkeyframe");
|
||||||
@@ -173,12 +174,12 @@ public class GuiReplayOverlay extends Gui {
|
|||||||
Entity cam = mc.getRenderViewEntity();
|
Entity cam = mc.getRenderViewEntity();
|
||||||
if (cam != null) {
|
if (cam != null) {
|
||||||
AdvancedPosition position = new AdvancedPosition(cam.posX, cam.posY, cam.posZ, cam.rotationPitch,
|
AdvancedPosition position = new AdvancedPosition(cam.posX, cam.posY, cam.posZ, cam.rotationPitch,
|
||||||
cam.rotationYaw % 360, ReplayHandler.getCameraTilt(), null);
|
cam.rotationYaw % 360, ReplayHandler.getCameraTilt());
|
||||||
|
|
||||||
if (ReplayHandler.isCamera())
|
if (ReplayHandler.isCamera())
|
||||||
ReplayHandler.addKeyframe(new Keyframe<AdvancedPosition>(ReplayHandler.getRealTimelineCursor(), position));
|
ReplayHandler.addKeyframe(new Keyframe<AdvancedPosition>(ReplayHandler.getRealTimelineCursor(), position));
|
||||||
else
|
else
|
||||||
ReplayHandler.addKeyframe(new Keyframe<AdvancedPosition>(ReplayHandler.getRealTimelineCursor(), new AdvancedPosition(cam.getEntityId(), true)));
|
ReplayHandler.addKeyframe(new Keyframe<AdvancedPosition>(ReplayHandler.getRealTimelineCursor(), new SpectatorData(cam)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, "replaymod.gui.ingame.menu.addspeckeyframe");
|
}, "replaymod.gui.ingame.menu.addspeckeyframe");
|
||||||
@@ -195,7 +196,7 @@ public class GuiReplayOverlay extends Gui {
|
|||||||
boolean selected = ReplayHandler.getSelectedKeyframe() != null && ReplayHandler.getSelectedKeyframe().getValue() instanceof AdvancedPosition;
|
boolean selected = ReplayHandler.getSelectedKeyframe() != null && ReplayHandler.getSelectedKeyframe().getValue() instanceof AdvancedPosition;
|
||||||
boolean camera;
|
boolean camera;
|
||||||
if(selected) {
|
if(selected) {
|
||||||
camera = ((AdvancedPosition)ReplayHandler.getSelectedKeyframe().getValue()).getSpectatedEntityID() == null;
|
camera = !(ReplayHandler.getSelectedKeyframe().getValue() instanceof SpectatorData);
|
||||||
} else {
|
} else {
|
||||||
camera = ReplayHandler.isCamera();
|
camera = ReplayHandler.isCamera();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,30 +18,27 @@ public class AdvancedPosition extends Position {
|
|||||||
@Interpolate
|
@Interpolate
|
||||||
public double pitch, yaw, roll;
|
public double pitch, yaw, roll;
|
||||||
|
|
||||||
private Integer spectatedEntityID;
|
public AdvancedPosition(double x, double y, double z, double pitch, double yaw, double roll) {
|
||||||
|
|
||||||
public AdvancedPosition(double x, double y, double z, double pitch, double yaw, double roll, Integer spectatedEntityID) {
|
|
||||||
super(x, y, z);
|
super(x, y, z);
|
||||||
this.pitch = pitch;
|
this.pitch = pitch;
|
||||||
this.yaw = yaw;
|
this.yaw = yaw;
|
||||||
this.roll = roll;
|
this.roll = roll;
|
||||||
this.spectatedEntityID = spectatedEntityID;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public AdvancedPosition(int entityID, boolean spectate) {
|
public AdvancedPosition(int entityID) {
|
||||||
this(Minecraft.getMinecraft().theWorld.getEntityByID(entityID), spectate);
|
this(Minecraft.getMinecraft().theWorld.getEntityByID(entityID));
|
||||||
}
|
}
|
||||||
|
|
||||||
public AdvancedPosition(Entity e, boolean spectate) {
|
public AdvancedPosition(Entity e) {
|
||||||
this(e.posX, e.posY, e.posZ, e.rotationPitch, e.rotationYaw, spectate ? e.getEntityId() : null);
|
this(e.posX, e.posY, e.posZ, e.rotationPitch, e.rotationYaw);
|
||||||
}
|
|
||||||
|
|
||||||
public AdvancedPosition(double x, double y, double z, float pitch, float yaw, Integer spectatedEntityID) {
|
|
||||||
this(x, y, z, pitch, yaw, 0, spectatedEntityID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public AdvancedPosition(double x, double y, double z, float pitch, float yaw) {
|
public AdvancedPosition(double x, double y, double z, float pitch, float yaw) {
|
||||||
this(x, y, z, pitch, yaw, 0, null);
|
this(x, y, z, pitch, yaw, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SpectatorData asSpectatorData(int entityID) {
|
||||||
|
return new SpectatorData(x, y, z, pitch, yaw, roll, entityID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double distanceSquared(double x, double y, double z) {
|
public double distanceSquared(double x, double y, double z) {
|
||||||
@@ -62,7 +59,7 @@ public class AdvancedPosition extends Position {
|
|||||||
|
|
||||||
Vector3d position = new Vector3d(x, y, z);
|
Vector3d position = new Vector3d(x, y, z);
|
||||||
position.add(direction);
|
position.add(direction);
|
||||||
return new AdvancedPosition(position.x, position.y, position.z, pitch, yaw, roll, null);
|
return new AdvancedPosition(position.x, position.y, position.z, pitch, yaw, roll);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
47
src/main/java/eu/crushedpixel/replaymod/holders/SpectatorData.java
Executable file
47
src/main/java/eu/crushedpixel/replaymod/holders/SpectatorData.java
Executable file
@@ -0,0 +1,47 @@
|
|||||||
|
package eu.crushedpixel.replaymod.holders;
|
||||||
|
|
||||||
|
import eu.crushedpixel.replaymod.interpolation.AdvancedPositionLinearInterpolation;
|
||||||
|
import eu.crushedpixel.replaymod.interpolation.AdvancedPositionSplineInterpolation;
|
||||||
|
import eu.crushedpixel.replaymod.interpolation.Interpolation;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper=true)
|
||||||
|
public class SpectatorData extends AdvancedPosition {
|
||||||
|
|
||||||
|
private int spectatedEntityID;
|
||||||
|
|
||||||
|
public SpectatorData(double x, double y, double z, double pitch, double yaw, double roll, int entityID) {
|
||||||
|
super(x, y, z, pitch, yaw, roll);
|
||||||
|
this.spectatedEntityID = entityID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SpectatorData(int entityID) {
|
||||||
|
this(Minecraft.getMinecraft().theWorld.getEntityByID(entityID));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SpectatorData(Entity e) {
|
||||||
|
super(e.posX, e.posY, e.posZ, e.rotationPitch, e.rotationYaw);
|
||||||
|
this.spectatedEntityID = e.getEntityId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SpectatorData newInstance() {
|
||||||
|
return new SpectatorData();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Interpolation getCubicInterpolator() {
|
||||||
|
return new AdvancedPositionSplineInterpolation();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Interpolation getLinearInterpolator() {
|
||||||
|
return new AdvancedPositionLinearInterpolation();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -217,7 +217,7 @@ public class PacketListener extends DataListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addMarker() {
|
public void addMarker() {
|
||||||
AdvancedPosition pos = new AdvancedPosition(Minecraft.getMinecraft().getRenderViewEntity(), false);
|
AdvancedPosition pos = new AdvancedPosition(Minecraft.getMinecraft().getRenderViewEntity());
|
||||||
int timestamp = (int) (System.currentTimeMillis() - startTime);
|
int timestamp = (int) (System.currentTimeMillis() - startTime);
|
||||||
|
|
||||||
Keyframe<Marker> marker = new Keyframe<Marker>(timestamp, new Marker(null, pos));
|
Keyframe<Marker> marker = new Keyframe<Marker>(timestamp, new Marker(null, pos));
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import eu.crushedpixel.replaymod.events.KeyframesModifyEvent;
|
|||||||
import eu.crushedpixel.replaymod.gui.overlay.GuiReplayOverlay;
|
import eu.crushedpixel.replaymod.gui.overlay.GuiReplayOverlay;
|
||||||
import eu.crushedpixel.replaymod.holders.AdvancedPosition;
|
import eu.crushedpixel.replaymod.holders.AdvancedPosition;
|
||||||
import eu.crushedpixel.replaymod.holders.Keyframe;
|
import eu.crushedpixel.replaymod.holders.Keyframe;
|
||||||
|
import eu.crushedpixel.replaymod.holders.SpectatorData;
|
||||||
import eu.crushedpixel.replaymod.interpolation.KeyframeList;
|
import eu.crushedpixel.replaymod.interpolation.KeyframeList;
|
||||||
import eu.crushedpixel.replaymod.replay.ReplayHandler;
|
import eu.crushedpixel.replaymod.replay.ReplayHandler;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
@@ -201,7 +202,7 @@ public class PathPreviewRenderer {
|
|||||||
posY += size;
|
posY += size;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pos1.getSpectatedEntityID() != null) {
|
if(pos1 instanceof SpectatorData) {
|
||||||
posX += size;
|
posX += size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ public class ReplayHandler {
|
|||||||
markerKeyframes.remove(selectedKeyframe);
|
markerKeyframes.remove(selectedKeyframe);
|
||||||
ReplayHandler.selectKeyframe(null);
|
ReplayHandler.selectKeyframe(null);
|
||||||
} else {
|
} else {
|
||||||
AdvancedPosition pos = new AdvancedPosition(mc.getRenderViewEntity(), false);
|
AdvancedPosition pos = new AdvancedPosition(mc.getRenderViewEntity());
|
||||||
int timestamp = ReplayMod.replaySender.currentTimeStamp();
|
int timestamp = ReplayMod.replaySender.currentTimeStamp();
|
||||||
Keyframe<Marker> markerKeyframe = new Keyframe<Marker>(timestamp, new Marker(null, pos));
|
Keyframe<Marker> markerKeyframe = new Keyframe<Marker>(timestamp, new Marker(null, pos));
|
||||||
markerKeyframes.add(markerKeyframe);
|
markerKeyframes.add(markerKeyframe);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import eu.crushedpixel.replaymod.ReplayMod;
|
|||||||
import eu.crushedpixel.replaymod.chat.ChatMessageHandler.ChatMessageType;
|
import eu.crushedpixel.replaymod.chat.ChatMessageHandler.ChatMessageType;
|
||||||
import eu.crushedpixel.replaymod.holders.AdvancedPosition;
|
import eu.crushedpixel.replaymod.holders.AdvancedPosition;
|
||||||
import eu.crushedpixel.replaymod.holders.Keyframe;
|
import eu.crushedpixel.replaymod.holders.Keyframe;
|
||||||
|
import eu.crushedpixel.replaymod.holders.SpectatorData;
|
||||||
import eu.crushedpixel.replaymod.holders.TimestampValue;
|
import eu.crushedpixel.replaymod.holders.TimestampValue;
|
||||||
import eu.crushedpixel.replaymod.interpolation.KeyframeList;
|
import eu.crushedpixel.replaymod.interpolation.KeyframeList;
|
||||||
import eu.crushedpixel.replaymod.settings.RenderOptions;
|
import eu.crushedpixel.replaymod.settings.RenderOptions;
|
||||||
@@ -234,8 +235,10 @@ public class ReplayProcess {
|
|||||||
|
|
||||||
//if it's between two spectator keyframes sharing the same entity, spectate this entity
|
//if it's between two spectator keyframes sharing the same entity, spectate this entity
|
||||||
if(lastPos != null && nextPos != null) {
|
if(lastPos != null && nextPos != null) {
|
||||||
if(lastPos.getValue().getSpectatedEntityID() != null && nextPos.getValue().getSpectatedEntityID() != null) {
|
if(lastPos.getValue() instanceof SpectatorData && nextPos.getValue() instanceof SpectatorData) {
|
||||||
if(lastPos.getValue().getSpectatedEntityID().equals(nextPos.getValue().getSpectatedEntityID())) {
|
SpectatorData lastSpec = (SpectatorData)lastPos.getValue();
|
||||||
|
SpectatorData nextSpec = (SpectatorData)nextPos.getValue();
|
||||||
|
if(lastSpec.getSpectatedEntityID() == nextSpec.getSpectatedEntityID()) {
|
||||||
spectating = true;
|
spectating = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -284,7 +287,7 @@ public class ReplayProcess {
|
|||||||
ReplayHandler.getCameraEntity().movePath(pos);
|
ReplayHandler.getCameraEntity().movePath(pos);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ReplayHandler.spectateEntity(mc.theWorld.getEntityByID(lastPos.getValue().getSpectatedEntityID()));
|
ReplayHandler.spectateEntity(mc.theWorld.getEntityByID(((SpectatorData)lastPos.getValue()).getSpectatedEntityID()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Integer curTimestamp = timeKeyframes.getInterpolatedValueForTimestamp(curRealReplayTime, true).asInt();
|
Integer curTimestamp = timeKeyframes.getInterpolatedValueForTimestamp(curRealReplayTime, true).asInt();
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ public class LegacyKeyframeSetAdapter extends TypeAdapter<KeyframeSet[]> {
|
|||||||
if("name".equals(jsonTag)) {
|
if("name".equals(jsonTag)) {
|
||||||
set.setName(in.nextString());
|
set.setName(in.nextString());
|
||||||
|
|
||||||
|
//TODO: Adapt to new Spectator Keyframe system
|
||||||
} else if("positionKeyframes".equals(jsonTag)) {
|
} else if("positionKeyframes".equals(jsonTag)) {
|
||||||
in.beginArray();
|
in.beginArray();
|
||||||
while(in.hasNext()) {
|
while(in.hasNext()) {
|
||||||
@@ -56,7 +57,7 @@ public class LegacyKeyframeSetAdapter extends TypeAdapter<KeyframeSet[]> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(spectatedEntityID != null) {
|
if(spectatedEntityID != null) {
|
||||||
newKeyframe.getValue().setSpectatedEntityID(spectatedEntityID);
|
newKeyframe.setValue(newKeyframe.getValue().asSpectatorData(spectatedEntityID));
|
||||||
}
|
}
|
||||||
|
|
||||||
in.endObject();
|
in.endObject();
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import eu.crushedpixel.replaymod.ReplayMod;
|
|||||||
import eu.crushedpixel.replaymod.gui.GuiVideoRenderer;
|
import eu.crushedpixel.replaymod.gui.GuiVideoRenderer;
|
||||||
import eu.crushedpixel.replaymod.holders.AdvancedPosition;
|
import eu.crushedpixel.replaymod.holders.AdvancedPosition;
|
||||||
import eu.crushedpixel.replaymod.holders.Keyframe;
|
import eu.crushedpixel.replaymod.holders.Keyframe;
|
||||||
|
import eu.crushedpixel.replaymod.holders.SpectatorData;
|
||||||
import eu.crushedpixel.replaymod.holders.TimestampValue;
|
import eu.crushedpixel.replaymod.holders.TimestampValue;
|
||||||
import eu.crushedpixel.replaymod.interpolation.*;
|
import eu.crushedpixel.replaymod.interpolation.*;
|
||||||
import eu.crushedpixel.replaymod.renderer.ChunkLoadingRenderGlobal;
|
import eu.crushedpixel.replaymod.renderer.ChunkLoadingRenderGlobal;
|
||||||
@@ -238,8 +239,10 @@ public class VideoRenderer implements RenderInfo {
|
|||||||
|
|
||||||
//if it's between two spectator keyframes sharing the same entity, spectate this entity
|
//if it's between two spectator keyframes sharing the same entity, spectate this entity
|
||||||
if(lastPos != null && nextPos != null) {
|
if(lastPos != null && nextPos != null) {
|
||||||
if(lastPos.getValue().getSpectatedEntityID() != null && nextPos.getValue().getSpectatedEntityID() != null) {
|
if(lastPos.getValue() instanceof SpectatorData && nextPos.getValue() instanceof SpectatorData) {
|
||||||
if(lastPos.getValue().getSpectatedEntityID().equals(nextPos.getValue().getSpectatedEntityID())) {
|
SpectatorData lastSpec = (SpectatorData)lastPos.getValue();
|
||||||
|
SpectatorData nextSpec = (SpectatorData)nextPos.getValue();
|
||||||
|
if(lastSpec.getSpectatedEntityID() == nextSpec.getSpectatedEntityID()) {
|
||||||
spectating = true;
|
spectating = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -257,9 +260,8 @@ public class VideoRenderer implements RenderInfo {
|
|||||||
mc.entityRenderer.fovModifierHand = mc.entityRenderer.fovModifierHandPrev = 1;
|
mc.entityRenderer.fovModifierHand = mc.entityRenderer.fovModifierHandPrev = 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ReplayHandler.spectateEntity(mc.theWorld.getEntityByID(lastPos.getValue().getSpectatedEntityID()));
|
ReplayHandler.spectateEntity(mc.theWorld.getEntityByID(((SpectatorData)lastPos.getValue()).getSpectatedEntityID()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateTime(Timer timer, int framesDone) {
|
private void updateTime(Timer timer, int framesDone) {
|
||||||
|
|||||||
Reference in New Issue
Block a user