Initial 1.16.2 Update

This commit is contained in:
LexManos committed 2020-08-13 00:35:08 -07:00
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;
import javax.annotation.Nullable;
@@ -43,12 +44,12 @@ class NamespacedWrapper<T extends IForgeRegistryEntry<T>> extends SimpleRegistry
public NamespacedWrapper(ForgeRegistry<T> owner)
{
super(RegistryKey.func_240904_a_(owner.getRegistryName()), Lifecycle.experimental());
super(RegistryKey.func_240904_a_(owner.getRegistryName()), Lifecycle.experimental());
this.delegate = owner;
}
@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.");
@@ -65,9 +66,17 @@ class NamespacedWrapper<T extends IForgeRegistryEntry<T>> extends SimpleRegistry
}
@Override
public <R extends T> R register(RegistryKey<T> key, R value)
public <R extends T> R register(RegistryKey<T> key, R 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
@@ -79,7 +88,7 @@ class NamespacedWrapper<T extends IForgeRegistryEntry<T>> extends SimpleRegistry
}
@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
}