Class MoreStreamCodecs

java.lang.Object
org.moddingx.libx.codec.MoreStreamCodecs

public class MoreStreamCodecs extends Object
Provides additional stream codecs.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final net.minecraft.network.codec.StreamCodec<ByteBuf,net.minecraft.nbt.CompoundTag>
    A stream streamCodec for NBT compound tags.
    static final net.minecraft.network.codec.StreamCodec<ByteBuf,net.minecraft.nbt.Tag>
    A stream streamCodec for NBT tags.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <B extends ByteBuf, T>
    net.minecraft.network.codec.StreamCodec<B,List<T>>
    listOf(net.minecraft.network.codec.StreamCodec<? super B,T> elementCodec)
     
    static <B extends ByteBuf, K, V>
    net.minecraft.network.codec.StreamCodec<B,Map<K,V>>
    mapOf(net.minecraft.network.codec.StreamCodec<? super B,K> keyCodec, net.minecraft.network.codec.StreamCodec<? super B,V> valueCodec)
     
    static <B extends ByteBuf, T>
    net.minecraft.network.codec.StreamCodec<B,Optional<T>>
    maybe(net.minecraft.network.codec.StreamCodec<? super B,T> elementCodec)
     
    static <B extends ByteBuf, T>
    net.minecraft.network.codec.StreamCodec<B,T>
    unit(Supplier<T> value)
    Creates a unit StreamCodec.

    Methods inherited from class java.lang.Object

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

    • TAG

      public static final net.minecraft.network.codec.StreamCodec<ByteBuf,net.minecraft.nbt.Tag> TAG
      A stream streamCodec for NBT tags.
    • COMPOUND_TAG

      public static final net.minecraft.network.codec.StreamCodec<ByteBuf,net.minecraft.nbt.CompoundTag> COMPOUND_TAG
      A stream streamCodec for NBT compound tags.
  • Constructor Details

    • MoreStreamCodecs

      public MoreStreamCodecs()
  • Method Details

    • unit

      public static <B extends ByteBuf, T> net.minecraft.network.codec.StreamCodec<B,T> unit(Supplier<T> value)
      Creates a unit StreamCodec. The returned codec will never write any bytes and always use the provided Supplier to produce a result value. It ignores its input while encoding.
    • maybe

      public static <B extends ByteBuf, T> net.minecraft.network.codec.StreamCodec<B,Optional<T>> maybe(net.minecraft.network.codec.StreamCodec<? super B,T> elementCodec)
    • listOf

      public static <B extends ByteBuf, T> net.minecraft.network.codec.StreamCodec<B,List<T>> listOf(net.minecraft.network.codec.StreamCodec<? super B,T> elementCodec)
    • mapOf

      public static <B extends ByteBuf, K, V> net.minecraft.network.codec.StreamCodec<B,Map<K,V>> mapOf(net.minecraft.network.codec.StreamCodec<? super B,K> keyCodec, net.minecraft.network.codec.StreamCodec<? super B,V> valueCodec)