|
@@ -37,6 +37,7 @@ import net.minecraftforge.event.RegistryEvent;
|
|
import net.minecraftforge.eventbus.api.IEventBus;
|
|
import net.minecraftforge.eventbus.api.IEventBus;
|
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
|
import net.minecraftforge.fml.RegistryObject;
|
|
import net.minecraftforge.fml.RegistryObject;
|
|
|
|
+import net.minecraftforge.registries.ForgeRegistry;
|
|
import net.minecraftforge.registries.IForgeRegistry;
|
|
import net.minecraftforge.registries.IForgeRegistry;
|
|
import net.minecraftforge.registries.IForgeRegistryEntry;
|
|
import net.minecraftforge.registries.IForgeRegistryEntry;
|
|
import net.minecraftforge.registries.RegistryManager;
|
|
import net.minecraftforge.registries.RegistryManager;
|
|
@@ -82,7 +83,7 @@ public class RegistriesImpl {
|
|
public <T> Registry<T> get(ResourceKey<net.minecraft.core.Registry<T>> registryKey) {
|
|
public <T> Registry<T> get(ResourceKey<net.minecraft.core.Registry<T>> registryKey) {
|
|
return get(RegistryManager.ACTIVE.getRegistry(registryKey.location()));
|
|
return get(RegistryManager.ACTIVE.getRegistry(registryKey.location()));
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public <T> Registry<T> get(IForgeRegistry registry) {
|
|
public <T> Registry<T> get(IForgeRegistry registry) {
|
|
return new ForgeBackedRegistryImpl<>(this.registry, registry);
|
|
return new ForgeBackedRegistryImpl<>(this.registry, registry);
|
|
}
|
|
}
|
|
@@ -162,7 +163,7 @@ public class RegistriesImpl {
|
|
public @NotNull ResourceLocation getRegistryId() {
|
|
public @NotNull ResourceLocation getRegistryId() {
|
|
return delegate.key().location();
|
|
return delegate.key().location();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public @NotNull ResourceLocation getId() {
|
|
public @NotNull ResourceLocation getId() {
|
|
return id;
|
|
return id;
|
|
@@ -210,6 +211,11 @@ public class RegistriesImpl {
|
|
return delegate.getKey(obj);
|
|
return delegate.getKey(obj);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public int getRawId(T obj) {
|
|
|
|
+ return delegate.getId(obj);
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public Optional<ResourceKey<T>> getKey(T t) {
|
|
public Optional<ResourceKey<T>> getKey(T t) {
|
|
return delegate.getResourceKey(t);
|
|
return delegate.getResourceKey(t);
|
|
@@ -221,6 +227,11 @@ public class RegistriesImpl {
|
|
return delegate.get(id);
|
|
return delegate.get(id);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public T byRawId(int rawId) {
|
|
|
|
+ return delegate.byId(rawId);
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public boolean contains(ResourceLocation resourceLocation) {
|
|
public boolean contains(ResourceLocation resourceLocation) {
|
|
return delegate.containsKey(resourceLocation);
|
|
return delegate.containsKey(resourceLocation);
|
|
@@ -356,6 +367,11 @@ public class RegistriesImpl {
|
|
return delegate.getKey(obj);
|
|
return delegate.getKey(obj);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public int getRawId(T obj) {
|
|
|
|
+ return ((ForgeRegistry<T>) delegate).getID(obj);
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public Optional<ResourceKey<T>> getKey(T t) {
|
|
public Optional<ResourceKey<T>> getKey(T t) {
|
|
return Optional.ofNullable(getId(t)).map(id -> ResourceKey.create(key(), id));
|
|
return Optional.ofNullable(getId(t)).map(id -> ResourceKey.create(key(), id));
|
|
@@ -367,6 +383,11 @@ public class RegistriesImpl {
|
|
return delegate.getValue(id);
|
|
return delegate.getValue(id);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public T byRawId(int rawId) {
|
|
|
|
+ return ((ForgeRegistry<T>) delegate).getValue(rawId);
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public boolean contains(ResourceLocation resourceLocation) {
|
|
public boolean contains(ResourceLocation resourceLocation) {
|
|
return delegate.containsKey(resourceLocation);
|
|
return delegate.containsKey(resourceLocation);
|