mirror of
https://github.com/architectury/architectury-api.git
synced 2026-04-03 05:57:40 -05:00
Merge remote-tracking branch 'architectury/1.17' into 1.18
# Conflicts: # gradle.properties
This commit is contained in:
@@ -28,6 +28,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* Platform-agnostic wrapper of minecraft registries, should be used to register content.
|
||||
@@ -55,6 +56,19 @@ public final class Registries {
|
||||
return this.provider.get(registry);
|
||||
}
|
||||
|
||||
/**
|
||||
* Listen to registry registration, the callback is called when content should be registered.
|
||||
* On forge, this is invoked after {@code RegistryEvent.Register}.
|
||||
* On fabric, this is invoked immediately.
|
||||
*
|
||||
* @param key the key of the registry
|
||||
* @param callback the callback to be invoked
|
||||
* @param <T> the type of registry entry
|
||||
*/
|
||||
public <T> void forRegistry(ResourceKey<Registry<T>> key, Consumer<Registrar<T>> callback) {
|
||||
this.provider.forRegistry(key, callback);
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
public final <T> RegistrarBuilder<T> builder(ResourceLocation registryId, T... typeGetter) {
|
||||
if (typeGetter.length != 0) throw new IllegalStateException("array must be empty!");
|
||||
@@ -108,6 +122,8 @@ public final class Registries {
|
||||
@Deprecated
|
||||
<T> Registrar<T> get(Registry<T> registry);
|
||||
|
||||
<T> void forRegistry(ResourceKey<Registry<T>> key, Consumer<Registrar<T>> consumer);
|
||||
|
||||
<T> RegistrarBuilder<T> builder(Class<T> type, ResourceLocation registryId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user