All Downloads are FREE. Search and download functionalities are using the official Maven repository.

personthecat.catlib.registry.DummyRegistryHandle Maven / Gradle / Ivy

Go to download

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> 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();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy