From 32e18f054544ad4814055a1b99fc6dc3baaeb53e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E9=9B=A8=E8=90=BD?= Date: Wed, 23 Aug 2023 15:29:46 +0800 Subject: [PATCH 1/3] Maybe a fix for architectury/architectury-api#430. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 秋雨落 --- .../registry/registries/fabric/RegistrarManagerImpl.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fabric/src/main/java/dev/architectury/registry/registries/fabric/RegistrarManagerImpl.java b/fabric/src/main/java/dev/architectury/registry/registries/fabric/RegistrarManagerImpl.java index bf0851ba6..f3f5e2632 100644 --- a/fabric/src/main/java/dev/architectury/registry/registries/fabric/RegistrarManagerImpl.java +++ b/fabric/src/main/java/dev/architectury/registry/registries/fabric/RegistrarManagerImpl.java @@ -207,7 +207,14 @@ public String toString() { @Override public RegistrySupplier register(ResourceLocation id, Supplier supplier) { - Registry.register(delegate, id, supplier.get()); + if (id.getNamespace().equals("minecraft")) { + var reference = supplier.get(); + var rawId = getRawId(get(id)); + Registry.registerMapping((Registry) delegate, rawId, id.toString(), reference); + } else { + Registry.register(delegate, id, supplier.get()); + } + return (RegistrySupplier) delegate(id); } From 646a614749343eea4fa94363e406995b0f4edd54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E9=9B=A8=E8=90=BD?= Date: Thu, 24 Aug 2023 18:18:32 +0800 Subject: [PATCH 2/3] Check if the content registered. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 秋雨落 --- .../registry/registries/fabric/RegistrarManagerImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fabric/src/main/java/dev/architectury/registry/registries/fabric/RegistrarManagerImpl.java b/fabric/src/main/java/dev/architectury/registry/registries/fabric/RegistrarManagerImpl.java index f3f5e2632..7083ca8c8 100644 --- a/fabric/src/main/java/dev/architectury/registry/registries/fabric/RegistrarManagerImpl.java +++ b/fabric/src/main/java/dev/architectury/registry/registries/fabric/RegistrarManagerImpl.java @@ -207,8 +207,8 @@ public String toString() { @Override public RegistrySupplier register(ResourceLocation id, Supplier supplier) { - if (id.getNamespace().equals("minecraft")) { - var reference = supplier.get(); + var reference = supplier.get(); + if (getId(reference) != null) { var rawId = getRawId(get(id)); Registry.registerMapping((Registry) delegate, rawId, id.toString(), reference); } else { From f473d10aae897b2b06763a0fca71853901ab7e68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E9=9B=A8=E8=90=BD?= Date: Sun, 27 Aug 2023 07:47:30 +0800 Subject: [PATCH 3/3] Fix a mistake. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 秋雨落 --- .../registry/registries/fabric/RegistrarManagerImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fabric/src/main/java/dev/architectury/registry/registries/fabric/RegistrarManagerImpl.java b/fabric/src/main/java/dev/architectury/registry/registries/fabric/RegistrarManagerImpl.java index 7083ca8c8..6dba527c9 100644 --- a/fabric/src/main/java/dev/architectury/registry/registries/fabric/RegistrarManagerImpl.java +++ b/fabric/src/main/java/dev/architectury/registry/registries/fabric/RegistrarManagerImpl.java @@ -208,7 +208,7 @@ public String toString() { @Override public RegistrySupplier register(ResourceLocation id, Supplier supplier) { var reference = supplier.get(); - if (getId(reference) != null) { + if (contains(id)) { var rawId = getRawId(get(id)); Registry.registerMapping((Registry) delegate, rawId, id.toString(), reference); } else {