Package net.commoble.exmachina.internal.util

# Class CodecHelper

java.lang.Object
net.commoble.exmachina.internal.util.CodecHelper

public final class CodecHelper extends Object
codec utils

## Method Summary

Modifier and Type
Method
Description
`static <T> com.mojang.serialization.Codec<T>`
`dispatch(net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<com.mojang.serialization.MapCodec<? extends T>>> registryKey, Function<? super T,? extends com.mojang.serialization.MapCodec<? extends T>> typeCodec)`
Helper to make a dispatch codec for a custom forge registry of codecs.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Method Details

### dispatch

public static <T> com.mojang.serialization.Codec<T> dispatch(net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<com.mojang.serialization.MapCodec<? extends T>>> registryKey, Function<? super T,? extends com.mojang.serialization.MapCodec<? extends T>> typeCodec)
Helper to make a dispatch codec for a custom forge registry of codecs.

Type Parameters:
  `T` - Type of the element to be loaded from json
Parameters:
  `registryKey` - ResourceKey for a Registry of sub-codecs.
  `typeCodec` - Function to retrieve the codec for a given json-loaded element
Returns:
  dispatch codec to load instances of T