mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-27 00:04:42 +00:00
Move MantleCodec to com.volmit.data.Codec
Saved world state stores values with the same contract, so the codec no longer belongs to the mantle package or says mantle in its doc.
This commit is contained in:
1 parent
c61865b9f2
commit
7cc3302c32
8 files changed
+33
-31
No files matched your search
@@ -1,6 +1,6 @@
|
||||
package com.volmit;
|
||||
|
||||
import com.volmit.mantle.MantleCodec;
|
||||
import com.volmit.data.Codec;
|
||||
import com.volmit.mantle.MantleKey;
|
||||
import com.volmit.mantle.MantleLifetime;
|
||||
import com.volmit.resource.ResourceKind;
|
||||
@@ -21,7 +21,7 @@ public interface FeatureRegistry {
|
||||
* preserve unknown persisted layers or fail explicitly, never silently discard them.
|
||||
* GENERATION layers also require codecs.
|
||||
*/
|
||||
<T> void registerMantle(MantleKey<T> key, MantleLifetime lifetime, MantleCodec<T> codec);
|
||||
<T> void registerMantle(MantleKey<T> key, MantleLifetime lifetime, Codec<T> codec);
|
||||
|
||||
/** Catalogs a settings type that no stage names in {@code when(...)}, such as one read only
|
||||
* through {@link com.volmit.config.FeatureSettings#at}, so the host decodes it and studio
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.volmit.data;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
|
||||
/** Value serialization for data the host stores for a module: mantle layers ({@link com.volmit.mantle.MantleKey}) and
|
||||
* saved world state ({@link com.volmit.world.SavedKey}). The host frames payloads and stores the key ID and version
|
||||
* separately. Implementations must support concurrent calls, must not close streams, and must reject malformed data or
|
||||
* unsupported stored versions with IOException. Values cannot be null.
|
||||
*/
|
||||
public interface Codec<T> {
|
||||
/** Nonnegative format version, stable for the registration lifetime. */
|
||||
int version();
|
||||
|
||||
void write(DataOutput output, T value) throws IOException;
|
||||
|
||||
T read(DataInput input, int storedVersion) throws IOException;
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.volmit.mantle;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
|
||||
/** Value serialization. Host frames payloads and stores key ID and version separately.
|
||||
* Implementations must support concurrent calls, must not close streams, and must reject
|
||||
* malformed data or unsupported stored versions with IOException. Values cannot be null.
|
||||
*/
|
||||
public interface MantleCodec<T> {
|
||||
/** Nonnegative format version, stable for the registration lifetime. */
|
||||
int version();
|
||||
|
||||
void write(DataOutput output, T value) throws IOException;
|
||||
|
||||
T read(DataInput input, int storedVersion) throws IOException;
|
||||
}
|
||||
Reference in new issue
Block a user