Class CustomRegistry<B extends io.netty.buffer.ByteBuf, V>

java.lang.Object
dev.latvian.mods.klib.registry.CustomRegistry<B,V>
All Implemented Interfaces:
Iterable<Ref<V>>

public class CustomRegistry<B extends io.netty.buffer.ByteBuf, V> extends Object implements Iterable<Ref<V>>
  • Field Details

    • ALL

      public static final Map<net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>>, CustomRegistry<?,?>> ALL
    • DATA_TYPE_TO_REGISTRY

      public static final Map<DataType<?>, CustomRegistry<?,?>> DATA_TYPE_TO_REGISTRY
    • typeCodec

      public final com.mojang.serialization.Codec<CustomRegistryType<B extends io.netty.buffer.ByteBuf, V>> typeCodec
  • Method Details

    • registerAll

      public static void registerAll(Consumer<CustomRegistryCollector> callback)
    • buildAllMeta

      public static void buildAllMeta()
    • sync

      public static void sync(net.minecraft.server.level.ServerPlayer player)
    • builder

      public static <B extends io.netty.buffer.ByteBuf, T> CustomRegistry.Builder<B,T> builder()
    • unitWithType

      public CustomRegistryType.Unit<B,V> unitWithType(net.minecraft.resources.Identifier id, Function<CustomRegistryType<B,V>, V> instance)
    • unit

      public CustomRegistryType.Unit<B,V> unit(net.minecraft.resources.Identifier id, V instance)
    • dynamic

      public <D extends V> CustomRegistryType.Dynamic<B,V> dynamic(net.minecraft.resources.Identifier id, com.mojang.serialization.MapCodec<D> codec, net.minecraft.network.codec.StreamCodec<? super B, D> streamCodec)
    • ref

      public Ref<V> ref(net.minecraft.resources.Identifier id)
    • ref

      public Ref<V> ref(net.minecraft.resources.ResourceKey<V> key)
    • ref

      public Ref<V> ref(V value)
    • registerTypes

      public void registerTypes(Consumer<CustomRegistryTypeCollector<B,V>> callback)
    • writeMeta

      public CustomRegistryMetaInfo<V> writeMeta()
    • readMeta

      public void readMeta(@Nullable @Nullable CustomRegistryMetaInfo<V> info)
    • updateValues

      public void updateValues(Map<net.minecraft.resources.Identifier, V> map)
    • writeValues

      public CustomRegistryValueInfo<V> writeValues(net.minecraft.core.RegistryAccess registryAccess, PlatformType platformType)
    • readValues

      public void readValues(CustomRegistryValueInfo<V> info, net.minecraft.core.RegistryAccess registryAccess, PlatformType platformType)
    • syncValues

      public boolean syncValues()
    • registryKeys

      public RegistryKeys<V> registryKeys()
    • getOptionalType

      @Nullable public @Nullable CustomRegistryType<B,V> getOptionalType(Ref<V> ref)
    • getOptionalType

      @Nullable public @Nullable CustomRegistryType<B,V> getOptionalType(V value)
    • getType

      @Nullable public @Nullable CustomRegistryType<B,V> getType(net.minecraft.resources.ResourceKey<V> key)
    • getType

      public CustomRegistryType<B,V> getType(Ref<V> value)
    • getType

      public CustomRegistryType<B,V> getType(V value)
    • getKey

      @Nullable public @Nullable net.minecraft.resources.ResourceKey<V> getKey(V value)
    • directCodec

      public com.mojang.serialization.Codec<V> directCodec()
    • codec

      public com.mojang.serialization.Codec<Ref<V>> codec()
    • streamCodec

      public net.minecraft.network.codec.StreamCodec<B,Ref<V>> streamCodec()
    • dataType

      public DataType<Ref<V>> dataType()
    • typeList

      public List<CustomRegistryType<B,V>> typeList()
    • get

      @Nullable public @Nullable Ref<V> get(net.minecraft.resources.ResourceKey<V> key)
    • get

      @Nullable public @Nullable Ref<V> get(net.minecraft.resources.Identifier id)
    • values

      public List<Ref<V>> values()
    • iterator

      public @NonNull Iterator<Ref<V>> iterator()
      Specified by:
      iterator in interface Iterable<B extends io.netty.buffer.ByteBuf>
    • decodeValue

      @Nullable public @Nullable Ref<V> decodeValue(B buf)
    • getValueIndex

      public int getValueIndex(net.minecraft.resources.ResourceKey<V> key)
    • encodeValue

      public void encodeValue(B buf, @Nullable @Nullable Ref<V> ref)
    • decodeType

      @Nullable public @Nullable CustomRegistryType<B,V> decodeType(B buf)
    • encodeType

      public void encodeType(io.netty.buffer.ByteBuf buf, @Nullable @Nullable CustomRegistryType<B,V> value)
    • createArgument

      @Internal public com.mojang.brigadier.arguments.ArgumentType<Ref<V>> createArgument(net.minecraft.commands.CommandBuildContext ctx)