From 7eefb66aa9bba52bd3edd104c49da64e52ef1860 Mon Sep 17 00:00:00 2001 From: UnRealDinnerbone Date: Mon, 9 Dec 2024 16:23:41 -0600 Subject: [PATCH] Fix reg on fabric --- CHANGELOG.md | 4 ++-- .../api/platform/services/ICreativeTabRegister.java | 5 ++++- .../trenzalore/platform/FabricPlatformHelper.java | 7 ++++--- gradle.properties | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3b7a9c..ebde73b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,3 @@ -### 21.4.0 +### 21.4.1 -- Update to Minecraft 1.21.4 \ No newline at end of file +- Fix registration on fabirc \ No newline at end of file diff --git a/common/src/main/java/com/unrealdinnerbone/trenzalore/api/platform/services/ICreativeTabRegister.java b/common/src/main/java/com/unrealdinnerbone/trenzalore/api/platform/services/ICreativeTabRegister.java index 85df0a6..b8db73b 100644 --- a/common/src/main/java/com/unrealdinnerbone/trenzalore/api/platform/services/ICreativeTabRegister.java +++ b/common/src/main/java/com/unrealdinnerbone/trenzalore/api/platform/services/ICreativeTabRegister.java @@ -10,6 +10,9 @@ public interface ICreativeTabRegister { - @ApiStatus.Internal void addItemToCreativeTab(ResourceKey tabResourceKey, List> item); + + default void addItemToCreativeTab(ResourceKey tabResourceKey, Supplier item) { + addItemToCreativeTab(tabResourceKey, List.of(item)); + } } diff --git a/fabric/src/main/java/com/unrealdinnerbone/trenzalore/platform/FabricPlatformHelper.java b/fabric/src/main/java/com/unrealdinnerbone/trenzalore/platform/FabricPlatformHelper.java index 0bbc9c9..4ecbe68 100644 --- a/fabric/src/main/java/com/unrealdinnerbone/trenzalore/platform/FabricPlatformHelper.java +++ b/fabric/src/main/java/com/unrealdinnerbone/trenzalore/platform/FabricPlatformHelper.java @@ -58,11 +58,12 @@ public void addItemToCreativeTab(ResourceKey tabResourceKey, Li public void registryRegistryObjects(String modId, RegistryObjects registryObjects) { ResourceKey> registryKey = registryObjects.registryKey(); BuiltInRegistries.REGISTRY.get(registryKey.location()).ifPresentOrElse(registry -> { - Registry theRegistry = (Registry) registry; + Registry value = registry.value(); + Registry theRegistry = (Registry) value; for (RegistryEntry object : registryObjects.objects()) { ResourceLocation id = RLUtils.rl(modId, object.name()); - T register = Registry.register(theRegistry, id, object.get()); - object.setHolder(Holder.direct(register)); + Holder.Reference register = Registry.registerForHolder(theRegistry, id, object.get()); + object.setHolder(register); } }, () -> LOGGER.error("Failed to find registry: {}", registryKey.location())); diff --git a/gradle.properties b/gradle.properties index 7a8a64d..7c2f8c1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ # Project -mod_version=21.4.0 +mod_version=21.4.1 maven_group=com.unrealdinnerbone mod_name=Trenzalore mod_author=UnRealDinnerbone