Warning, GIGANTIC COMMIT!

Replaced Keyframe subclasses with Generic Types of Keyframe and replaced all instanceof calls
Replaced implementations of Linear and Spline interpolation to interpolate any Object that extends KeyframeValue and contains at least one public double Field. I'll need this for Keyframe interpolation in CustomImageObject Transformations
Made MarkerKeyframe *no* subclass of Keyframe to avoid conflicts with PositionKeyframe in instanceof checks for Keyframe#getValue
Created KeyframeList which extends ArrayList to provide some helping functions which DRY up the ReplayHandler
Split up ReplayHandler's keyframeList into timeKeyframeList and positionKeyframeList
This commit is contained in:
CrushedPixel
2015-07-08 04:13:24 +02:00
parent 89cc6938f8
commit 5100b63964
35 changed files with 765 additions and 1117 deletions

View File

@@ -6,7 +6,6 @@ import eu.crushedpixel.replaymod.gui.elements.listeners.SelectionListener;
import eu.crushedpixel.replaymod.gui.overlay.GuiReplayOverlay;
import eu.crushedpixel.replaymod.holders.Keyframe;
import eu.crushedpixel.replaymod.holders.KeyframeSet;
import eu.crushedpixel.replaymod.holders.MarkerKeyframe;
import eu.crushedpixel.replaymod.replay.ReplayHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
@@ -132,12 +131,9 @@ public class GuiKeyframeRepository extends GuiScreen implements GuiReplayOverlay
if(!button.enabled) return;
switch(button.id) {
case GuiConstants.KEYFRAME_REPOSITORY_ADD_BUTTON:
List<Keyframe> kfs = new ArrayList<Keyframe>(ReplayHandler.getKeyframes());
for(Keyframe kf : new ArrayList<Keyframe>(kfs)) {
if(kf instanceof MarkerKeyframe) kfs.remove(kf);
}
List<Keyframe> kfs = new ArrayList<Keyframe>(ReplayHandler.getAllKeyframes());
Keyframe[] keyframes = kfs.toArray(new Keyframe[ReplayHandler.getKeyframes().size()]);
Keyframe[] keyframes = kfs.toArray(new Keyframe[ReplayHandler.getAllKeyframes().size()]);
KeyframeSet newSet = new KeyframeSet(I18n.format("replaymod.gui.keyframerepository.preset.defaultname"), keyframes);
if(newSet.getPositionKeyframeCount() < 2 || newSet.getTimeKeyframeCount() < 1) {
message = I18n.format("replaymod.chat.morekeyframes");