Interface SlimeSerializationAdapter
@Experimental
public interface SlimeSerializationAdapter
-
Method Summary
Modifier and TypeMethodDescription@NotNull SlimeWorld
deserializeWorld
(@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.int
The current slime format version used by AdvancedSlimePaper.byte[]
serializeWorld
(@NotNull SlimeWorld slimeWorld) Serializes aSlimeWorld
with the current formatgetSlimeFormat()
.
-
Method Details
-
serializeWorld
Serializes aSlimeWorld
with 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 providedSlimeLoader
automatically.- Parameters:
worldName
- Name of the world.serializedWorld
- Serialized world data in bytes.loader
-SlimeLoader
used when saving the world.propertyMap
- ASlimePropertyMap
object 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 aSlimeWorld
object.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
-