mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-16 18:45:09 +00:00
Initial 1.16.2 Update
This commit is contained in:
1 parent
a3c4ffd2c1
commit
fe43088c96
233 files changed
+1644
-2297
No files matched your search
@@ -22,6 +22,7 @@ package net.minecraftforge.registries;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.Optional;
|
||||
import java.util.OptionalInt;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -50,7 +51,7 @@ class NamespacedDefaultedWrapper<T extends IForgeRegistryEntry<T>> extends Defau
|
||||
}
|
||||
|
||||
@Override
|
||||
public <V extends T> V register(int id, RegistryKey<T> key, V value)
|
||||
public <V extends T> V register(int id, RegistryKey<T> key, V value, Lifecycle lifecycle)
|
||||
{
|
||||
if (locked)
|
||||
throw new IllegalStateException("Can not register to a locked registry. Modder should use Forge Register methods.");
|
||||
@@ -67,14 +68,22 @@ class NamespacedDefaultedWrapper<T extends IForgeRegistryEntry<T>> extends Defau
|
||||
}
|
||||
|
||||
@Override
|
||||
public <V extends T> V register(RegistryKey<T> key, V value)
|
||||
public <V extends T> V register(RegistryKey<T> key, V value, Lifecycle lifecycle)
|
||||
{
|
||||
return register(-1, key, value);
|
||||
return register(-1, key, value, lifecycle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <V extends T> V func_241874_a(OptionalInt id, RegistryKey<T> key, V value, Lifecycle lifecycle) {
|
||||
int wanted = -1;
|
||||
if (id.isPresent() && getByValue(id.getAsInt()) != null)
|
||||
wanted = id.getAsInt();
|
||||
return register(wanted, key, value, lifecycle);
|
||||
}
|
||||
|
||||
// Reading Functions
|
||||
@Override
|
||||
public Optional<T> getValue(@Nullable ResourceLocation name)
|
||||
public Optional<T> func_241873_b(@Nullable ResourceLocation name)
|
||||
{
|
||||
return Optional.ofNullable( this.delegate.getRaw(name)); //get without default
|
||||
}
|
||||
@@ -112,12 +121,6 @@ class NamespacedDefaultedWrapper<T extends IForgeRegistryEntry<T>> extends Defau
|
||||
return this.delegate.getValue(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_230518_b_(int id)
|
||||
{
|
||||
return this.getByValue(id) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<T> iterator()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user