Class CodecHelper

java.lang.Object
com.petrolpark.util.CodecHelper

public class CodecHelper extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,net.minecraft.advancements.critereon.EnchantmentPredicate>
     
    static final com.mojang.serialization.Codec<net.minecraft.world.entity.animal.horse.Markings>
     
    static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf,net.minecraft.advancements.critereon.MinMaxBounds.Ints>
     
    static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf,net.minecraft.world.level.block.state.properties.WoodType>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static final com.mojang.serialization.Codec<Byte>
    byteRanged(byte minInclusive, byte maxInclusive)
     
    static <B, C, T1, T2, T3, T4, T5, T6, T7>
    net.minecraft.network.codec.StreamCodec<B,C>
    compositeStreamCodec(net.minecraft.network.codec.StreamCodec<? super B,T1> codec1, Function<C,T1> getter1, net.minecraft.network.codec.StreamCodec<? super B,T2> codec2, Function<C,T2> getter2, net.minecraft.network.codec.StreamCodec<? super B,T3> codec3, Function<C,T3> getter3, net.minecraft.network.codec.StreamCodec<? super B,T4> codec4, Function<C,T4> getter4, net.minecraft.network.codec.StreamCodec<? super B,T5> codec5, Function<C,T5> getter5, net.minecraft.network.codec.StreamCodec<? super B,T6> codec6, Function<C,T6> getter6, net.minecraft.network.codec.StreamCodec<? super B,T7> codec7, Function<C,T7> getter7, com.mojang.datafixers.util.Function7<T1,T2,T3,T4,T5,T6,T7,C> factory)
     
    static <T extends io.netty.buffer.ByteBuf, S extends Enum<S>>
    net.minecraft.network.codec.StreamCodec<T,S>
    enumStream(Class<S> clazz)
     
    static <OBJECT> com.mojang.serialization.Codec<List<OBJECT>>
    listOrSingle(com.mojang.serialization.Codec<OBJECT> codec)
     
    static <B extends io.netty.buffer.ByteBuf, V>
    net.minecraft.network.codec.StreamCodec<B,List<V>>
    listStream(net.minecraft.network.codec.StreamCodec<B,V> base)
     
    static <OBJECT, FIELD>
    com.mojang.serialization.Codec<OBJECT>
    singleField(com.mojang.serialization.Codec<FIELD> fieldCodec, String fieldName, Function<OBJECT,FIELD> getter, Function<FIELD,OBJECT> constructor)
     
    static <OBJECT, FIELD>
    com.mojang.serialization.MapCodec<OBJECT>
    singleFieldMap(com.mojang.serialization.Codec<FIELD> fieldCodec, String fieldName, Function<OBJECT,FIELD> getter, Function<FIELD,OBJECT> constructor)
     

    Methods inherited from class java.lang.Object

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

    • INT_BOUNDS_STREAM_CODEC

      public static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf,net.minecraft.advancements.critereon.MinMaxBounds.Ints> INT_BOUNDS_STREAM_CODEC
    • ENCHANTMENT_PREDICATE_STREAM_CODEC

      public static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,net.minecraft.advancements.critereon.EnchantmentPredicate> ENCHANTMENT_PREDICATE_STREAM_CODEC
    • WOOD_TYPE_STREAM_CODEC

      public static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf,net.minecraft.world.level.block.state.properties.WoodType> WOOD_TYPE_STREAM_CODEC
    • HORSE_MARKINGS_CODEC

      public static final com.mojang.serialization.Codec<net.minecraft.world.entity.animal.horse.Markings> HORSE_MARKINGS_CODEC
  • Constructor Details

    • CodecHelper

      public CodecHelper()
  • Method Details

    • singleField

      public static <OBJECT, FIELD> com.mojang.serialization.Codec<OBJECT> singleField(com.mojang.serialization.Codec<FIELD> fieldCodec, String fieldName, Function<OBJECT,FIELD> getter, Function<FIELD,OBJECT> constructor)
    • singleFieldMap

      public static <OBJECT, FIELD> com.mojang.serialization.MapCodec<OBJECT> singleFieldMap(com.mojang.serialization.Codec<FIELD> fieldCodec, String fieldName, Function<OBJECT,FIELD> getter, Function<FIELD,OBJECT> constructor)
    • listOrSingle

      public static <OBJECT> com.mojang.serialization.Codec<List<OBJECT>> listOrSingle(com.mojang.serialization.Codec<OBJECT> codec)
    • enumStream

      public static <T extends io.netty.buffer.ByteBuf, S extends Enum<S>> net.minecraft.network.codec.StreamCodec<T,S> enumStream(Class<S> clazz)
    • listStream

      public static <B extends io.netty.buffer.ByteBuf, V> net.minecraft.network.codec.StreamCodec<B,List<V>> listStream(net.minecraft.network.codec.StreamCodec<B,V> base)
    • byteRanged

      public static final com.mojang.serialization.Codec<Byte> byteRanged(byte minInclusive, byte maxInclusive)
    • compositeStreamCodec

      public static <B, C, T1, T2, T3, T4, T5, T6, T7> net.minecraft.network.codec.StreamCodec<B,C> compositeStreamCodec(net.minecraft.network.codec.StreamCodec<? super B,T1> codec1, Function<C,T1> getter1, net.minecraft.network.codec.StreamCodec<? super B,T2> codec2, Function<C,T2> getter2, net.minecraft.network.codec.StreamCodec<? super B,T3> codec3, Function<C,T3> getter3, net.minecraft.network.codec.StreamCodec<? super B,T4> codec4, Function<C,T4> getter4, net.minecraft.network.codec.StreamCodec<? super B,T5> codec5, Function<C,T5> getter5, net.minecraft.network.codec.StreamCodec<? super B,T6> codec6, Function<C,T6> getter6, net.minecraft.network.codec.StreamCodec<? super B,T7> codec7, Function<C,T7> getter7, com.mojang.datafixers.util.Function7<T1,T2,T3,T4,T5,T6,T7,C> factory)