mirror of
https://github.com/architectury/architectury-api.git
synced 2026-03-28 03:56:59 -05:00
Add getModId to Registries
This commit is contained in:
@@ -34,6 +34,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
public final class Registries {
|
||||
private static final Map<String, Registries> REGISTRIES = new ConcurrentHashMap<>();
|
||||
private final RegistryProvider provider;
|
||||
private final String modId;
|
||||
|
||||
public static Registries get(String modId) {
|
||||
return REGISTRIES.computeIfAbsent(modId, Registries::new);
|
||||
@@ -41,6 +42,7 @@ public final class Registries {
|
||||
|
||||
private Registries(String modId) {
|
||||
this.provider = _get(modId);
|
||||
this.modId = modId;
|
||||
}
|
||||
|
||||
public <T> Registry<T> get(ResourceKey<net.minecraft.core.Registry<T>> key) {
|
||||
@@ -88,6 +90,10 @@ public final class Registries {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
public String getModId() {
|
||||
return modId;
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
public interface RegistryProvider {
|
||||
<T> Registry<T> get(ResourceKey<net.minecraft.core.Registry<T>> key);
|
||||
|
||||
Reference in New Issue
Block a user