Skip to content

Commit

Permalink
Fix reg on fabric
Browse files Browse the repository at this point in the history
  • Loading branch information
UnRealDinnerbone committed Dec 9, 2024
1 parent 946b095 commit 7eefb66
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
### 21.4.0
### 21.4.1

- Update to Minecraft 1.21.4
- Fix registration on fabirc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

public interface ICreativeTabRegister {

@ApiStatus.Internal
void addItemToCreativeTab(ResourceKey<CreativeModeTab> tabResourceKey, List<Supplier<? extends Item>> item);

default void addItemToCreativeTab(ResourceKey<CreativeModeTab> tabResourceKey, Supplier<? extends Item> item) {
addItemToCreativeTab(tabResourceKey, List.of(item));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,12 @@ public void addItemToCreativeTab(ResourceKey<CreativeModeTab> tabResourceKey, Li
public <T> void registryRegistryObjects(String modId, RegistryObjects<T> registryObjects) {
ResourceKey<Registry<T>> registryKey = registryObjects.registryKey();
BuiltInRegistries.REGISTRY.get(registryKey.location()).ifPresentOrElse(registry -> {
Registry<T> theRegistry = (Registry<T>) registry;
Registry<?> value = registry.value();
Registry<T> theRegistry = (Registry<T>) value;
for (RegistryEntry<? extends T> 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<T> register = Registry.registerForHolder(theRegistry, id, object.get());
object.setHolder(register);
}
}, () -> LOGGER.error("Failed to find registry: {}", registryKey.location()));

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 7eefb66

Please sign in to comment.