mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 08:44:50 +00:00
SavedKey moves to com.volmit.data and Codec becomes StorageCodec, which ends the clash with JsonForms.Codec. SavedKey.id and MantleKey.id are ResourceIds, so the copied id regex is gone. Modules register saved keys in setup with FeatureRegistry.registerSaved, owned like mantle keys, and RunningWorld.saved rejects a key that is not the registered one.
16 lines
503 B
Java
16 lines
503 B
Java
package com.volmit.mantle;
|
|
|
|
import com.volmit.resource.ResourceId;
|
|
import java.util.Objects;
|
|
|
|
/** Stable storage identity. Different IDs may use the same value class without sharing data. */
|
|
public record MantleKey<T>(ResourceId id, Class<T> type) {
|
|
public MantleKey {
|
|
Objects.requireNonNull(id, "id");
|
|
Objects.requireNonNull(type, "type");
|
|
if (type.isPrimitive()) {
|
|
throw new IllegalArgumentException("Mantle values require a reference type");
|
|
}
|
|
}
|
|
}
|