Renamed the commonly used Position POJO into AdvancedPosition, as it also hold pitch, yaw and roll
Made GuiDropdown only accept instances of GuiEntryListEntry to avoid unneccessary toString() methods returning the name Added GuiEntryListValueEntry which holds a Value and a Name to be displayed Continued work on GuiObjectManager
This commit is contained in:
@@ -105,4 +105,14 @@ public class AssetRepository {
|
|||||||
return replayAssets.get(uuid);
|
return replayAssets.get(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UUID getUUIDForAsset(ReplayAsset asset) {
|
||||||
|
for(Map.Entry<UUID, ReplayAsset> e : replayAssets.entrySet()) {
|
||||||
|
if(e.getValue().equals(asset)) {
|
||||||
|
return e.getKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package eu.crushedpixel.replaymod.assets;
|
package eu.crushedpixel.replaymod.assets;
|
||||||
|
|
||||||
import eu.crushedpixel.replaymod.holders.*;
|
import eu.crushedpixel.replaymod.holders.GuiEntryListEntry;
|
||||||
import eu.crushedpixel.replaymod.interpolation.KeyframeList;
|
import eu.crushedpixel.replaymod.holders.Transformations;
|
||||||
import eu.crushedpixel.replaymod.registry.ResourceHelper;
|
import eu.crushedpixel.replaymod.registry.ResourceHelper;
|
||||||
import eu.crushedpixel.replaymod.replay.ReplayHandler;
|
import eu.crushedpixel.replaymod.replay.ReplayHandler;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@@ -16,10 +16,14 @@ import java.util.UUID;
|
|||||||
|
|
||||||
public class CustomImageObject implements GuiEntryListEntry {
|
public class CustomImageObject implements GuiEntryListEntry {
|
||||||
|
|
||||||
public CustomImageObject(String name, UUID assetUUID) throws IOException {
|
public CustomImageObject(String name, UUID assetUUID) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
||||||
|
try {
|
||||||
setLinkedAsset(assetUUID);
|
setLinkedAsset(assetUUID);
|
||||||
|
} catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter @Setter private String name;
|
@Getter @Setter private String name;
|
||||||
@@ -27,6 +31,13 @@ public class CustomImageObject implements GuiEntryListEntry {
|
|||||||
|
|
||||||
@Getter @Setter private float width, height;
|
@Getter @Setter private float width, height;
|
||||||
|
|
||||||
|
private ResourceLocation resourceLocation;
|
||||||
|
private DynamicTexture dynamicTexture;
|
||||||
|
|
||||||
|
@Getter private float textureWidth, textureHeight;
|
||||||
|
|
||||||
|
@Getter private Transformations transformations;
|
||||||
|
|
||||||
public void setLinkedAsset(UUID assetUUID) throws IOException {
|
public void setLinkedAsset(UUID assetUUID) throws IOException {
|
||||||
ReplayAsset asset = ReplayHandler.getAssetRepository().getAssetByUUID(assetUUID);
|
ReplayAsset asset = ReplayHandler.getAssetRepository().getAssetByUUID(assetUUID);
|
||||||
|
|
||||||
@@ -65,11 +76,6 @@ public class CustomImageObject implements GuiEntryListEntry {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private ResourceLocation resourceLocation;
|
|
||||||
private DynamicTexture dynamicTexture;
|
|
||||||
|
|
||||||
@Getter private float textureWidth, textureHeight;
|
|
||||||
|
|
||||||
public ResourceLocation getResourceLocation() {
|
public ResourceLocation getResourceLocation() {
|
||||||
if(!ResourceHelper.isRegistered(resourceLocation)) {
|
if(!ResourceHelper.isRegistered(resourceLocation)) {
|
||||||
ResourceHelper.registerResource(resourceLocation);
|
ResourceHelper.registerResource(resourceLocation);
|
||||||
@@ -85,16 +91,4 @@ public class CustomImageObject implements GuiEntryListEntry {
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Keyframing Code
|
|
||||||
*/
|
|
||||||
|
|
||||||
private KeyframeList<Position> anchorPointKeyframes, positionKeyframes, orientationKeyframes;
|
|
||||||
private KeyframeList<Point> scaleKeyframes;
|
|
||||||
private KeyframeList<TimestampValue> opacityKeyframes;
|
|
||||||
|
|
||||||
public Transformations getTransformationsForTimestamp(int timestamp) {
|
|
||||||
return null; //TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package eu.crushedpixel.replaymod.entities;
|
package eu.crushedpixel.replaymod.entities;
|
||||||
|
|
||||||
import eu.crushedpixel.replaymod.holders.Position;
|
import eu.crushedpixel.replaymod.holders.AdvancedPosition;
|
||||||
import eu.crushedpixel.replaymod.replay.LesserDataWatcher;
|
import eu.crushedpixel.replaymod.replay.LesserDataWatcher;
|
||||||
import eu.crushedpixel.replaymod.replay.ReplayHandler;
|
import eu.crushedpixel.replaymod.replay.ReplayHandler;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
@@ -158,7 +158,7 @@ public class CameraEntity extends EntityPlayer {
|
|||||||
updateMovement();
|
updateMovement();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void moveAbsolute(Position pos) {
|
public void moveAbsolute(AdvancedPosition pos) {
|
||||||
this.moveAbsolute(pos.getX(), pos.getY(), pos.getZ());
|
this.moveAbsolute(pos.getX(), pos.getY(), pos.getZ());
|
||||||
rotationPitch = (float)pos.getPitch();
|
rotationPitch = (float)pos.getPitch();
|
||||||
rotationYaw = (float)pos.getYaw();
|
rotationYaw = (float)pos.getYaw();
|
||||||
@@ -180,7 +180,7 @@ public class CameraEntity extends EntityPlayer {
|
|||||||
updateBoundingBox();
|
updateBoundingBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void movePath(Position pos) {
|
public void movePath(AdvancedPosition pos) {
|
||||||
this.prevRotationPitch = this.rotationPitch = (float)pos.getPitch();
|
this.prevRotationPitch = this.rotationPitch = (float)pos.getPitch();
|
||||||
this.prevRotationYaw = this.rotationYaw = (float)pos.getYaw();
|
this.prevRotationYaw = this.rotationYaw = (float)pos.getYaw();
|
||||||
this.lastTickPosX = this.prevPosX = this.posX = pos.getX();
|
this.lastTickPosX = this.prevPosX = this.posX = pos.getX();
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package eu.crushedpixel.replaymod.events;
|
package eu.crushedpixel.replaymod.events;
|
||||||
|
|
||||||
import eu.crushedpixel.replaymod.holders.Position;
|
import eu.crushedpixel.replaymod.holders.AdvancedPosition;
|
||||||
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 lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -13,7 +13,7 @@ import net.minecraftforge.fml.common.eventhandler.Event;
|
|||||||
@EqualsAndHashCode(callSuper=true)
|
@EqualsAndHashCode(callSuper=true)
|
||||||
public class KeyframesModifyEvent extends Event {
|
public class KeyframesModifyEvent extends Event {
|
||||||
|
|
||||||
private KeyframeList<Position> positionKeyframes;
|
private KeyframeList<AdvancedPosition> positionKeyframes;
|
||||||
private KeyframeList<TimestampValue> timeKeyframes;
|
private KeyframeList<TimestampValue> timeKeyframes;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import eu.crushedpixel.replaymod.ReplayMod;
|
|||||||
import eu.crushedpixel.replaymod.gui.elements.GuiArrowButton;
|
import eu.crushedpixel.replaymod.gui.elements.GuiArrowButton;
|
||||||
import eu.crushedpixel.replaymod.gui.elements.GuiNumberInput;
|
import eu.crushedpixel.replaymod.gui.elements.GuiNumberInput;
|
||||||
import eu.crushedpixel.replaymod.holders.Keyframe;
|
import eu.crushedpixel.replaymod.holders.Keyframe;
|
||||||
import eu.crushedpixel.replaymod.holders.Position;
|
import eu.crushedpixel.replaymod.holders.AdvancedPosition;
|
||||||
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.replay.ReplayHandler;
|
import eu.crushedpixel.replaymod.replay.ReplayHandler;
|
||||||
@@ -54,12 +54,12 @@ public class GuiEditKeyframe extends GuiScreen {
|
|||||||
public GuiEditKeyframe(Keyframe keyframe) {
|
public GuiEditKeyframe(Keyframe keyframe) {
|
||||||
this.keyframe = keyframe;
|
this.keyframe = keyframe;
|
||||||
this.keyframeBackup = keyframe.copy();
|
this.keyframeBackup = keyframe.copy();
|
||||||
this.posKeyframe = keyframe.getValue() instanceof Position;
|
this.posKeyframe = keyframe.getValue() instanceof AdvancedPosition;
|
||||||
boolean timeKeyframe = keyframe.getValue() instanceof TimestampValue;
|
boolean timeKeyframe = keyframe.getValue() instanceof TimestampValue;
|
||||||
|
|
||||||
ReplayHandler.selectKeyframe(null);
|
ReplayHandler.selectKeyframe(null);
|
||||||
|
|
||||||
KeyframeList<Position> positionKeyframes = ReplayHandler.getPositionKeyframes();
|
KeyframeList<AdvancedPosition> positionKeyframes = ReplayHandler.getPositionKeyframes();
|
||||||
KeyframeList<TimestampValue> timeKeyframes = ReplayHandler.getTimeKeyframes();
|
KeyframeList<TimestampValue> timeKeyframes = ReplayHandler.getTimeKeyframes();
|
||||||
|
|
||||||
if(posKeyframe) {
|
if(posKeyframe) {
|
||||||
@@ -107,7 +107,7 @@ public class GuiEditKeyframe extends GuiScreen {
|
|||||||
|
|
||||||
//Position/Virtual Time Input
|
//Position/Virtual Time Input
|
||||||
if(posKeyframe) {
|
if(posKeyframe) {
|
||||||
Position pos = ((Keyframe<Position>)keyframe).getValue();
|
AdvancedPosition pos = ((Keyframe<AdvancedPosition>)keyframe).getValue();
|
||||||
xCoord = new GuiNumberInput(fontRendererObj, 0, 0, 100, null, null, RoundUtils.round2Decimals(pos.getX()), true);
|
xCoord = new GuiNumberInput(fontRendererObj, 0, 0, 100, null, null, RoundUtils.round2Decimals(pos.getX()), true);
|
||||||
yCoord = new GuiNumberInput(fontRendererObj, 0, 0, 100, null, null, RoundUtils.round2Decimals(pos.getY()), true);
|
yCoord = new GuiNumberInput(fontRendererObj, 0, 0, 100, null, null, RoundUtils.round2Decimals(pos.getY()), true);
|
||||||
zCoord = new GuiNumberInput(fontRendererObj, 0, 0, 100, null, null, RoundUtils.round2Decimals(pos.getZ()), true);
|
zCoord = new GuiNumberInput(fontRendererObj, 0, 0, 100, null, null, RoundUtils.round2Decimals(pos.getZ()), true);
|
||||||
@@ -190,7 +190,7 @@ public class GuiEditKeyframe extends GuiScreen {
|
|||||||
} else {
|
} else {
|
||||||
keyframe.setRealTimestamp(TimestampUtils.calculateTimestamp(min.getIntValue(), sec.getIntValue(), ms.getIntValue()));
|
keyframe.setRealTimestamp(TimestampUtils.calculateTimestamp(min.getIntValue(), sec.getIntValue(), ms.getIntValue()));
|
||||||
if(posKeyframe) {
|
if(posKeyframe) {
|
||||||
((Keyframe<Position>)keyframe).setValue(new Position(xCoord.getPreciseValue(), yCoord.getPreciseValue(),
|
((Keyframe<AdvancedPosition>)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(), null));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import eu.crushedpixel.replaymod.gui.elements.*;
|
|||||||
import eu.crushedpixel.replaymod.gui.elements.listeners.SelectionListener;
|
import eu.crushedpixel.replaymod.gui.elements.listeners.SelectionListener;
|
||||||
import eu.crushedpixel.replaymod.gui.elements.timelines.GuiTimeline;
|
import eu.crushedpixel.replaymod.gui.elements.timelines.GuiTimeline;
|
||||||
import eu.crushedpixel.replaymod.gui.overlay.GuiReplayOverlay;
|
import eu.crushedpixel.replaymod.gui.overlay.GuiReplayOverlay;
|
||||||
|
import eu.crushedpixel.replaymod.holders.GuiEntryListValueEntry;
|
||||||
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 eu.crushedpixel.replaymod.utils.MouseUtils;
|
import eu.crushedpixel.replaymod.utils.MouseUtils;
|
||||||
@@ -17,6 +18,7 @@ import org.lwjgl.util.Point;
|
|||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class GuiObjectManager extends GuiScreen {
|
public class GuiObjectManager extends GuiScreen {
|
||||||
|
|
||||||
@@ -30,7 +32,7 @@ public class GuiObjectManager extends GuiScreen {
|
|||||||
private GuiAdvancedTextField nameInput;
|
private GuiAdvancedTextField nameInput;
|
||||||
|
|
||||||
private GuiString dropdownLabel;
|
private GuiString dropdownLabel;
|
||||||
private GuiDropdown<String> assetDropdown;
|
private GuiDropdown<GuiEntryListValueEntry<UUID>> assetDropdown;
|
||||||
|
|
||||||
private GuiDraggingNumberInput anchorXInput, anchorYInput, anchorZInput;
|
private GuiDraggingNumberInput anchorXInput, anchorYInput, anchorZInput;
|
||||||
private GuiDraggingNumberInput positionXInput, positionYInput, positionZInput;
|
private GuiDraggingNumberInput positionXInput, positionYInput, positionZInput;
|
||||||
@@ -123,12 +125,13 @@ public class GuiObjectManager extends GuiScreen {
|
|||||||
opacityInput = new GuiDraggingNumberInput(fontRendererObj, 0, 0, 50, 0d, 100d, 100d, true, "%");
|
opacityInput = new GuiDraggingNumberInput(fontRendererObj, 0, 0, 50, 0d, 100d, 100d, true, "%");
|
||||||
|
|
||||||
dropdownLabel = new GuiString(0, 0, Color.WHITE, I18n.format("replaymod.gui.assets.filechooser")+": ");
|
dropdownLabel = new GuiString(0, 0, Color.WHITE, I18n.format("replaymod.gui.assets.filechooser")+": ");
|
||||||
assetDropdown = new GuiDropdown<String>(fontRendererObj, 0, 0, 0, 5);
|
assetDropdown = new GuiDropdown<GuiEntryListValueEntry<UUID>>(fontRendererObj, 0, 0, 0, 5);
|
||||||
if(ReplayHandler.getAssetRepository().getCopyOfReplayAssets().isEmpty()) {
|
if(ReplayHandler.getAssetRepository().getCopyOfReplayAssets().isEmpty()) {
|
||||||
assetDropdown.addElement(I18n.format("replaymod.gui.assets.emptylist"));
|
assetDropdown.addElement(new GuiEntryListValueEntry<UUID>(I18n.format("replaymod.gui.assets.emptylist"), null));
|
||||||
} else {
|
} else {
|
||||||
for(ReplayAsset asset : ReplayHandler.getAssetRepository().getCopyOfReplayAssets()) {
|
for(ReplayAsset asset : ReplayHandler.getAssetRepository().getCopyOfReplayAssets()) {
|
||||||
assetDropdown.addElement(asset.getDisplayString());
|
assetDropdown.addElement(new GuiEntryListValueEntry<UUID>(
|
||||||
|
asset.getDisplayString(), ReplayHandler.getAssetRepository().getUUIDForAsset(asset)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,14 +141,16 @@ public class GuiObjectManager extends GuiScreen {
|
|||||||
addButton = new GuiAdvancedButton(0, 0, 0, 20, I18n.format("replaymod.gui.add"), new Runnable() {
|
addButton = new GuiAdvancedButton(0, 0, 0, 20, I18n.format("replaymod.gui.add"), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
CustomImageObject customImageObject = new CustomImageObject(I18n.format("replaymod.gui.objects.defaultname"), null);
|
||||||
|
objectList.addElement(customImageObject);
|
||||||
}
|
}
|
||||||
}, null);
|
}, null);
|
||||||
|
|
||||||
removeButton = new GuiAdvancedButton(0, 0, 0, 20, I18n.format("replaymod.gui.remove"), new Runnable() {
|
removeButton = new GuiAdvancedButton(0, 0, 0, 20, I18n.format("replaymod.gui.remove"), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if(objectList.getElement(objectList.getSelectionIndex()) != null)
|
||||||
|
objectList.removeElement(objectList.getSelectionIndex());
|
||||||
}
|
}
|
||||||
}, null);
|
}, null);
|
||||||
|
|
||||||
@@ -288,7 +293,7 @@ public class GuiObjectManager extends GuiScreen {
|
|||||||
addButton.yPosition = removeButton.yPosition = objectList.yPosition+objectList.height-20;
|
addButton.yPosition = removeButton.yPosition = objectList.yPosition+objectList.height-20;
|
||||||
|
|
||||||
allElements.addPart(addButton);
|
allElements.addPart(addButton);
|
||||||
allElements.addPart(removeButton);
|
disableElements.addPart(removeButton);
|
||||||
|
|
||||||
allElements.addPart(disableElements);
|
allElements.addPart(disableElements);
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +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.SelectionListener;
|
import eu.crushedpixel.replaymod.gui.elements.listeners.SelectionListener;
|
||||||
|
import eu.crushedpixel.replaymod.holders.GuiEntryListEntry;
|
||||||
import eu.crushedpixel.replaymod.replay.ReplayHandler;
|
import eu.crushedpixel.replaymod.replay.ReplayHandler;
|
||||||
import eu.crushedpixel.replaymod.settings.RenderOptions;
|
import eu.crushedpixel.replaymod.settings.RenderOptions;
|
||||||
import eu.crushedpixel.replaymod.utils.StringUtils;
|
import eu.crushedpixel.replaymod.utils.StringUtils;
|
||||||
@@ -391,7 +392,7 @@ public class GuiRenderSettings extends GuiScreen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum RendererSettings {
|
private enum RendererSettings implements GuiEntryListEntry {
|
||||||
DEFAULT("default"),
|
DEFAULT("default"),
|
||||||
STEREOSCOPIC("stereoscopic"),
|
STEREOSCOPIC("stereoscopic"),
|
||||||
CUBIC("cubic"),
|
CUBIC("cubic"),
|
||||||
@@ -410,6 +411,11 @@ public class GuiRenderSettings extends GuiScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() { return I18n.format(desc); }
|
public String getDescription() { return I18n.format(desc); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDisplayString() {
|
||||||
|
return toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startRendering() {
|
private void startRendering() {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package eu.crushedpixel.replaymod.gui.elements;
|
|||||||
|
|
||||||
import eu.crushedpixel.replaymod.ReplayMod;
|
import eu.crushedpixel.replaymod.ReplayMod;
|
||||||
import eu.crushedpixel.replaymod.gui.elements.listeners.SelectionListener;
|
import eu.crushedpixel.replaymod.gui.elements.listeners.SelectionListener;
|
||||||
|
import eu.crushedpixel.replaymod.holders.GuiEntryListEntry;
|
||||||
import eu.crushedpixel.replaymod.utils.MouseUtils;
|
import eu.crushedpixel.replaymod.utils.MouseUtils;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.FontRenderer;
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
@@ -13,7 +14,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class GuiDropdown<T> extends GuiAdvancedTextField {
|
public class GuiDropdown<T extends GuiEntryListEntry> extends GuiAdvancedTextField {
|
||||||
|
|
||||||
private final int visibleDropout;
|
private final int visibleDropout;
|
||||||
private final int dropoutElementHeight = 14;
|
private final int dropoutElementHeight = 14;
|
||||||
@@ -38,7 +39,7 @@ public class GuiDropdown<T> extends GuiAdvancedTextField {
|
|||||||
public void drawTextBox() {
|
public void drawTextBox() {
|
||||||
if(elements.size() > selectionIndex && selectionIndex >= 0) {
|
if(elements.size() > selectionIndex && selectionIndex >= 0) {
|
||||||
setText(mc.fontRendererObj.trimStringToWidth(
|
setText(mc.fontRendererObj.trimStringToWidth(
|
||||||
elements.get(selectionIndex).toString(), width - 8));
|
elements.get(selectionIndex).getDisplayString(), width - 8));
|
||||||
} else {
|
} else {
|
||||||
setText("");
|
setText("");
|
||||||
}
|
}
|
||||||
@@ -83,7 +84,7 @@ public class GuiDropdown<T> extends GuiAdvancedTextField {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
drawHorizontalLine(xPosition, xPosition + width, yPosition + height + y, -6250336);
|
drawHorizontalLine(xPosition, xPosition + width, yPosition + height + y, -6250336);
|
||||||
String toWrite = mc.fontRendererObj.trimStringToWidth(obj.toString(), width - 8);
|
String toWrite = mc.fontRendererObj.trimStringToWidth(obj.getDisplayString(), width - 8);
|
||||||
drawString(mc.fontRendererObj, toWrite, xPosition + 4, yPosition + height + y + 4, Color.WHITE.getRGB());
|
drawString(mc.fontRendererObj, toWrite, xPosition + 4, yPosition + height + y + 4, Color.WHITE.getRGB());
|
||||||
|
|
||||||
if(MouseUtils.isMouseWithinBounds(xPosition, yPosition + height + y, width, dropoutElementHeight)) {
|
if(MouseUtils.isMouseWithinBounds(xPosition, yPosition + height + y, width, dropoutElementHeight)) {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package eu.crushedpixel.replaymod.gui.elements.timelines;
|
|||||||
|
|
||||||
import eu.crushedpixel.replaymod.gui.GuiEditKeyframe;
|
import eu.crushedpixel.replaymod.gui.GuiEditKeyframe;
|
||||||
import eu.crushedpixel.replaymod.holders.Keyframe;
|
import eu.crushedpixel.replaymod.holders.Keyframe;
|
||||||
import eu.crushedpixel.replaymod.holders.Position;
|
import eu.crushedpixel.replaymod.holders.AdvancedPosition;
|
||||||
import eu.crushedpixel.replaymod.holders.TimestampValue;
|
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;
|
||||||
@@ -113,9 +113,9 @@ public class GuiKeyframeTimeline extends GuiTimeline {
|
|||||||
|
|
||||||
//iterate over keyframes to find spectator segments
|
//iterate over keyframes to find spectator segments
|
||||||
if(placeKeyframes) {
|
if(placeKeyframes) {
|
||||||
ListIterator<Keyframe<Position>> iterator = ReplayHandler.getPositionKeyframes().listIterator();
|
ListIterator<Keyframe<AdvancedPosition>> iterator = ReplayHandler.getPositionKeyframes().listIterator();
|
||||||
while(iterator.hasNext()) {
|
while(iterator.hasNext()) {
|
||||||
Keyframe<Position> kf = iterator.next();
|
Keyframe<AdvancedPosition> kf = iterator.next();
|
||||||
|
|
||||||
if(kf.getValue().getSpectatedEntityID() == null)
|
if(kf.getValue().getSpectatedEntityID() == null)
|
||||||
continue;
|
continue;
|
||||||
@@ -124,7 +124,7 @@ public class GuiKeyframeTimeline extends GuiTimeline {
|
|||||||
int nextSpectatorKeyframeRealTime = -1;
|
int nextSpectatorKeyframeRealTime = -1;
|
||||||
|
|
||||||
while(iterator.hasNext()) {
|
while(iterator.hasNext()) {
|
||||||
Keyframe<Position> kf2 = iterator.next();
|
Keyframe<AdvancedPosition> kf2 = iterator.next();
|
||||||
if(kf.getValue().getSpectatedEntityID()
|
if(kf.getValue().getSpectatedEntityID()
|
||||||
.equals(kf2.getValue().getSpectatedEntityID())) {
|
.equals(kf2.getValue().getSpectatedEntityID())) {
|
||||||
|
|
||||||
@@ -177,14 +177,14 @@ public class GuiKeyframeTimeline extends GuiTimeline {
|
|||||||
|
|
||||||
int keyframeX = getKeyframeX(kf.getRealTimestamp(), leftTime, bodyWidth, segmentLength);
|
int keyframeX = getKeyframeX(kf.getRealTimestamp(), leftTime, bodyWidth, segmentLength);
|
||||||
|
|
||||||
if(kf.getValue() instanceof Position) {
|
if(kf.getValue() instanceof AdvancedPosition) {
|
||||||
if(!placeKeyframes) return;
|
if(!placeKeyframes) return;
|
||||||
textureX = KEYFRAME_PLACE_X;
|
textureX = KEYFRAME_PLACE_X;
|
||||||
textureY = KEYFRAME_PLACE_Y;
|
textureY = KEYFRAME_PLACE_Y;
|
||||||
y += 0;
|
y += 0;
|
||||||
|
|
||||||
//If Spectator Keyframe, use different texture
|
//If Spectator Keyframe, use different texture
|
||||||
if(((Keyframe<Position>) kf).getValue().getSpectatedEntityID() != null) {
|
if(((Keyframe<AdvancedPosition>) kf).getValue().getSpectatedEntityID() != null) {
|
||||||
textureX = KEYFRAME_SPEC_X;
|
textureX = KEYFRAME_SPEC_X;
|
||||||
textureY = KEYFRAME_SPEC_Y;
|
textureY = KEYFRAME_SPEC_Y;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import eu.crushedpixel.replaymod.api.replay.pagination.SearchPagination;
|
|||||||
import eu.crushedpixel.replaymod.gui.GuiConstants;
|
import eu.crushedpixel.replaymod.gui.GuiConstants;
|
||||||
import eu.crushedpixel.replaymod.gui.elements.*;
|
import eu.crushedpixel.replaymod.gui.elements.*;
|
||||||
import eu.crushedpixel.replaymod.gui.replayviewer.GuiReplayViewer;
|
import eu.crushedpixel.replaymod.gui.replayviewer.GuiReplayViewer;
|
||||||
|
import eu.crushedpixel.replaymod.holders.GuiEntryListStringEntry;
|
||||||
import eu.crushedpixel.replaymod.online.authentication.AuthenticationHandler;
|
import eu.crushedpixel.replaymod.online.authentication.AuthenticationHandler;
|
||||||
import eu.crushedpixel.replaymod.replay.ReplayHandler;
|
import eu.crushedpixel.replaymod.replay.ReplayHandler;
|
||||||
import net.minecraft.client.gui.*;
|
import net.minecraft.client.gui.*;
|
||||||
@@ -37,7 +38,7 @@ public class GuiReplayCenter extends GuiScreen implements GuiYesNoCallback {
|
|||||||
private List<GuiButton> replayButtonBar, bottomBar, topBar;
|
private List<GuiButton> replayButtonBar, bottomBar, topBar;
|
||||||
|
|
||||||
private GuiToggleButton searchGametypeToggle, searchSortToggle;
|
private GuiToggleButton searchGametypeToggle, searchSortToggle;
|
||||||
private GuiDropdown<String> searchCategoryDropdown, searchVersionDropdown;
|
private GuiDropdown<GuiEntryListStringEntry> searchCategoryDropdown, searchVersionDropdown;
|
||||||
private GuiAdvancedTextField searchNameInput, searchServerInput;
|
private GuiAdvancedTextField searchNameInput, searchServerInput;
|
||||||
private GuiButton searchActionButton;
|
private GuiButton searchActionButton;
|
||||||
|
|
||||||
@@ -116,22 +117,22 @@ public class GuiReplayCenter extends GuiScreen implements GuiYesNoCallback {
|
|||||||
new String[]{I18n.format("options.particles.all"), I18n.format("menu.singleplayer"), I18n.format("menu.multiplayer")});
|
new String[]{I18n.format("options.particles.all"), I18n.format("menu.singleplayer"), I18n.format("menu.multiplayer")});
|
||||||
searchSortToggle = new GuiToggleButton(GuiConstants.CENTER_SEARCH_ORDER_TOGGLE, 0, 0, I18n.format("replaymod.gui.center.search.order")+": ",
|
searchSortToggle = new GuiToggleButton(GuiConstants.CENTER_SEARCH_ORDER_TOGGLE, 0, 0, I18n.format("replaymod.gui.center.search.order")+": ",
|
||||||
new String[]{I18n.format("replaymod.gui.center.search.order.best"), I18n.format("replaymod.gui.center.search.order.recent")});
|
new String[]{I18n.format("replaymod.gui.center.search.order.best"), I18n.format("replaymod.gui.center.search.order.recent")});
|
||||||
searchCategoryDropdown = new GuiDropdown<String>(fontRendererObj, 0, 0, 0, Category.values().length+1);
|
searchCategoryDropdown = new GuiDropdown<GuiEntryListStringEntry>(fontRendererObj, 0, 0, 0, Category.values().length+1);
|
||||||
searchVersionDropdown = new GuiDropdown<String>(fontRendererObj, 0, 0, 0, 5);
|
searchVersionDropdown = new GuiDropdown<GuiEntryListStringEntry>(fontRendererObj, 0, 0, 0, 5);
|
||||||
searchNameInput = new GuiAdvancedTextField(fontRendererObj, 0, 0, 50, 20);
|
searchNameInput = new GuiAdvancedTextField(fontRendererObj, 0, 0, 50, 20);
|
||||||
searchServerInput = new GuiAdvancedTextField(fontRendererObj, 0, 0, 50, 20);
|
searchServerInput = new GuiAdvancedTextField(fontRendererObj, 0, 0, 50, 20);
|
||||||
|
|
||||||
searchNameInput.hint = I18n.format("replaymod.gui.center.search.name");
|
searchNameInput.hint = I18n.format("replaymod.gui.center.search.name");
|
||||||
searchServerInput.hint = I18n.format("replaymod.gui.center.search.server");
|
searchServerInput.hint = I18n.format("replaymod.gui.center.search.server");
|
||||||
|
|
||||||
searchCategoryDropdown.addElement(I18n.format("replaymod.gui.center.search.category"));
|
searchCategoryDropdown.addElement(new GuiEntryListStringEntry(I18n.format("replaymod.gui.center.search.category")));
|
||||||
for(Category c : Category.values()) {
|
for(Category c : Category.values()) {
|
||||||
searchCategoryDropdown.addElement(c.toNiceString());
|
searchCategoryDropdown.addElement(new GuiEntryListStringEntry(c.toNiceString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
searchVersionDropdown.addElement(I18n.format("replaymod.gui.center.search.version"));
|
searchVersionDropdown.addElement(new GuiEntryListStringEntry(I18n.format("replaymod.gui.center.search.version")));
|
||||||
for(MinecraftVersion v : MinecraftVersion.values()) {
|
for(MinecraftVersion v : MinecraftVersion.values()) {
|
||||||
searchVersionDropdown.addElement(v.toNiceName());
|
searchVersionDropdown.addElement(new GuiEntryListStringEntry(v.toNiceName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import eu.crushedpixel.replaymod.gui.elements.*;
|
|||||||
import eu.crushedpixel.replaymod.gui.elements.timelines.GuiKeyframeTimeline;
|
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.Keyframe;
|
import eu.crushedpixel.replaymod.holders.Keyframe;
|
||||||
import eu.crushedpixel.replaymod.holders.Position;
|
import eu.crushedpixel.replaymod.holders.AdvancedPosition;
|
||||||
import eu.crushedpixel.replaymod.holders.TimestampValue;
|
import eu.crushedpixel.replaymod.holders.TimestampValue;
|
||||||
import eu.crushedpixel.replaymod.registry.ReplayGuiRegistry;
|
import eu.crushedpixel.replaymod.registry.ReplayGuiRegistry;
|
||||||
import eu.crushedpixel.replaymod.replay.ReplayHandler;
|
import eu.crushedpixel.replaymod.replay.ReplayHandler;
|
||||||
@@ -137,13 +137,13 @@ public class GuiReplayOverlay extends Gui {
|
|||||||
public void run() {
|
public void run() {
|
||||||
Entity cam = mc.getRenderViewEntity();
|
Entity cam = mc.getRenderViewEntity();
|
||||||
if (cam != null) {
|
if (cam != null) {
|
||||||
Position position = new Position(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(), null);
|
||||||
|
|
||||||
if (ReplayHandler.isCamera())
|
if (ReplayHandler.isCamera())
|
||||||
ReplayHandler.addKeyframe(new Keyframe<Position>(ReplayHandler.getRealTimelineCursor(), position));
|
ReplayHandler.addKeyframe(new Keyframe<AdvancedPosition>(ReplayHandler.getRealTimelineCursor(), position));
|
||||||
else
|
else
|
||||||
ReplayHandler.addKeyframe(new Keyframe<Position>(ReplayHandler.getRealTimelineCursor(), new Position(cam.getEntityId(), true)));
|
ReplayHandler.addKeyframe(new Keyframe<AdvancedPosition>(ReplayHandler.getRealTimelineCursor(), new AdvancedPosition(cam.getEntityId(), true)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, "replaymod.gui.ingame.menu.addposkeyframe");
|
}, "replaymod.gui.ingame.menu.addposkeyframe");
|
||||||
@@ -160,13 +160,13 @@ public class GuiReplayOverlay extends Gui {
|
|||||||
public void run() {
|
public void run() {
|
||||||
Entity cam = mc.getRenderViewEntity();
|
Entity cam = mc.getRenderViewEntity();
|
||||||
if (cam != null) {
|
if (cam != null) {
|
||||||
Position position = new Position(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(), null);
|
||||||
|
|
||||||
if (ReplayHandler.isCamera())
|
if (ReplayHandler.isCamera())
|
||||||
ReplayHandler.addKeyframe(new Keyframe<Position>(ReplayHandler.getRealTimelineCursor(), position));
|
ReplayHandler.addKeyframe(new Keyframe<AdvancedPosition>(ReplayHandler.getRealTimelineCursor(), position));
|
||||||
else
|
else
|
||||||
ReplayHandler.addKeyframe(new Keyframe<Position>(ReplayHandler.getRealTimelineCursor(), new Position(cam.getEntityId(), true)));
|
ReplayHandler.addKeyframe(new Keyframe<AdvancedPosition>(ReplayHandler.getRealTimelineCursor(), new AdvancedPosition(cam.getEntityId(), true)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, "replaymod.gui.ingame.menu.addspeckeyframe");
|
}, "replaymod.gui.ingame.menu.addspeckeyframe");
|
||||||
@@ -180,10 +180,10 @@ public class GuiReplayOverlay extends Gui {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GuiElement delegate() {
|
public GuiElement delegate() {
|
||||||
boolean selected = ReplayHandler.getSelectedKeyframe() != null && ReplayHandler.getSelectedKeyframe().getValue() instanceof Position;
|
boolean selected = ReplayHandler.getSelectedKeyframe() != null && ReplayHandler.getSelectedKeyframe().getValue() instanceof AdvancedPosition;
|
||||||
boolean camera;
|
boolean camera;
|
||||||
if(selected) {
|
if(selected) {
|
||||||
camera = ((Keyframe<Position>)ReplayHandler.getSelectedKeyframe()).getValue().getSpectatedEntityID() == null;
|
camera = ((Keyframe<AdvancedPosition>)ReplayHandler.getSelectedKeyframe()).getValue().getSpectatedEntityID() == null;
|
||||||
} else {
|
} else {
|
||||||
camera = ReplayHandler.isCamera();
|
camera = ReplayHandler.isCamera();
|
||||||
}
|
}
|
||||||
@@ -348,7 +348,7 @@ public class GuiReplayOverlay extends Gui {
|
|||||||
|
|
||||||
CameraEntity cam = ReplayHandler.getCameraEntity();
|
CameraEntity cam = ReplayHandler.getCameraEntity();
|
||||||
if(cam != null) {
|
if(cam != null) {
|
||||||
ReplayHandler.setLastPosition(new Position(cam.posX, cam.posY, cam.posZ, cam.rotationPitch, cam.rotationYaw));
|
ReplayHandler.setLastPosition(new AdvancedPosition(cam.posX, cam.posY, cam.posZ, cam.rotationPitch, cam.rotationYaw));
|
||||||
} else {
|
} else {
|
||||||
ReplayHandler.setLastPosition(null);
|
ReplayHandler.setLastPosition(null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package eu.crushedpixel.replaymod.gui.replayeditor;
|
|||||||
import eu.crushedpixel.replaymod.ReplayMod;
|
import eu.crushedpixel.replaymod.ReplayMod;
|
||||||
import eu.crushedpixel.replaymod.gui.GuiConstants;
|
import eu.crushedpixel.replaymod.gui.GuiConstants;
|
||||||
import eu.crushedpixel.replaymod.gui.elements.GuiDropdown;
|
import eu.crushedpixel.replaymod.gui.elements.GuiDropdown;
|
||||||
|
import eu.crushedpixel.replaymod.holders.GuiEntryListStringEntry;
|
||||||
import eu.crushedpixel.replaymod.utils.ReplayFileIO;
|
import eu.crushedpixel.replaymod.utils.ReplayFileIO;
|
||||||
import eu.crushedpixel.replaymod.utils.StringUtils;
|
import eu.crushedpixel.replaymod.utils.StringUtils;
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
@@ -22,7 +23,7 @@ public class GuiReplayEditor extends GuiScreen {
|
|||||||
private static final int tabYPos = 110;
|
private static final int tabYPos = 110;
|
||||||
public static GuiReplayEditor instance = null;
|
public static GuiReplayEditor instance = null;
|
||||||
private StudioTab currentTab = StudioTab.TRIM;
|
private StudioTab currentTab = StudioTab.TRIM;
|
||||||
private GuiDropdown<String> replayDropdown;
|
private GuiDropdown<GuiEntryListStringEntry> replayDropdown;
|
||||||
private GuiButton saveModeButton;
|
private GuiButton saveModeButton;
|
||||||
private boolean overrideSave = false;
|
private boolean overrideSave = false;
|
||||||
private boolean initialized = false;
|
private boolean initialized = false;
|
||||||
@@ -50,7 +51,7 @@ public class GuiReplayEditor extends GuiScreen {
|
|||||||
}
|
}
|
||||||
for(File file : replayFiles) {
|
for(File file : replayFiles) {
|
||||||
String name = FilenameUtils.getBaseName(file.getAbsolutePath());
|
String name = FilenameUtils.getBaseName(file.getAbsolutePath());
|
||||||
replayDropdown.addElement(name);
|
replayDropdown.addElement(new GuiEntryListStringEntry(name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,7 +82,7 @@ public class GuiReplayEditor extends GuiScreen {
|
|||||||
int modeWidth = tabButtons.get(0).width;
|
int modeWidth = tabButtons.get(0).width;
|
||||||
|
|
||||||
if(!initialized) {
|
if(!initialized) {
|
||||||
replayDropdown = new GuiDropdown<String>(fontRendererObj, 15 + 2 + 1 + 80, 60, this.width - 30 - 8 - 80 - modeWidth - 4, 5);
|
replayDropdown = new GuiDropdown<GuiEntryListStringEntry>(fontRendererObj, 15 + 2 + 1 + 80, 60, this.width - 30 - 8 - 80 - modeWidth - 4, 5);
|
||||||
refreshReplayDropdown();
|
refreshReplayDropdown();
|
||||||
} else {
|
} else {
|
||||||
replayDropdown.width = this.width - 30 - 8 - 80 - modeWidth - 4;
|
replayDropdown.width = this.width - 30 - 8 - 80 - modeWidth - 4;
|
||||||
|
|||||||
51
src/main/java/eu/crushedpixel/replaymod/holders/AdvancedPosition.java
Executable file
51
src/main/java/eu/crushedpixel/replaymod/holders/AdvancedPosition.java
Executable file
@@ -0,0 +1,51 @@
|
|||||||
|
package eu.crushedpixel.replaymod.holders;
|
||||||
|
|
||||||
|
import eu.crushedpixel.replaymod.interpolation.Interpolate;
|
||||||
|
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 AdvancedPosition extends Position {
|
||||||
|
|
||||||
|
@Interpolate
|
||||||
|
public double pitch, yaw, roll;
|
||||||
|
|
||||||
|
private Integer spectatedEntityID;
|
||||||
|
|
||||||
|
public AdvancedPosition(double x, double y, double z, double pitch, double yaw, double roll, Integer spectatedEntityID) {
|
||||||
|
super(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AdvancedPosition(int entityID, boolean spectate) {
|
||||||
|
this(Minecraft.getMinecraft().theWorld.getEntityByID(entityID), spectate);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AdvancedPosition(Entity e, boolean spectate) {
|
||||||
|
this(e.posX, e.posY, e.posZ, e.rotationPitch, e.rotationYaw, spectate ? e.getEntityId() : null);
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
this(x, y, z, pitch, yaw, 0, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double distanceSquared(double x, double y, double z) {
|
||||||
|
double dx = this.x - x;
|
||||||
|
double dy = this.y - y;
|
||||||
|
double dz = this.z - z;
|
||||||
|
return dx * dx + dy * dy + dz * dz;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AdvancedPosition newInstance() {
|
||||||
|
return new AdvancedPosition();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package eu.crushedpixel.replaymod.holders;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class GuiEntryListValueEntry<T> implements GuiEntryListEntry {
|
||||||
|
|
||||||
|
String displayString;
|
||||||
|
T value;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDisplayString() {
|
||||||
|
return displayString;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@ import java.util.List;
|
|||||||
|
|
||||||
public class KeyframeSet implements GuiEntryListEntry {
|
public class KeyframeSet implements GuiEntryListEntry {
|
||||||
private String name;
|
private String name;
|
||||||
private Keyframe<Position>[] positionKeyframes;
|
private Keyframe<AdvancedPosition>[] positionKeyframes;
|
||||||
private Keyframe<TimestampValue>[] timeKeyframes;
|
private Keyframe<TimestampValue>[] timeKeyframes;
|
||||||
|
|
||||||
public KeyframeSet(String name, Keyframe[] keyframes) {
|
public KeyframeSet(String name, Keyframe[] keyframes) {
|
||||||
@@ -21,12 +21,12 @@ public class KeyframeSet implements GuiEntryListEntry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setKeyframes(Keyframe[] keyframes) {
|
public void setKeyframes(Keyframe[] keyframes) {
|
||||||
List<Keyframe<Position>> posKFList = new ArrayList<Keyframe<Position>>();
|
List<Keyframe<AdvancedPosition>> posKFList = new ArrayList<Keyframe<AdvancedPosition>>();
|
||||||
List<Keyframe<TimestampValue>> timeKFList = new ArrayList<Keyframe<TimestampValue>>();
|
List<Keyframe<TimestampValue>> timeKFList = new ArrayList<Keyframe<TimestampValue>>();
|
||||||
|
|
||||||
for(Keyframe kf : keyframes) {
|
for(Keyframe kf : keyframes) {
|
||||||
if(kf.getValue() instanceof Position)
|
if(kf.getValue() instanceof AdvancedPosition)
|
||||||
posKFList.add((Keyframe<Position>)kf);
|
posKFList.add((Keyframe<AdvancedPosition>)kf);
|
||||||
else if(kf.getValue() instanceof TimestampValue)
|
else if(kf.getValue() instanceof TimestampValue)
|
||||||
timeKFList.add((Keyframe<TimestampValue>) kf);
|
timeKFList.add((Keyframe<TimestampValue>) kf);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import lombok.Data;
|
|||||||
public class MarkerKeyframe {
|
public class MarkerKeyframe {
|
||||||
|
|
||||||
private int realTimestamp;
|
private int realTimestamp;
|
||||||
private Position position;
|
private AdvancedPosition position;
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package eu.crushedpixel.replaymod.holders;
|
||||||
|
|
||||||
|
import eu.crushedpixel.replaymod.interpolation.Interpolate;
|
||||||
|
import eu.crushedpixel.replaymod.interpolation.KeyframeValue;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class NumberValue implements KeyframeValue {
|
||||||
|
|
||||||
|
@Interpolate
|
||||||
|
public double value;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NumberValue newInstance() {
|
||||||
|
return new NumberValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
30
src/main/java/eu/crushedpixel/replaymod/holders/Position.java
Executable file → Normal file
30
src/main/java/eu/crushedpixel/replaymod/holders/Position.java
Executable file → Normal file
@@ -5,8 +5,6 @@ import eu.crushedpixel.replaymod.interpolation.KeyframeValue;
|
|||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@@ -15,36 +13,10 @@ public class Position implements KeyframeValue {
|
|||||||
|
|
||||||
@Interpolate
|
@Interpolate
|
||||||
public double x, y, z;
|
public double x, y, z;
|
||||||
@Interpolate
|
|
||||||
public double pitch, yaw, roll;
|
|
||||||
|
|
||||||
private Integer spectatedEntityID;
|
|
||||||
|
|
||||||
public Position(int entityID, boolean spectate) {
|
|
||||||
this(Minecraft.getMinecraft().theWorld.getEntityByID(entityID), spectate);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Position(Entity e, boolean spectate) {
|
|
||||||
this(e.posX, e.posY, e.posZ, e.rotationPitch, e.rotationYaw, spectate ? e.getEntityId() : null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Position(double x, double y, double z, float pitch, float yaw, Integer spectatedEntityID) {
|
|
||||||
this(x, y, z, pitch, yaw, 0, spectatedEntityID);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Position(double x, double y, double z, float pitch, float yaw) {
|
|
||||||
this(x, y, z, pitch, yaw, 0, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public double distanceSquared(double x, double y, double z) {
|
|
||||||
double dx = this.x - x;
|
|
||||||
double dy = this.y - y;
|
|
||||||
double dz = this.z - z;
|
|
||||||
return dx * dx + dy * dy + dz * dz;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Position newInstance() {
|
public Position newInstance() {
|
||||||
return new Position();
|
return new Position();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package eu.crushedpixel.replaymod.holders;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class Transformation {
|
||||||
|
|
||||||
|
private Position anchor;
|
||||||
|
private Position position;
|
||||||
|
private Position orientation;
|
||||||
|
private Position scale;
|
||||||
|
private double opacity;
|
||||||
|
|
||||||
|
private float width, height;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,20 +1,19 @@
|
|||||||
package eu.crushedpixel.replaymod.holders;
|
package eu.crushedpixel.replaymod.holders;
|
||||||
|
|
||||||
|
import eu.crushedpixel.replaymod.interpolation.KeyframeList;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class Transformations {
|
public class Transformations {
|
||||||
|
|
||||||
private Position anchor;
|
private KeyframeList<Position> anchorKeyframes, positionKeyframes,
|
||||||
private Position position;
|
orientationKeyframes, scaleKeyframes;
|
||||||
private Position orientation;
|
private KeyframeList<NumberValue> opacityKeyframes;
|
||||||
private Point scale;
|
|
||||||
private float opacity;
|
|
||||||
|
|
||||||
private float width, height;
|
public Transformation getTransformationForTimestamp(int timestamp) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package eu.crushedpixel.replaymod.interpolation;
|
|||||||
|
|
||||||
import eu.crushedpixel.replaymod.holders.Keyframe;
|
import eu.crushedpixel.replaymod.holders.Keyframe;
|
||||||
import eu.crushedpixel.replaymod.holders.KeyframeComparator;
|
import eu.crushedpixel.replaymod.holders.KeyframeComparator;
|
||||||
import eu.crushedpixel.replaymod.holders.Position;
|
import eu.crushedpixel.replaymod.holders.AdvancedPosition;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -107,7 +107,7 @@ public class KeyframeList<K extends KeyframeValue> extends ArrayList<Keyframe<K>
|
|||||||
public Keyframe<K> getClosestKeyframeForTimestamp(int realTime, int tolerance) {
|
public Keyframe<K> getClosestKeyframeForTimestamp(int realTime, int tolerance) {
|
||||||
List<Keyframe<K>> found = new ArrayList<Keyframe<K>>();
|
List<Keyframe<K>> found = new ArrayList<Keyframe<K>>();
|
||||||
for(Keyframe<K> kf : this) {
|
for(Keyframe<K> kf : this) {
|
||||||
if(!(kf.getValue() instanceof Position)) continue;
|
if(!(kf.getValue() instanceof AdvancedPosition)) continue;
|
||||||
if(Math.abs(kf.getRealTimestamp() - realTime) <= tolerance) {
|
if(Math.abs(kf.getRealTimestamp() - realTime) <= tolerance) {
|
||||||
found.add(kf);
|
found.add(kf);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import com.google.common.util.concurrent.ListenableFuture;
|
|||||||
import eu.crushedpixel.replaymod.ReplayMod;
|
import eu.crushedpixel.replaymod.ReplayMod;
|
||||||
import eu.crushedpixel.replaymod.chat.ChatMessageHandler;
|
import eu.crushedpixel.replaymod.chat.ChatMessageHandler;
|
||||||
import eu.crushedpixel.replaymod.holders.MarkerKeyframe;
|
import eu.crushedpixel.replaymod.holders.MarkerKeyframe;
|
||||||
import eu.crushedpixel.replaymod.holders.Position;
|
import eu.crushedpixel.replaymod.holders.AdvancedPosition;
|
||||||
import eu.crushedpixel.replaymod.utils.ReplayFileIO;
|
import eu.crushedpixel.replaymod.utils.ReplayFileIO;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
@@ -204,7 +204,7 @@ public class PacketListener extends DataListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addMarker() {
|
public void addMarker() {
|
||||||
Position pos = new Position(Minecraft.getMinecraft().getRenderViewEntity(), false);
|
AdvancedPosition pos = new AdvancedPosition(Minecraft.getMinecraft().getRenderViewEntity(), false);
|
||||||
int timestamp = (int) (System.currentTimeMillis() - startTime);
|
int timestamp = (int) (System.currentTimeMillis() - startTime);
|
||||||
|
|
||||||
MarkerKeyframe marker = new MarkerKeyframe(timestamp, pos, null);
|
MarkerKeyframe marker = new MarkerKeyframe(timestamp, pos, null);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import eu.crushedpixel.replaymod.ReplayMod;
|
|||||||
import eu.crushedpixel.replaymod.events.KeyframesModifyEvent;
|
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.Keyframe;
|
import eu.crushedpixel.replaymod.holders.Keyframe;
|
||||||
import eu.crushedpixel.replaymod.holders.Position;
|
import eu.crushedpixel.replaymod.holders.AdvancedPosition;
|
||||||
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;
|
||||||
@@ -28,7 +28,7 @@ public class PathPreviewRenderer {
|
|||||||
|
|
||||||
private DistanceComparator distanceComparator = new DistanceComparator();
|
private DistanceComparator distanceComparator = new DistanceComparator();
|
||||||
|
|
||||||
private KeyframeList<Position> keyframes;
|
private KeyframeList<AdvancedPosition> keyframes;
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void renderCameraPath(RenderWorldLastEvent event) {
|
public void renderCameraPath(RenderWorldLastEvent event) {
|
||||||
@@ -51,11 +51,11 @@ public class PathPreviewRenderer {
|
|||||||
|
|
||||||
if(keyframes.size() > 1) {
|
if(keyframes.size() > 1) {
|
||||||
|
|
||||||
Position prev = null;
|
AdvancedPosition prev = null;
|
||||||
|
|
||||||
if(ReplayMod.replaySettings.isLinearMovement()) {
|
if(ReplayMod.replaySettings.isLinearMovement()) {
|
||||||
|
|
||||||
for(Keyframe<Position> point : keyframes) {
|
for(Keyframe<AdvancedPosition> point : keyframes) {
|
||||||
if(prev != null) {
|
if(prev != null) {
|
||||||
drawConnection(doubleX, doubleY, doubleZ, prev, point.getValue(), Color.RED.getRGB());
|
drawConnection(doubleX, doubleY, doubleZ, prev, point.getValue(), Color.RED.getRGB());
|
||||||
}
|
}
|
||||||
@@ -67,7 +67,7 @@ public class PathPreviewRenderer {
|
|||||||
|
|
||||||
float max = keyframes.size() * 50;
|
float max = keyframes.size() * 50;
|
||||||
for(int i = 0; i < max; i++) {
|
for(int i = 0; i < max; i++) {
|
||||||
Position point = keyframes.getInterpolatedValueForPathPosition(i/max, false);
|
AdvancedPosition point = keyframes.getInterpolatedValueForPathPosition(i/max, false);
|
||||||
|
|
||||||
if(prev != null) {
|
if(prev != null) {
|
||||||
drawConnection(doubleX, doubleY, doubleZ, prev, point, Color.RED.getRGB());
|
drawConnection(doubleX, doubleY, doubleZ, prev, point, Color.RED.getRGB());
|
||||||
@@ -80,11 +80,11 @@ public class PathPreviewRenderer {
|
|||||||
|
|
||||||
distanceComparator.setPlayerPos(doubleX, doubleY + 1.4, doubleZ);
|
distanceComparator.setPlayerPos(doubleX, doubleY + 1.4, doubleZ);
|
||||||
|
|
||||||
List<Keyframe<Position>> distanceSorted = new ArrayList<Keyframe<Position>>(keyframes);
|
List<Keyframe<AdvancedPosition>> distanceSorted = new ArrayList<Keyframe<AdvancedPosition>>(keyframes);
|
||||||
Collections.sort(distanceSorted, distanceComparator);
|
Collections.sort(distanceSorted, distanceComparator);
|
||||||
|
|
||||||
|
|
||||||
for(Keyframe<Position> kf : distanceSorted) {
|
for(Keyframe<AdvancedPosition> kf : distanceSorted) {
|
||||||
drawPoint(doubleX, doubleY, doubleZ, kf);
|
drawPoint(doubleX, doubleY, doubleZ, kf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,7 +101,7 @@ public class PathPreviewRenderer {
|
|||||||
keyframes = event.getPositionKeyframes();
|
keyframes = event.getPositionKeyframes();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DistanceComparator implements Comparator<Keyframe<Position>> {
|
private class DistanceComparator implements Comparator<Keyframe<AdvancedPosition>> {
|
||||||
|
|
||||||
private double playerX, playerY, playerZ;
|
private double playerX, playerY, playerZ;
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ public class PathPreviewRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(Keyframe<Position> o1, Keyframe<Position> o2) {
|
public int compare(Keyframe<AdvancedPosition> o1, Keyframe<AdvancedPosition> o2) {
|
||||||
return -(new Double(o1.getValue().distanceSquared(playerX, playerY, playerZ)).compareTo(o2.getValue().distanceSquared(playerX, playerY, playerZ)));
|
return -(new Double(o1.getValue().distanceSquared(playerX, playerY, playerZ)).compareTo(o2.getValue().distanceSquared(playerX, playerY, playerZ)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@ public class PathPreviewRenderer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawConnection(double playerX, double playerY, double playerZ, Position pos1, Position pos2, int color) {
|
private void drawConnection(double playerX, double playerY, double playerZ, AdvancedPosition pos1, AdvancedPosition pos2, int color) {
|
||||||
Tessellator tessellator = Tessellator.getInstance();
|
Tessellator tessellator = Tessellator.getInstance();
|
||||||
WorldRenderer renderer = tessellator.getWorldRenderer();
|
WorldRenderer renderer = tessellator.getWorldRenderer();
|
||||||
|
|
||||||
@@ -145,7 +145,7 @@ public class PathPreviewRenderer {
|
|||||||
renderer.setTranslation(0, 0, 0);
|
renderer.setTranslation(0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawPoint(double playerX, double playerY, double playerZ, Keyframe<Position> kf) {
|
private void drawPoint(double playerX, double playerY, double playerZ, Keyframe<AdvancedPosition> kf) {
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
GlStateManager.enableTexture2D();
|
GlStateManager.enableTexture2D();
|
||||||
GlStateManager.enableLighting();
|
GlStateManager.enableLighting();
|
||||||
@@ -159,7 +159,7 @@ public class PathPreviewRenderer {
|
|||||||
|
|
||||||
mc.renderEngine.bindTexture(GuiReplayOverlay.replay_gui);
|
mc.renderEngine.bindTexture(GuiReplayOverlay.replay_gui);
|
||||||
|
|
||||||
Position pos1 = kf.getValue();
|
AdvancedPosition pos1 = kf.getValue();
|
||||||
|
|
||||||
double x = pos1.getX() - playerX;
|
double x = pos1.getX() - playerX;
|
||||||
double y = pos1.getY() - playerY;
|
double y = pos1.getY() - playerY;
|
||||||
|
|||||||
@@ -51,12 +51,12 @@ public class ReplayHandler {
|
|||||||
private static boolean inPath = false;
|
private static boolean inPath = false;
|
||||||
private static CameraEntity cameraEntity;
|
private static CameraEntity cameraEntity;
|
||||||
|
|
||||||
private static KeyframeList<Position> positionKeyframes = new KeyframeList<Position>();
|
private static KeyframeList<AdvancedPosition> positionKeyframes = new KeyframeList<AdvancedPosition>();
|
||||||
private static KeyframeList<TimestampValue> timeKeyframes = new KeyframeList<TimestampValue>();
|
private static KeyframeList<TimestampValue> timeKeyframes = new KeyframeList<TimestampValue>();
|
||||||
|
|
||||||
private static boolean inReplay = false;
|
private static boolean inReplay = false;
|
||||||
private static Entity currentEntity = null;
|
private static Entity currentEntity = null;
|
||||||
private static Position lastPosition = null;
|
private static AdvancedPosition lastPosition = null;
|
||||||
|
|
||||||
private static MarkerKeyframe[] initialMarkers = new MarkerKeyframe[0];
|
private static MarkerKeyframe[] initialMarkers = new MarkerKeyframe[0];
|
||||||
private static List<MarkerKeyframe> markerKeyframes = new ArrayList<MarkerKeyframe>();
|
private static List<MarkerKeyframe> markerKeyframes = new ArrayList<MarkerKeyframe>();
|
||||||
@@ -123,7 +123,7 @@ public class ReplayHandler {
|
|||||||
positionKeyframes.clear();
|
positionKeyframes.clear();
|
||||||
timeKeyframes.clear();
|
timeKeyframes.clear();
|
||||||
for(Keyframe kf : kfs) {
|
for(Keyframe kf : kfs) {
|
||||||
if(kf.getValue() instanceof Position) {
|
if(kf.getValue() instanceof AdvancedPosition) {
|
||||||
positionKeyframes.add(kf);
|
positionKeyframes.add(kf);
|
||||||
} else if(kf.getValue() instanceof TimestampValue) {
|
} else if(kf.getValue() instanceof TimestampValue) {
|
||||||
timeKeyframes.add(kf);
|
timeKeyframes.add(kf);
|
||||||
@@ -147,7 +147,7 @@ public class ReplayHandler {
|
|||||||
|
|
||||||
public static void spectateCamera() {
|
public static void spectateCamera() {
|
||||||
if(currentEntity != null) {
|
if(currentEntity != null) {
|
||||||
Position prev = new Position(currentEntity, false);
|
AdvancedPosition prev = new AdvancedPosition(currentEntity, false);
|
||||||
cameraEntity.movePath(prev);
|
cameraEntity.movePath(prev);
|
||||||
}
|
}
|
||||||
currentEntity = cameraEntity;
|
currentEntity = cameraEntity;
|
||||||
@@ -229,7 +229,7 @@ public class ReplayHandler {
|
|||||||
public static void toggleMarker() {
|
public static void toggleMarker() {
|
||||||
if(selectedMarkerKeyframe != null) markerKeyframes.remove(selectedMarkerKeyframe);
|
if(selectedMarkerKeyframe != null) markerKeyframes.remove(selectedMarkerKeyframe);
|
||||||
else {
|
else {
|
||||||
Position pos = new Position(mc.getRenderViewEntity(), false);
|
AdvancedPosition pos = new AdvancedPosition(mc.getRenderViewEntity(), false);
|
||||||
int timestamp = ReplayMod.replaySender.currentTimeStamp();
|
int timestamp = ReplayMod.replaySender.currentTimeStamp();
|
||||||
markerKeyframes.add(new MarkerKeyframe(timestamp, pos, null));
|
markerKeyframes.add(new MarkerKeyframe(timestamp, pos, null));
|
||||||
}
|
}
|
||||||
@@ -242,7 +242,7 @@ public class ReplayHandler {
|
|||||||
fireKeyframesModifyEvent();
|
fireKeyframesModifyEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addPositionKeyframe(Keyframe<Position> keyframe) {
|
public static void addPositionKeyframe(Keyframe<AdvancedPosition> keyframe) {
|
||||||
positionKeyframes.add(keyframe);
|
positionKeyframes.add(keyframe);
|
||||||
selectKeyframe(keyframe);
|
selectKeyframe(keyframe);
|
||||||
|
|
||||||
@@ -250,9 +250,9 @@ public class ReplayHandler {
|
|||||||
Float b;
|
Float b;
|
||||||
|
|
||||||
for(Keyframe kf : positionKeyframes) {
|
for(Keyframe kf : positionKeyframes) {
|
||||||
if(!(kf.getValue() instanceof Position)) continue;
|
if(!(kf.getValue() instanceof AdvancedPosition)) continue;
|
||||||
Keyframe<Position> pkf = (Keyframe<Position>)kf;
|
Keyframe<AdvancedPosition> pkf = (Keyframe<AdvancedPosition>)kf;
|
||||||
Position pos = pkf.getValue();
|
AdvancedPosition pos = pkf.getValue();
|
||||||
b = (float)pos.getYaw() % 360;
|
b = (float)pos.getYaw() % 360;
|
||||||
if(a != null) {
|
if(a != null) {
|
||||||
float diff = b-a;
|
float diff = b-a;
|
||||||
@@ -269,7 +269,7 @@ public class ReplayHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void addKeyframe(Keyframe keyframe) {
|
public static void addKeyframe(Keyframe keyframe) {
|
||||||
if(keyframe.getValue() instanceof Position) {
|
if(keyframe.getValue() instanceof AdvancedPosition) {
|
||||||
addPositionKeyframe(keyframe);
|
addPositionKeyframe(keyframe);
|
||||||
} else if(keyframe.getValue() instanceof TimestampValue) {
|
} else if(keyframe.getValue() instanceof TimestampValue) {
|
||||||
addTimeKeyframe(keyframe);
|
addTimeKeyframe(keyframe);
|
||||||
@@ -277,7 +277,7 @@ public class ReplayHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void removeKeyframe(Keyframe keyframe) {
|
public static void removeKeyframe(Keyframe keyframe) {
|
||||||
if(keyframe.getValue() instanceof Position) {
|
if(keyframe.getValue() instanceof AdvancedPosition) {
|
||||||
positionKeyframes.remove(keyframe);
|
positionKeyframes.remove(keyframe);
|
||||||
} else if(keyframe.getValue() instanceof TimestampValue) {
|
} else if(keyframe.getValue() instanceof TimestampValue) {
|
||||||
timeKeyframes.remove(keyframe);
|
timeKeyframes.remove(keyframe);
|
||||||
@@ -338,7 +338,7 @@ public class ReplayHandler {
|
|||||||
return backup;
|
return backup;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static KeyframeList<Position> getPositionKeyframes() {
|
public static KeyframeList<AdvancedPosition> getPositionKeyframes() {
|
||||||
return positionKeyframes;
|
return positionKeyframes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -561,11 +561,11 @@ public class ReplayHandler {
|
|||||||
realTimelinePosition = pos;
|
realTimelinePosition = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Position getLastPosition() {
|
public static AdvancedPosition getLastPosition() {
|
||||||
return lastPosition;
|
return lastPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setLastPosition(Position position) {
|
public static void setLastPosition(AdvancedPosition position) {
|
||||||
lastPosition = position;
|
lastPosition = position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package eu.crushedpixel.replaymod.replay;
|
|||||||
import eu.crushedpixel.replaymod.ReplayMod;
|
import eu.crushedpixel.replaymod.ReplayMod;
|
||||||
import eu.crushedpixel.replaymod.chat.ChatMessageHandler.ChatMessageType;
|
import eu.crushedpixel.replaymod.chat.ChatMessageHandler.ChatMessageType;
|
||||||
import eu.crushedpixel.replaymod.holders.Keyframe;
|
import eu.crushedpixel.replaymod.holders.Keyframe;
|
||||||
import eu.crushedpixel.replaymod.holders.Position;
|
import eu.crushedpixel.replaymod.holders.AdvancedPosition;
|
||||||
import eu.crushedpixel.replaymod.holders.TimestampValue;
|
import eu.crushedpixel.replaymod.holders.TimestampValue;
|
||||||
import eu.crushedpixel.replaymod.interpolation.GenericLinearInterpolation;
|
import eu.crushedpixel.replaymod.interpolation.GenericLinearInterpolation;
|
||||||
import eu.crushedpixel.replaymod.interpolation.GenericSplineInterpolation;
|
import eu.crushedpixel.replaymod.interpolation.GenericSplineInterpolation;
|
||||||
@@ -26,8 +26,8 @@ public class ReplayProcess {
|
|||||||
|
|
||||||
private static boolean linear = false;
|
private static boolean linear = false;
|
||||||
|
|
||||||
private static GenericSplineInterpolation<Position> motionSpline = null;
|
private static GenericSplineInterpolation<AdvancedPosition> motionSpline = null;
|
||||||
private static GenericLinearInterpolation<Position> motionLinear = null;
|
private static GenericLinearInterpolation<AdvancedPosition> motionLinear = null;
|
||||||
private static GenericLinearInterpolation<TimestampValue> timeLinear = null;
|
private static GenericLinearInterpolation<TimestampValue> timeLinear = null;
|
||||||
|
|
||||||
private static double previousReplaySpeed = 0;
|
private static double previousReplaySpeed = 0;
|
||||||
@@ -167,16 +167,16 @@ public class ReplayProcess {
|
|||||||
|
|
||||||
if(!linear && motionSpline == null) {
|
if(!linear && motionSpline == null) {
|
||||||
//set up spline path
|
//set up spline path
|
||||||
motionSpline = new GenericSplineInterpolation<Position>();
|
motionSpline = new GenericSplineInterpolation<AdvancedPosition>();
|
||||||
for(Keyframe<Position> kf : ReplayHandler.getPositionKeyframes()) {
|
for(Keyframe<AdvancedPosition> kf : ReplayHandler.getPositionKeyframes()) {
|
||||||
motionSpline.addPoint(kf.getValue());
|
motionSpline.addPoint(kf.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(linear && motionLinear == null) {
|
if(linear && motionLinear == null) {
|
||||||
//set up linear path
|
//set up linear path
|
||||||
motionLinear = new GenericLinearInterpolation<Position>();
|
motionLinear = new GenericLinearInterpolation<AdvancedPosition>();
|
||||||
for(Keyframe<Position> kf : ReplayHandler.getPositionKeyframes()) {
|
for(Keyframe<AdvancedPosition> kf : ReplayHandler.getPositionKeyframes()) {
|
||||||
motionLinear.addPoint(kf.getValue());
|
motionLinear.addPoint(kf.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -200,8 +200,8 @@ public class ReplayProcess {
|
|||||||
|
|
||||||
int curRealReplayTime = (int) (lastRealReplayTime + timeStep);
|
int curRealReplayTime = (int) (lastRealReplayTime + timeStep);
|
||||||
|
|
||||||
Keyframe<Position> lastPos = ReplayHandler.getPositionKeyframes().getPreviousKeyframe(curRealReplayTime);
|
Keyframe<AdvancedPosition> lastPos = ReplayHandler.getPositionKeyframes().getPreviousKeyframe(curRealReplayTime);
|
||||||
Keyframe<Position> nextPos = ReplayHandler.getPositionKeyframes().getNextKeyframe(curRealReplayTime);
|
Keyframe<AdvancedPosition> nextPos = ReplayHandler.getPositionKeyframes().getNextKeyframe(curRealReplayTime);
|
||||||
|
|
||||||
boolean spectating = false;
|
boolean spectating = false;
|
||||||
|
|
||||||
@@ -285,7 +285,7 @@ public class ReplayProcess {
|
|||||||
|
|
||||||
if(!spectating) {
|
if(!spectating) {
|
||||||
ReplayHandler.spectateCamera();
|
ReplayHandler.spectateCamera();
|
||||||
Position pos = new Position();
|
AdvancedPosition pos = new AdvancedPosition();
|
||||||
if(posCount > 1) {
|
if(posCount > 1) {
|
||||||
if(!linear) {
|
if(!linear) {
|
||||||
motionSpline.applyPoint(Math.max(0, Math.min(1, splinePos)), pos);
|
motionSpline.applyPoint(Math.max(0, Math.min(1, splinePos)), pos);
|
||||||
@@ -294,7 +294,7 @@ public class ReplayProcess {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(posCount == 1) {
|
if(posCount == 1) {
|
||||||
Keyframe<Position> keyframe = ReplayHandler.getPositionKeyframes().first();
|
Keyframe<AdvancedPosition> keyframe = ReplayHandler.getPositionKeyframes().first();
|
||||||
assert keyframe != null;
|
assert keyframe != null;
|
||||||
pos = keyframe.getValue();
|
pos = keyframe.getValue();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import eu.crushedpixel.replaymod.ReplayMod;
|
|||||||
import eu.crushedpixel.replaymod.entities.CameraEntity;
|
import eu.crushedpixel.replaymod.entities.CameraEntity;
|
||||||
import eu.crushedpixel.replaymod.events.handlers.RecordingHandler;
|
import eu.crushedpixel.replaymod.events.handlers.RecordingHandler;
|
||||||
import eu.crushedpixel.replaymod.holders.PacketData;
|
import eu.crushedpixel.replaymod.holders.PacketData;
|
||||||
import eu.crushedpixel.replaymod.holders.Position;
|
import eu.crushedpixel.replaymod.holders.AdvancedPosition;
|
||||||
import eu.crushedpixel.replaymod.utils.ReplayFile;
|
import eu.crushedpixel.replaymod.utils.ReplayFile;
|
||||||
import eu.crushedpixel.replaymod.utils.ReplayFileIO;
|
import eu.crushedpixel.replaymod.utils.ReplayFileIO;
|
||||||
import io.netty.channel.ChannelHandler.Sharable;
|
import io.netty.channel.ChannelHandler.Sharable;
|
||||||
@@ -526,7 +526,7 @@ public class ReplaySender extends ChannelInboundHandlerAdapter {
|
|||||||
if (isHurrying() && lastTimeStamp > desiredTimeStamp && !startFromBeginning) {
|
if (isHurrying() && lastTimeStamp > desiredTimeStamp && !startFromBeginning) {
|
||||||
desiredTimeStamp = -1;
|
desiredTimeStamp = -1;
|
||||||
|
|
||||||
Position pos = ReplayHandler.getLastPosition();
|
AdvancedPosition pos = ReplayHandler.getLastPosition();
|
||||||
CameraEntity cam = ReplayHandler.getCameraEntity();
|
CameraEntity cam = ReplayHandler.getCameraEntity();
|
||||||
if (cam != null && pos != null) {
|
if (cam != null && pos != null) {
|
||||||
// Move camera back in case we have been respawned
|
// Move camera back in case we have been respawned
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import eu.crushedpixel.replaymod.ReplayMod;
|
|||||||
import eu.crushedpixel.replaymod.entities.CameraEntity;
|
import eu.crushedpixel.replaymod.entities.CameraEntity;
|
||||||
import eu.crushedpixel.replaymod.gui.GuiVideoRenderer;
|
import eu.crushedpixel.replaymod.gui.GuiVideoRenderer;
|
||||||
import eu.crushedpixel.replaymod.holders.Keyframe;
|
import eu.crushedpixel.replaymod.holders.Keyframe;
|
||||||
import eu.crushedpixel.replaymod.holders.Position;
|
import eu.crushedpixel.replaymod.holders.AdvancedPosition;
|
||||||
import eu.crushedpixel.replaymod.holders.TimestampValue;
|
import eu.crushedpixel.replaymod.holders.TimestampValue;
|
||||||
import eu.crushedpixel.replaymod.interpolation.GenericLinearInterpolation;
|
import eu.crushedpixel.replaymod.interpolation.GenericLinearInterpolation;
|
||||||
import eu.crushedpixel.replaymod.interpolation.GenericSplineInterpolation;
|
import eu.crushedpixel.replaymod.interpolation.GenericSplineInterpolation;
|
||||||
@@ -42,7 +42,7 @@ public class VideoRenderer {
|
|||||||
private boolean mouseWasGrabbed;
|
private boolean mouseWasGrabbed;
|
||||||
|
|
||||||
private ChunkLoadingRenderGlobal chunkLoadingRenderGlobal;
|
private ChunkLoadingRenderGlobal chunkLoadingRenderGlobal;
|
||||||
private Interpolation<Position> movement;
|
private Interpolation<AdvancedPosition> movement;
|
||||||
private Interpolation<TimestampValue> time;
|
private Interpolation<TimestampValue> time;
|
||||||
|
|
||||||
private int framesDone;
|
private int framesDone;
|
||||||
@@ -135,16 +135,16 @@ public class VideoRenderer {
|
|||||||
|
|
||||||
fps = options.getFps();
|
fps = options.getFps();
|
||||||
if (options.isLinearMovement()) {
|
if (options.isLinearMovement()) {
|
||||||
movement = new GenericLinearInterpolation<Position>();
|
movement = new GenericLinearInterpolation<AdvancedPosition>();
|
||||||
} else {
|
} else {
|
||||||
movement = new GenericSplineInterpolation<Position>();
|
movement = new GenericSplineInterpolation<AdvancedPosition>();
|
||||||
}
|
}
|
||||||
time = new GenericLinearInterpolation<TimestampValue>();
|
time = new GenericLinearInterpolation<TimestampValue>();
|
||||||
|
|
||||||
int duration = 0;
|
int duration = 0;
|
||||||
int posKeyframes = 0;
|
int posKeyframes = 0;
|
||||||
|
|
||||||
for(Keyframe<Position> keyframe : ReplayHandler.getPositionKeyframes()) {
|
for(Keyframe<AdvancedPosition> keyframe : ReplayHandler.getPositionKeyframes()) {
|
||||||
if (keyframe.getRealTimestamp() > duration) {
|
if (keyframe.getRealTimestamp() > duration) {
|
||||||
duration = keyframe.getRealTimestamp();
|
duration = keyframe.getRealTimestamp();
|
||||||
}
|
}
|
||||||
@@ -205,7 +205,7 @@ public class VideoRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateCam() {
|
private void updateCam() {
|
||||||
KeyframeList<Position> positionKeyframes = ReplayHandler.getPositionKeyframes();
|
KeyframeList<AdvancedPosition> positionKeyframes = ReplayHandler.getPositionKeyframes();
|
||||||
|
|
||||||
if (ReplayHandler.getCameraEntity() == null) {
|
if (ReplayHandler.getCameraEntity() == null) {
|
||||||
if (mc.theWorld == null) {
|
if (mc.theWorld == null) {
|
||||||
@@ -216,12 +216,12 @@ public class VideoRenderer {
|
|||||||
int videoTime = framesDone * 1000 / fps;
|
int videoTime = framesDone * 1000 / fps;
|
||||||
int posCount = ReplayHandler.getPositionKeyframes().size();
|
int posCount = ReplayHandler.getPositionKeyframes().size();
|
||||||
|
|
||||||
Position pos = new Position();
|
AdvancedPosition pos = new AdvancedPosition();
|
||||||
Keyframe<Position> lastPos = positionKeyframes.getPreviousKeyframe(videoTime);
|
Keyframe<AdvancedPosition> lastPos = positionKeyframes.getPreviousKeyframe(videoTime);
|
||||||
Keyframe<Position> nextPos = null;
|
Keyframe<AdvancedPosition> nextPos = null;
|
||||||
if (movement == null || lastPos == null) {
|
if (movement == null || lastPos == null) {
|
||||||
// Stay at one position, no movement
|
// Stay at one position, no movement
|
||||||
Keyframe<Position> keyframe = positionKeyframes.getNextKeyframe(-1);
|
Keyframe<AdvancedPosition> keyframe = positionKeyframes.getNextKeyframe(-1);
|
||||||
assert keyframe != null;
|
assert keyframe != null;
|
||||||
pos = keyframe.getValue();
|
pos = keyframe.getValue();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -374,3 +374,4 @@ replaymod.gui.objects.properties.orientation=Orientation
|
|||||||
replaymod.gui.objects.properties.opacity=Opacity
|
replaymod.gui.objects.properties.opacity=Opacity
|
||||||
replaymod.gui.objects.properties.name=Object Name
|
replaymod.gui.objects.properties.name=Object Name
|
||||||
replaymod.gui.objects.empty=No Objects added
|
replaymod.gui.objects.empty=No Objects added
|
||||||
|
replaymod.gui.objects.defaultname=New Object
|
||||||
Reference in New Issue
Block a user