mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-17 02:55:17 +00:00
Setup and import of 1.16 YEET
This commit is contained in:
931 files changed
+18847
-9127
No files matched your search
@@ -29,11 +29,14 @@ import javax.annotation.Nullable;
|
||||
|
||||
import org.apache.commons.lang3.Validate;
|
||||
|
||||
import net.minecraft.util.RegistryKey;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.registry.DefaultedRegistry;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import com.mojang.serialization.Lifecycle;
|
||||
|
||||
class NamespacedDefaultedWrapper<T extends IForgeRegistryEntry<T>> extends DefaultedRegistry<T> implements ILockableRegistry
|
||||
{
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -42,19 +45,19 @@ class NamespacedDefaultedWrapper<T extends IForgeRegistryEntry<T>> extends Defau
|
||||
|
||||
private NamespacedDefaultedWrapper(ForgeRegistry<T> owner)
|
||||
{
|
||||
super(owner.getRegistryName().toString());
|
||||
super("empty", RegistryKey.<T>func_240904_a_(owner.getRegistryName()), Lifecycle.experimental());
|
||||
this.delegate = owner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <V extends T> V register(int id, ResourceLocation key, V value)
|
||||
public <V extends T> V register(int id, RegistryKey<T> key, V value)
|
||||
{
|
||||
if (locked)
|
||||
throw new IllegalStateException("Can not register to a locked registry. Modder should use Forge Register methods.");
|
||||
Validate.notNull(value);
|
||||
|
||||
if (value.getRegistryName() == null)
|
||||
value.setRegistryName(key);
|
||||
value.setRegistryName(key.func_240901_a_());
|
||||
|
||||
int realId = this.delegate.add(id, value);
|
||||
if (realId != id && id != -1)
|
||||
@@ -64,7 +67,7 @@ class NamespacedDefaultedWrapper<T extends IForgeRegistryEntry<T>> extends Defau
|
||||
}
|
||||
|
||||
@Override
|
||||
public <V extends T> V register(ResourceLocation key, V value)
|
||||
public <V extends T> V register(RegistryKey<T> key, V value)
|
||||
{
|
||||
return register(-1, key, value);
|
||||
}
|
||||
@@ -109,6 +112,12 @@ 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()
|
||||
{
|
||||
@@ -135,12 +144,6 @@ class NamespacedDefaultedWrapper<T extends IForgeRegistryEntry<T>> extends Defau
|
||||
return this.delegate.getDefaultKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty()
|
||||
{
|
||||
return this.delegate.isEmpty();
|
||||
}
|
||||
|
||||
//internal
|
||||
@Override
|
||||
public void lock(){ this.locked = true; }
|
||||
|
||||
Reference in new issue
Block a user