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.FriendlyByteBuf,net.minecraft.world.level.ChunkPos>
     
    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<net.minecraft.network.RegistryFriendlyByteBuf,net.minecraft.world.item.Item>
     
    static final com.mojang.serialization.Codec<com.google.gson.JsonElement>
     
    static final com.mojang.serialization.Codec<Float>
     
    static final com.mojang.serialization.Codec<Integer>
     
    static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf,net.minecraft.world.level.block.Rotation>
     
    static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf,net.neoforged.neoforge.common.util.TriState>
     
    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 final <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 final <B, C, T1, T2, T3, T4, T5, T6, T7, T8>
    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, net.minecraft.network.codec.StreamCodec<? super B,T8> codec8, Function<C,T8> getter8, com.mojang.datafixers.util.Function8<T1,T2,T3,T4,T5,T6,T7,T8,C> factory)
     
    static final <B, C, T1, T2, T3, T4, T5, T6, T7, T8, T9>
    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, net.minecraft.network.codec.StreamCodec<? super B,T8> codec8, Function<C,T8> getter8, net.minecraft.network.codec.StreamCodec<? super B,T9> codec9, Function<C,T9> getter9, com.mojang.datafixers.util.Function9<T1,T2,T3,T4,T5,T6,T7,T8,T9,C> factory)
     
    static final <B, C, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>
    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, net.minecraft.network.codec.StreamCodec<? super B,T8> codec8, Function<C,T8> getter8, net.minecraft.network.codec.StreamCodec<? super B,T9> codec9, Function<C,T9> getter9, net.minecraft.network.codec.StreamCodec<? super B,T10> codec10, Function<C,T10> getter10, com.mojang.datafixers.util.Function10<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,C> factory)
     
    static final <B, C, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>
    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, net.minecraft.network.codec.StreamCodec<? super B,T8> codec8, Function<C,T8> getter8, net.minecraft.network.codec.StreamCodec<? super B,T9> codec9, Function<C,T9> getter9, net.minecraft.network.codec.StreamCodec<? super B,T10> codec10, Function<C,T10> getter10, net.minecraft.network.codec.StreamCodec<? super B,T11> codec11, Function<C,T11> getter11, com.mojang.datafixers.util.Function11<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,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

    • POS_INT

      public static final com.mojang.serialization.Codec<Integer> POS_INT
    • POS_FLOAT

      public static final com.mojang.serialization.Codec<Float> POS_FLOAT
    • ITEM_STREAM_CODEC

      public static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,net.minecraft.world.item.Item> ITEM_STREAM_CODEC
    • JSON_ELEMENT_CODEC

      public static final com.mojang.serialization.Codec<com.google.gson.JsonElement> JSON_ELEMENT_CODEC
    • 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
    • CHUNK_POS_STREAM_CODEC

      public static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.FriendlyByteBuf,net.minecraft.world.level.ChunkPos> CHUNK_POS_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
    • TRI_STATE_STREAM_CODEC

      public static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf,net.neoforged.neoforge.common.util.TriState> TRI_STATE_STREAM_CODEC
    • ROTATION_STREAM_CODEC

      public static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf,net.minecraft.world.level.block.Rotation> ROTATION_STREAM_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 final <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)
    • compositeStreamCodec

      public static final <B, C, T1, T2, T3, T4, T5, T6, T7, T8> 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, net.minecraft.network.codec.StreamCodec<? super B,T8> codec8, Function<C,T8> getter8, com.mojang.datafixers.util.Function8<T1,T2,T3,T4,T5,T6,T7,T8,C> factory)
    • compositeStreamCodec

      public static final <B, C, T1, T2, T3, T4, T5, T6, T7, T8, T9> 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, net.minecraft.network.codec.StreamCodec<? super B,T8> codec8, Function<C,T8> getter8, net.minecraft.network.codec.StreamCodec<? super B,T9> codec9, Function<C,T9> getter9, com.mojang.datafixers.util.Function9<T1,T2,T3,T4,T5,T6,T7,T8,T9,C> factory)
    • compositeStreamCodec

      public static final <B, C, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> 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, net.minecraft.network.codec.StreamCodec<? super B,T8> codec8, Function<C,T8> getter8, net.minecraft.network.codec.StreamCodec<? super B,T9> codec9, Function<C,T9> getter9, net.minecraft.network.codec.StreamCodec<? super B,T10> codec10, Function<C,T10> getter10, com.mojang.datafixers.util.Function10<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,C> factory)
    • compositeStreamCodec

      public static final <B, C, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> 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, net.minecraft.network.codec.StreamCodec<? super B,T8> codec8, Function<C,T8> getter8, net.minecraft.network.codec.StreamCodec<? super B,T9> codec9, Function<C,T9> getter9, net.minecraft.network.codec.StreamCodec<? super B,T10> codec10, Function<C,T10> getter10, net.minecraft.network.codec.StreamCodec<? super B,T11> codec11, Function<C,T11> getter11, com.mojang.datafixers.util.Function11<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,C> factory)