personthecat.catlib.registry.DummyRegistryHandle Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of catlib-quilt Show documentation
Show all versions of catlib-quilt Show documentation
Utilities for serialization, commands, noise generation, IO, and some new data types.
The newest version!
package personthecat.catlib.registry;
import it.unimi.dsi.fastutil.objects.ObjectIterators;
import lombok.extern.log4j.Log4j2;
import net.minecraft.class_2378;
import net.minecraft.class_2960;
import net.minecraft.class_5321;
import net.minecraft.class_6862;
import net.minecraft.class_6880;
import net.minecraft.class_6885;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.*;
import java.util.function.BiConsumer;
import java.util.stream.Stream;
@Log4j2
public class DummyRegistryHandle implements RegistryHandle {
private static final RegistryHandle> INSTANCE = new DummyRegistryHandle<>();
private DummyRegistryHandle() {}
@SuppressWarnings("unchecked")
public static RegistryHandle getInstance() {
return (RegistryHandle) INSTANCE;
}
@Override
public @Nullable class_2960 getKey(final T t) {
return null;
}
@Override
public @Nullable T lookup(final class_2960 id) {
return null;
}
@Override
public V register(final class_2960 id, V v) {
log.error("Attempted to register through dummy handle. This will have no effect.");
return v;
}
@Override
public void forEach(final BiConsumer f) {}
@Override
public boolean isRegistered(final class_2960 id) {
return false;
}
@Override
public @Nullable class_6880 getHolder(final class_2960 id) {
return null;
}
@Override
public Map, class_6885.class_6888> getTags() {
return Collections.emptyMap();
}
@Override
public @Nullable class_5321 extends class_2378> key() {
return null;
}
@Override
public Set keySet() {
return Collections.emptySet();
}
@Override
public Set, T>> entrySet() {
return Collections.emptySet();
}
@Override
public @NotNull Iterator iterator() {
return ObjectIterators.emptyIterator();
}
@Override
public Stream stream() {
return Stream.empty();
}
}