Add ReplayStudio as subproject
Move large parts of pathing to ReplayStudio Upgrade to Java 8
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
package com.replaymod.pathing.properties;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import com.replaymod.pathing.change.Change;
|
||||
import com.replaymod.pathing.property.AbstractProperty;
|
||||
import com.replaymod.pathing.property.AbstractPropertyGroup;
|
||||
import com.replaymod.pathing.property.PropertyPart;
|
||||
import com.replaymod.replay.ReplayHandler;
|
||||
import com.replaymod.replaystudio.pathing.change.Change;
|
||||
import com.replaymod.replaystudio.pathing.property.AbstractProperty;
|
||||
import com.replaymod.replaystudio.pathing.property.AbstractPropertyGroup;
|
||||
import com.replaymod.replaystudio.pathing.property.PropertyPart;
|
||||
import com.replaymod.replaystudio.pathing.property.PropertyParts;
|
||||
import lombok.NonNull;
|
||||
import org.apache.commons.lang3.tuple.Triple;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
/**
|
||||
@@ -29,8 +29,8 @@ public class CameraProperties extends AbstractPropertyGroup {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Callable<ListenableFuture<Change>>> getSetter() {
|
||||
return Optional.absent();
|
||||
public Optional<Callable<Change>> getSetter() {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
public static class Position extends AbstractProperty<Triple<Double, Double, Double>> {
|
||||
@@ -49,8 +49,8 @@ public class CameraProperties extends AbstractPropertyGroup {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyToGame(Triple<Double, Double, Double> value, @NonNull ReplayHandler replayHandler) {
|
||||
replayHandler.getCameraEntity().setCameraPosition(value.getLeft(), value.getMiddle(), value.getRight());
|
||||
public void applyToGame(Triple<Double, Double, Double> value, @NonNull Object replayHandler) {
|
||||
((ReplayHandler) replayHandler).getCameraEntity().setCameraPosition(value.getLeft(), value.getMiddle(), value.getRight());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -85,8 +85,8 @@ public class CameraProperties extends AbstractPropertyGroup {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyToGame(Triple<Float, Float, Float> value, @NonNull ReplayHandler replayHandler) {
|
||||
replayHandler.getCameraEntity().setCameraRotation(value.getLeft(), value.getMiddle(), value.getRight());
|
||||
public void applyToGame(Triple<Float, Float, Float> value, @NonNull Object replayHandler) {
|
||||
((ReplayHandler) replayHandler).getCameraEntity().setCameraRotation(value.getLeft(), value.getMiddle(), value.getRight());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
package com.replaymod.pathing.properties;
|
||||
|
||||
import com.replaymod.pathing.property.AbstractPropertyPart;
|
||||
import com.replaymod.pathing.property.Property;
|
||||
import org.apache.commons.lang3.tuple.Triple;
|
||||
|
||||
public class PropertyParts {
|
||||
private PropertyParts(){}
|
||||
|
||||
public static class ForInteger extends AbstractPropertyPart<Integer> {
|
||||
public ForInteger(Property<Integer> property, boolean interpolatable) {
|
||||
super(property, interpolatable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toDouble(Integer value) {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer fromDouble(Integer value, double d) {
|
||||
return (int) Math.round(d);
|
||||
}
|
||||
}
|
||||
|
||||
public static class ForDoubleTriple extends AbstractPropertyPart<Triple<Double, Double, Double>> {
|
||||
private final TripleElement element;
|
||||
public ForDoubleTriple(Property<Triple<Double, Double, Double>> property, boolean interpolatable, TripleElement element) {
|
||||
super(property, interpolatable);
|
||||
this.element = element;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toDouble(Triple<Double, Double, Double> value) {
|
||||
switch (element) {
|
||||
case LEFT: return value.getLeft();
|
||||
case MIDDLE: return value.getMiddle();
|
||||
case RIGHT: return value.getRight();
|
||||
}
|
||||
throw new AssertionError(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Triple<Double, Double, Double> fromDouble(Triple<Double, Double, Double> value, double d) {
|
||||
switch (element) {
|
||||
case LEFT: return Triple.of(d, value.getMiddle(), value.getRight());
|
||||
case MIDDLE: return Triple.of(value.getLeft(), d, value.getRight());
|
||||
case RIGHT: return Triple.of(value.getLeft(), value.getMiddle(), d);
|
||||
}
|
||||
throw new AssertionError(element);
|
||||
}
|
||||
}
|
||||
|
||||
public static class ForFloatTriple extends AbstractPropertyPart<Triple<Float, Float, Float>> {
|
||||
private final TripleElement element;
|
||||
public ForFloatTriple(Property<Triple<Float, Float, Float>> property, boolean interpolatable, TripleElement element) {
|
||||
super(property, interpolatable);
|
||||
this.element = element;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toDouble(Triple<Float, Float, Float> value) {
|
||||
switch (element) {
|
||||
case LEFT: return value.getLeft();
|
||||
case MIDDLE: return value.getMiddle();
|
||||
case RIGHT: return value.getRight();
|
||||
}
|
||||
throw new AssertionError(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Triple<Float, Float, Float> fromDouble(Triple<Float, Float, Float> value, double d) {
|
||||
switch (element) {
|
||||
case LEFT: return Triple.of((float) d, value.getMiddle(), value.getRight());
|
||||
case MIDDLE: return Triple.of(value.getLeft(), (float) d, value.getRight());
|
||||
case RIGHT: return Triple.of(value.getLeft(), value.getMiddle(), (float) d);
|
||||
}
|
||||
throw new AssertionError(element);
|
||||
}
|
||||
}
|
||||
|
||||
public enum TripleElement {
|
||||
LEFT, MIDDLE, RIGHT;
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,11 @@ package com.replaymod.pathing.properties;
|
||||
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import com.replaymod.pathing.property.AbstractProperty;
|
||||
import com.replaymod.pathing.property.PropertyPart;
|
||||
import com.replaymod.replay.ReplayHandler;
|
||||
import com.replaymod.replay.ReplaySender;
|
||||
import com.replaymod.replaystudio.pathing.property.AbstractProperty;
|
||||
import com.replaymod.replaystudio.pathing.property.PropertyPart;
|
||||
import com.replaymod.replaystudio.pathing.property.PropertyParts;
|
||||
import lombok.NonNull;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -28,8 +29,8 @@ public class TimestampProperty extends AbstractProperty<Integer> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyToGame(Integer value, @NonNull ReplayHandler replayHandler) {
|
||||
ReplaySender replaySender = replayHandler.getReplaySender();
|
||||
public void applyToGame(Integer value, @NonNull Object replayHandler) {
|
||||
ReplaySender replaySender = ((ReplayHandler) replayHandler).getReplaySender();
|
||||
if (replaySender.isAsyncMode()) {
|
||||
replaySender.jumpToTime(value);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user