Register saved keys per module, key mantle and saved ids by ResourceId

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.
This commit is contained in:
piexel committed 2026-11-06 12:50:42 +01:00
1 parent 6c8fa31a7b
commit 307b89c5fe
19 files changed
+156 -88

No files matched your search

@@ -1,15 +1,13 @@
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>(String id, Class<T> type) {
public record MantleKey<T>(ResourceId id, Class<T> type) {
public MantleKey {
Objects.requireNonNull(id, "id");
Objects.requireNonNull(type, "type");
if (!id.matches("[a-z0-9_.-]+:[a-z0-9_./-]+")) {
throw new IllegalArgumentException("Expected a namespaced mantle ID: " + id);
}
if (type.isPrimitive()) {
throw new IllegalArgumentException("Mantle values require a reference type");
}