Class CodecHelper

java.lang.Object
team.lodestar.lodestone.helpers.CodecHelper

public class CodecHelper extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T, B> T
    decodeOrThrow(com.mojang.serialization.DynamicOps<B> source, com.mojang.serialization.Codec<T> codec, B value)
     
    static <T, B> B
    encodeOrThrow(com.mojang.serialization.DynamicOps<B> target, com.mojang.serialization.Codec<T> codec, T value)
     
    static <T, B> void
    overwriteExisting(com.mojang.serialization.DynamicOps<B> source, com.mojang.serialization.Codec<T> codec, B value, T target)
    Overwrites the fields of the target object with the fields of the source object.

    Methods inherited from class java.lang.Object

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

    • CodecHelper

      public CodecHelper()
  • Method Details

    • encodeOrThrow

      public static <T, B> B encodeOrThrow(com.mojang.serialization.DynamicOps<B> target, com.mojang.serialization.Codec<T> codec, T value)
    • decodeOrThrow

      public static <T, B> T decodeOrThrow(com.mojang.serialization.DynamicOps<B> source, com.mojang.serialization.Codec<T> codec, B value)
    • overwriteExisting

      public static <T, B> void overwriteExisting(com.mojang.serialization.DynamicOps<B> source, com.mojang.serialization.Codec<T> codec, B value, T target)
      Overwrites the fields of the target object with the fields of the source object. If the target contains fields that the source does not, they will be left unchanged.