From 42ac43163c8c92a4d617a50f00d079e7f076d18d Mon Sep 17 00:00:00 2001 From: apple502j <33279053+apple502j@users.noreply.github.com> Date: Thu, 7 Sep 2023 19:18:25 +0900 Subject: [PATCH 1/2] Include namespace in modded registry tag path --- .../fabric/mixin/registry/sync/TagManagerLoaderMixin.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/mixin/registry/sync/TagManagerLoaderMixin.java b/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/mixin/registry/sync/TagManagerLoaderMixin.java index 2e1b78fdd0..312976553e 100644 --- a/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/mixin/registry/sync/TagManagerLoaderMixin.java +++ b/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/mixin/registry/sync/TagManagerLoaderMixin.java @@ -26,22 +26,16 @@ import net.minecraft.registry.tag.TagManagerLoader; import net.minecraft.util.Identifier; -import net.fabricmc.fabric.impl.registry.sync.DynamicRegistriesImpl; - // Adds namespaces to tag directories for registries added by mods. @Mixin(TagManagerLoader.class) abstract class TagManagerLoaderMixin { @Inject(method = "getPath", at = @At("HEAD"), cancellable = true) private static void onGetPath(RegistryKey> registry, CallbackInfoReturnable info) { - // TODO: Expand this change to static registries in the future. - if (!DynamicRegistriesImpl.DYNAMIC_REGISTRY_KEYS.contains(registry)) { - return; - } - Identifier id = registry.getValue(); // Vanilla doesn't mark namespaces in the directories of tags at all, // so we prepend the directories with the namespace if it's a modded registry id. + // No need to check DIRECTORIES, since this is only used by vanilla registries. if (!id.getNamespace().equals(Identifier.DEFAULT_NAMESPACE)) { info.setReturnValue("tags/" + id.getNamespace() + "/" + id.getPath()); } From d9dc91aba55c0bdf8984a3a7ed19c029f8bb54c1 Mon Sep 17 00:00:00 2001 From: apple502j <33279053+apple502j@users.noreply.github.com> Date: Thu, 7 Sep 2023 19:18:38 +0900 Subject: [PATCH 2/2] Document tag namespace change --- .../fabricmc/fabric/api/event/registry/DynamicRegistries.java | 4 ++++ .../fabric/api/event/registry/FabricRegistryBuilder.java | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/api/event/registry/DynamicRegistries.java b/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/api/event/registry/DynamicRegistries.java index 1c52338ca7..628d6adada 100644 --- a/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/api/event/registry/DynamicRegistries.java +++ b/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/api/event/registry/DynamicRegistries.java @@ -37,6 +37,10 @@ *

The list of all dynamic registries, whether from vanilla or mods, can be accessed using * {@link #getDynamicRegistries()}. * + *

Tags for the entries of a custom registry must be placed in + * {@code /tags///}. For example, the tags for the example + * registry below would be placed in {@code /tags/my_mod/my_data/}. + * *

Synchronization

* Dynamic registries are not synchronized to the client by default. * To register a synced dynamic registry, you can replace the {@link #register} call diff --git a/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/api/event/registry/FabricRegistryBuilder.java b/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/api/event/registry/FabricRegistryBuilder.java index 7bc31c316b..0a35a321a7 100644 --- a/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/api/event/registry/FabricRegistryBuilder.java +++ b/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/api/event/registry/FabricRegistryBuilder.java @@ -44,6 +44,10 @@ * } * * + *

Tags for the entries of a custom registry must be placed in + * {@code /tags///}. For example, the tags for the example + * registry above would be placed in {@code /tags/modid/registry_name/}. + * * @param The type stored in the Registry * @param The registry type */