Interface SlimeSerializationAdapter
@Experimental
public interface SlimeSerializationAdapter
-
Method Summary
Modifier and TypeMethodDescription@NotNull SlimeWorlddeserializeWorld(@NotNull String worldName, byte[] serializedWorld, @Nullable SlimeLoader loader, @NotNull SlimePropertyMap propertyMap, boolean readOnly) Deserializes a world from the given byte array and applies data fixers to the world.intThe current slime format version used by AdvancedSlimePaper.byte[]serializeWorld(@NotNull SlimeWorld slimeWorld) Serializes aSlimeWorldwith the current formatgetSlimeFormat().
-
Method Details
-
serializeWorld
Serializes aSlimeWorldwith the current formatgetSlimeFormat().If the world is loaded, make sure to use a serializable copy that can be obtained with
SlimeWorldInstance.getSerializableCopy().- Parameters:
slimeWorld- World to serialize.- Returns:
- Serialized world data in bytes.
- Throws:
IllegalArgumentException- If the world is aSlimeWorldInstance
-
deserializeWorld
@NotNull @NotNull SlimeWorld deserializeWorld(@NotNull @NotNull String worldName, byte[] serializedWorld, @Nullable @Nullable SlimeLoader loader, @NotNull @NotNull SlimePropertyMap propertyMap, boolean readOnly) throws CorruptedWorldException, NewerFormatException, IOException Deserializes a world from the given byte array and applies data fixers to the world.Unlike
AdvancedSlimePaperAPI.readWorld(SlimeLoader, String, boolean, SlimePropertyMap)this does not save data fixed worlds to the providedSlimeLoaderautomatically.- Parameters:
worldName- Name of the world.serializedWorld- Serialized world data in bytes.loader-SlimeLoaderused when saving the world.propertyMap- ASlimePropertyMapobject containing all the properties of the world.readOnly- Whether read-only mode is enabled.- Returns:
- A
SlimeWorld, which is the in-memory representation of the world. - Throws:
IOException- if there was a generic problem reading the world.CorruptedWorldException- if the world retrieved cannot be properly parsed into aSlimeWorldobject.NewerFormatException- if the world uses a newer version of the SRF.
-
getSlimeFormat
int getSlimeFormat()The current slime format version used by AdvancedSlimePaper.- Returns:
- The slime format version
-