Custom Objects are now being saved with Path Presets instead of globally
This commit is contained in:
@@ -4,6 +4,7 @@ import com.google.gson.Gson;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import eu.crushedpixel.replaymod.assets.CustomImageObject;
|
||||
import eu.crushedpixel.replaymod.holders.AdvancedPosition;
|
||||
import eu.crushedpixel.replaymod.holders.Keyframe;
|
||||
import eu.crushedpixel.replaymod.holders.KeyframeSet;
|
||||
@@ -87,6 +88,11 @@ public class LegacyKeyframeSetAdapter extends TypeAdapter<KeyframeSet[]> {
|
||||
keyframes.add(newKeyframe);
|
||||
}
|
||||
in.endArray();
|
||||
|
||||
} else if("customObjects".equals(jsonTag)) {
|
||||
CustomImageObject[] customObjects = new Gson().fromJson(in, CustomImageObject[].class);
|
||||
|
||||
set.setCustomObjects(customObjects);
|
||||
}
|
||||
}
|
||||
in.endObject();
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import eu.crushedpixel.replaymod.assets.AssetRepository;
|
||||
import eu.crushedpixel.replaymod.assets.CustomObjectRepository;
|
||||
import eu.crushedpixel.replaymod.holders.Keyframe;
|
||||
import eu.crushedpixel.replaymod.holders.KeyframeSet;
|
||||
import eu.crushedpixel.replaymod.holders.Marker;
|
||||
@@ -38,7 +37,6 @@ public class ReplayFile extends ZipFile {
|
||||
public static final String ENTRY_VISIBILITY = "visibility" + JSON_FILE_EXTENSION;
|
||||
public static final String ENTRY_MARKERS = "markers" + JSON_FILE_EXTENSION;
|
||||
public static final String ENTRY_ASSET_FOLDER = "asset/";
|
||||
public static final String ENTRY_CUSTOM_OBJECTS = "objects"+JSON_FILE_EXTENSION;
|
||||
|
||||
private final File file;
|
||||
|
||||
@@ -268,27 +266,4 @@ public class ReplayFile extends ZipFile {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public ZipArchiveEntry customObjectsEntry() {
|
||||
return getEntry(ENTRY_CUSTOM_OBJECTS);
|
||||
}
|
||||
|
||||
public Supplier<CustomObjectRepository> customImageObjects() {
|
||||
return new Supplier<CustomObjectRepository>() {
|
||||
@Override
|
||||
public CustomObjectRepository get() {
|
||||
try {
|
||||
ZipArchiveEntry entry = customObjectsEntry();
|
||||
if(entry == null) return null;
|
||||
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(getInputStream(entry)));
|
||||
return new Gson().fromJson(reader, CustomObjectRepository.class);
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user