Class DatCodec

java.lang.Object
com.datdeveloper.datmoddingapi.util.DatCodec

public class DatCodec extends Object
A utility class containing various useful codecs
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.Codec<net.minecraft.world.level.ChunkPos>
    A Codec for handling ChunkPos
    This converts the chunkpos into an intstream, similar to BlockPos
    static final com.mojang.serialization.Codec<UUID>
    A Codec for handling UUID
    Converts it into a string for storage
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <E extends Enum<E>>
    com.mojang.serialization.Codec<E>
    getEnumCodec(Class<E> enumClass)
    A helper function to create a Codec that handles the given enum class
    The resulting codec will convert the enum into a string for storage

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • UUID_CODEC

      public static final com.mojang.serialization.Codec<UUID> UUID_CODEC
      A Codec for handling UUID
      Converts it into a string for storage
    • CHUNKPOS

      public static final com.mojang.serialization.Codec<net.minecraft.world.level.ChunkPos> CHUNKPOS
      A Codec for handling ChunkPos
      This converts the chunkpos into an intstream, similar to BlockPos
      See Also:
      • BlockPos
  • Constructor Details

    • DatCodec

      public DatCodec()
  • Method Details

    • getEnumCodec

      public static <E extends Enum<E>> com.mojang.serialization.Codec<E> getEnumCodec(Class<E> enumClass)
      A helper function to create a Codec that handles the given enum class
      The resulting codec will convert the enum into a string for storage
      Type Parameters:
      E - The Enum Type
      Parameters:
      enumClass - The class of the enum
      Returns:
      A Codec that handles the given enum class