diff --git a/legacy-fabric-registry-sync-api-v2/1.12.2/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/versioned/SimpleRegistryMixin.java b/legacy-fabric-registry-sync-api-v2/1.12.2/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/versioned/SimpleRegistryMixin.java index d04669d94..b3eb33d2a 100644 --- a/legacy-fabric-registry-sync-api-v2/1.12.2/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/versioned/SimpleRegistryMixin.java +++ b/legacy-fabric-registry-sync-api-v2/1.12.2/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/versioned/SimpleRegistryMixin.java @@ -24,13 +24,13 @@ import net.minecraft.class_2929; import net.minecraft.util.registry.SimpleRegistry; -import net.legacyfabric.fabric.api.registry.v2.registry.holder.SyncedRegistryHolder; +import net.legacyfabric.fabric.api.registry.v2.registry.holder.SyncedRegistry; import net.legacyfabric.fabric.api.registry.v2.registry.registrable.IdsHolder; import net.legacyfabric.fabric.api.registry.v2.registry.registrable.SyncedRegistrable; import net.legacyfabric.fabric.api.util.Identifier; @Mixin(SimpleRegistry.class) -public abstract class SimpleRegistryMixin implements SyncedRegistryHolder, SyncedRegistrable { +public abstract class SimpleRegistryMixin implements SyncedRegistry, SyncedRegistrable { // 1.8+ @Shadow public abstract void add(int id, K identifier, V object); diff --git a/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/RegistryHelper.java b/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/RegistryHelper.java index a7852b2c0..d9053b4a5 100644 --- a/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/RegistryHelper.java +++ b/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/RegistryHelper.java @@ -19,12 +19,12 @@ import java.util.function.Function; -import net.legacyfabric.fabric.api.registry.v2.registry.holder.RegistryHolder; +import net.legacyfabric.fabric.api.registry.v2.registry.holder.Registry; import net.legacyfabric.fabric.api.util.Identifier; import net.legacyfabric.fabric.impl.registry.RegistryHelperImplementation; public class RegistryHelper { - public static void register(RegistryHolder registry, Identifier identifier, T value) { + public static void register(Registry registry, Identifier identifier, T value) { RegistryHelperImplementation.register(registry, identifier, value); } @@ -32,7 +32,7 @@ public static void register(Identifier registryId, Identifier identifier, T register(RegistryHelperImplementation.getRegistry(registryId), identifier, value); } - public static T register(RegistryHolder registry, Identifier identifier, Function valueConstructor) { + public static T register(Registry registry, Identifier identifier, Function valueConstructor) { return RegistryHelperImplementation.register(registry, identifier, valueConstructor); } @@ -40,11 +40,11 @@ public static T register(Identifier registryId, Identifier identifier, Funct return register(RegistryHelperImplementation.getRegistry(registryId), identifier, valueConstructor); } - public static void addRegistry(Identifier identifier, RegistryHolder registryHolder) { - RegistryHelperImplementation.registerRegistry(identifier, registryHolder); + public static void addRegistry(Identifier identifier, Registry registry) { + RegistryHelperImplementation.registerRegistry(identifier, registry); } - public static RegistryHolder getRegistry(Identifier identifier) { + public static Registry getRegistry(Identifier identifier) { return RegistryHelperImplementation.getRegistry(identifier); } @@ -53,7 +53,7 @@ public static T getValue(Identifier registryId, Identifier identifier) { .fabric$getValue(identifier); } - public static T getValue(RegistryHolder registry, Identifier identifier) { + public static T getValue(Registry registry, Identifier identifier) { return registry.fabric$getValue(identifier); } } diff --git a/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/event/RegistryBeforeAddCallback.java b/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/event/RegistryBeforeAddCallback.java index 362777c05..6136747e9 100644 --- a/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/event/RegistryBeforeAddCallback.java +++ b/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/event/RegistryBeforeAddCallback.java @@ -18,7 +18,7 @@ package net.legacyfabric.fabric.api.registry.v2.event; import net.legacyfabric.fabric.api.event.Event; -import net.legacyfabric.fabric.api.registry.v2.registry.holder.RegistryHolder; +import net.legacyfabric.fabric.api.registry.v2.registry.holder.Registry; import net.legacyfabric.fabric.api.util.Identifier; import net.legacyfabric.fabric.impl.registry.RegistryHelperImplementation; @@ -30,7 +30,7 @@ static Event> event(Identifier registryId) { return event(RegistryHelperImplementation.getRegistry(registryId)); } - static Event> event(RegistryHolder registry) { + static Event> event(Registry registry) { return registry.fabric$getBeforeAddedCallback(); } } diff --git a/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/event/RegistryEntryAddedCallback.java b/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/event/RegistryEntryAddedCallback.java index a165441bb..c571737c2 100644 --- a/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/event/RegistryEntryAddedCallback.java +++ b/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/event/RegistryEntryAddedCallback.java @@ -18,7 +18,7 @@ package net.legacyfabric.fabric.api.registry.v2.event; import net.legacyfabric.fabric.api.event.Event; -import net.legacyfabric.fabric.api.registry.v2.registry.holder.RegistryHolder; +import net.legacyfabric.fabric.api.registry.v2.registry.holder.Registry; import net.legacyfabric.fabric.api.util.Identifier; import net.legacyfabric.fabric.impl.registry.RegistryHelperImplementation; @@ -30,7 +30,7 @@ static Event> event(Identifier registryId) { return event(RegistryHelperImplementation.getRegistry(registryId)); } - static Event> event(RegistryHolder registry) { + static Event> event(Registry registry) { return registry.fabric$getEntryAddedCallback(); } } diff --git a/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/event/RegistryInitializedEvent.java b/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/event/RegistryInitializedEvent.java index 54f07c034..d1b5e7d01 100644 --- a/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/event/RegistryInitializedEvent.java +++ b/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/event/RegistryInitializedEvent.java @@ -18,7 +18,7 @@ package net.legacyfabric.fabric.api.registry.v2.event; import net.legacyfabric.fabric.api.event.Event; -import net.legacyfabric.fabric.api.registry.v2.registry.holder.RegistryHolder; +import net.legacyfabric.fabric.api.registry.v2.registry.holder.Registry; import net.legacyfabric.fabric.api.util.Identifier; import net.legacyfabric.fabric.impl.registry.RegistryHelperImplementation; @@ -27,7 +27,7 @@ */ @FunctionalInterface public interface RegistryInitializedEvent { - void initialized(RegistryHolder registry); + void initialized(Registry registry); static Event event(Identifier registryId) { return RegistryHelperImplementation.getInitializationEvent(registryId); diff --git a/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/registry/SyncedRegistry.java b/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/registry/SyncedRegistry.java index fc27a1826..b91b65820 100644 --- a/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/registry/SyncedRegistry.java +++ b/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/registry/SyncedRegistry.java @@ -17,8 +17,7 @@ package net.legacyfabric.fabric.api.registry.v2.registry; -import net.legacyfabric.fabric.api.registry.v2.registry.holder.SyncedRegistryHolder; import net.legacyfabric.fabric.api.registry.v2.registry.registrable.SyncedRegistrable; -public interface SyncedRegistry extends SyncedRegistryHolder, SyncedRegistrable { +public interface SyncedRegistry extends net.legacyfabric.fabric.api.registry.v2.registry.holder.SyncedRegistry, SyncedRegistrable { } diff --git a/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/registry/holder/RegistryHolder.java b/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/registry/holder/Registry.java similarity index 96% rename from legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/registry/holder/RegistryHolder.java rename to legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/registry/holder/Registry.java index d2c42b146..a81c3a986 100644 --- a/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/registry/holder/RegistryHolder.java +++ b/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/registry/holder/Registry.java @@ -25,7 +25,7 @@ import net.legacyfabric.fabric.api.registry.v2.event.RegistryEntryAddedCallback; import net.legacyfabric.fabric.api.util.Identifier; -public interface RegistryHolder extends Iterable { +public interface Registry extends Iterable { Identifier fabric$getId(); Event> fabric$getEntryAddedCallback(); Event> fabric$getBeforeAddedCallback(); diff --git a/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/registry/holder/SyncedRegistryHolder.java b/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/registry/holder/SyncedRegistry.java similarity index 93% rename from legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/registry/holder/SyncedRegistryHolder.java rename to legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/registry/holder/SyncedRegistry.java index 04f762a71..bfb8ec27a 100644 --- a/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/registry/holder/SyncedRegistryHolder.java +++ b/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/api/registry/v2/registry/holder/SyncedRegistry.java @@ -19,7 +19,7 @@ import net.legacyfabric.fabric.api.util.Identifier; -public interface SyncedRegistryHolder extends RegistryHolder { +public interface SyncedRegistry extends Registry { int fabric$getRawId(T value); default int fabric$getRawId(Identifier identifier) { T value = fabric$getValue(identifier); diff --git a/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/impl/registry/RegistryHelperImplementation.java b/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/impl/registry/RegistryHelperImplementation.java index ef16ee3b0..61f9f5032 100644 --- a/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/impl/registry/RegistryHelperImplementation.java +++ b/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/impl/registry/RegistryHelperImplementation.java @@ -24,7 +24,7 @@ import net.legacyfabric.fabric.api.event.Event; import net.legacyfabric.fabric.api.event.EventFactory; import net.legacyfabric.fabric.api.registry.v2.event.RegistryInitializedEvent; -import net.legacyfabric.fabric.api.registry.v2.registry.holder.RegistryHolder; +import net.legacyfabric.fabric.api.registry.v2.registry.holder.Registry; import net.legacyfabric.fabric.api.registry.v2.registry.registrable.Registrable; import net.legacyfabric.fabric.api.registry.v2.registry.registrable.SyncedRegistrable; import net.legacyfabric.fabric.api.util.Identifier; @@ -34,7 +34,7 @@ public class RegistryHelperImplementation { public static final boolean hasFlatteningBegun = VersionUtils.matches(">=1.8 <=1.12.2"); public static final Map> INITIALIZATION_EVENTS = new HashMap<>(); - private static final Map> REGISTRIES = new HashMap<>(); + private static final Map> REGISTRIES = new HashMap<>(); public static Event getInitializationEvent(Identifier registryId) { Event event; @@ -45,7 +45,7 @@ public static Event getInitializationEvent(Identifier event = EventFactory.createArrayBacked(RegistryInitializedEvent.class, (callbacks) -> new RegistryInitializedEvent() { @Override - public void initialized(RegistryHolder registry) { + public void initialized(Registry registry) { for (RegistryInitializedEvent callback : callbacks) { callback.initialized(registry); } @@ -58,18 +58,18 @@ public void initialized(RegistryHolder registry) { return event; } - public static RegistryHolder getRegistry(Identifier identifier) { - return (RegistryHolder) REGISTRIES.get(identifier); + public static Registry getRegistry(Identifier identifier) { + return (Registry) REGISTRIES.get(identifier); } - public static void registerRegistry(Identifier identifier, RegistryHolder holder) { + public static void registerRegistry(Identifier identifier, Registry holder) { if (REGISTRIES.containsKey(identifier)) throw new IllegalArgumentException("Attempted to register registry " + identifier.toString() + " twices!"); REGISTRIES.put(identifier, holder); if (holder instanceof RegistryIdSetter) ((RegistryIdSetter) holder).fabric$setId(identifier); } - public static void register(RegistryHolder registry, Identifier identifier, T value) { + public static void register(Registry registry, Identifier identifier, T value) { if (!(registry instanceof Registrable)) throw new IllegalArgumentException("Can't register object to non registrable registry " + registry.fabric$getId()); Registrable registrable = (Registrable) registry; @@ -82,7 +82,7 @@ public static void register(RegistryHolder registry, Identifier identifie registrable.fabric$register(computedId, identifier, value); } - public static T register(RegistryHolder registry, Identifier identifier, Function valueConstructor) { + public static T register(Registry registry, Identifier identifier, Function valueConstructor) { if (!(registry instanceof SyncedRegistrable)) throw new IllegalArgumentException("Can't register object to non registrable registry " + registry.fabric$getId()); SyncedRegistrable registrable = (SyncedRegistrable) registry; diff --git a/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/MutableRegistryMixin.java b/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/MutableRegistryMixin.java index f07a965a3..75c4e0697 100644 --- a/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/MutableRegistryMixin.java +++ b/legacy-fabric-registry-sync-api-v2/common/src/main/java/net/legacyfabric/fabric/mixin/registry/sync/MutableRegistryMixin.java @@ -30,14 +30,14 @@ import net.legacyfabric.fabric.api.event.EventFactory; import net.legacyfabric.fabric.api.registry.v2.event.RegistryBeforeAddCallback; import net.legacyfabric.fabric.api.registry.v2.event.RegistryEntryAddedCallback; -import net.legacyfabric.fabric.api.registry.v2.registry.holder.RegistryHolder; +import net.legacyfabric.fabric.api.registry.v2.registry.holder.Registry; import net.legacyfabric.fabric.api.registry.v2.registry.registrable.Registrable; import net.legacyfabric.fabric.api.util.Identifier; import net.legacyfabric.fabric.impl.registry.RegistryHelperImplementation; import net.legacyfabric.fabric.impl.registry.accessor.RegistryIdSetter; @Mixin(MutableRegistry.class) -public abstract class MutableRegistryMixin implements RegistryHolder, RegistryIdSetter, Registrable { +public abstract class MutableRegistryMixin implements Registry, RegistryIdSetter, Registrable { @Shadow public abstract void put(Object key, Object value);