All Downloads are FREE. Search and download functionalities are using the official Maven repository.

walkmc.interfaces.Storable.kt Maven / Gradle / Ivy

package walkmc.interfaces

import walkmc.serializer.tag.impl.*

/**
 * Represents an object that's can be stored.
 */
interface Storable {
	
	/**
	 * Saves this storable object in the given [tag].
	 *
	 * @return the same [tag].
	 */
	fun save(tag: CompoundTag): CompoundTag
	
	/**
	 * Loads this storable in the given [tag].
	 *
	 * @return the same [tag].
	 */
	fun load(tag: CompoundTag): CompoundTag
}

/**
 * Saves the given [storable] object with the given key in this compound tag.
 */
fun CompoundTag.save(key: String, storable: Storable) = put(key, storable.save(CompoundTag()))




© 2015 - 2025 Weber Informatics LLC | Privacy Policy