Interface PacketCodecs


public interface PacketCodecs
A set of pre-defined packet codecs.
See Also:
Mappings:
Namespace Name
official yc
intermediary net/minecraft/class_9135
named net/minecraft/network/codec/PacketCodecs
  • Field Details

    • field_49674

      static final int field_49674
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Lyc;a:I
      intermediary field_49674 Lnet/minecraft/class_9135;field_49674:I
      named field_49674 Lnet/minecraft/network/codec/PacketCodecs;field_49674:I
    • BOOL

      static final PacketCodec<ByteBuf,Boolean> BOOL
      A codec for a boolean value.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official b Lyc;b:Lye;
      intermediary field_48547 Lnet/minecraft/class_9135;field_48547:Lnet/minecraft/class_9139;
      named BOOL Lnet/minecraft/network/codec/PacketCodecs;BOOL:Lnet/minecraft/network/codec/PacketCodec;
    • BYTE

      static final PacketCodec<ByteBuf,Byte> BYTE
      A codec for a byte value.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official c Lyc;c:Lye;
      intermediary field_48548 Lnet/minecraft/class_9135;field_48548:Lnet/minecraft/class_9139;
      named BYTE Lnet/minecraft/network/codec/PacketCodecs;BYTE:Lnet/minecraft/network/codec/PacketCodec;
    • SHORT

      static final PacketCodec<ByteBuf,Short> SHORT
      A codec for a short value.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official d Lyc;d:Lye;
      intermediary field_48549 Lnet/minecraft/class_9135;field_48549:Lnet/minecraft/class_9139;
      named SHORT Lnet/minecraft/network/codec/PacketCodecs;SHORT:Lnet/minecraft/network/codec/PacketCodec;
    • field_49675

      static final PacketCodec<ByteBuf,Integer> field_49675
      Mappings:
      Namespace Name Mixin selector
      official e Lyc;e:Lye;
      intermediary field_49675 Lnet/minecraft/class_9135;field_49675:Lnet/minecraft/class_9139;
      named field_49675 Lnet/minecraft/network/codec/PacketCodecs;field_49675:Lnet/minecraft/network/codec/PacketCodec;
    • VAR_INT

      static final PacketCodec<ByteBuf,Integer> VAR_INT
      A codec for a variable-length integer (var int) value.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official f Lyc;f:Lye;
      intermediary field_48550 Lnet/minecraft/class_9135;field_48550:Lnet/minecraft/class_9139;
      named VAR_INT Lnet/minecraft/network/codec/PacketCodecs;VAR_INT:Lnet/minecraft/network/codec/PacketCodec;
    • VAR_LONG

      static final PacketCodec<ByteBuf,Long> VAR_LONG
      A codec for a variable-length long (var long) value.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official g Lyc;g:Lye;
      intermediary field_48551 Lnet/minecraft/class_9135;field_48551:Lnet/minecraft/class_9139;
      named VAR_LONG Lnet/minecraft/network/codec/PacketCodecs;VAR_LONG:Lnet/minecraft/network/codec/PacketCodec;
    • FLOAT

      static final PacketCodec<ByteBuf,Float> FLOAT
      A codec for a float value.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official h Lyc;h:Lye;
      intermediary field_48552 Lnet/minecraft/class_9135;field_48552:Lnet/minecraft/class_9139;
      named FLOAT Lnet/minecraft/network/codec/PacketCodecs;FLOAT:Lnet/minecraft/network/codec/PacketCodec;
    • DOUBLE

      static final PacketCodec<ByteBuf,Double> DOUBLE
      A codec for a double value.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official i Lyc;i:Lye;
      intermediary field_48553 Lnet/minecraft/class_9135;field_48553:Lnet/minecraft/class_9139;
      named DOUBLE Lnet/minecraft/network/codec/PacketCodecs;DOUBLE:Lnet/minecraft/network/codec/PacketCodec;
    • BYTE_ARRAY

      static final PacketCodec<ByteBuf,byte[]> BYTE_ARRAY
      A codec for a byte array.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official j Lyc;j:Lye;
      intermediary field_48987 Lnet/minecraft/class_9135;field_48987:Lnet/minecraft/class_9139;
      named BYTE_ARRAY Lnet/minecraft/network/codec/PacketCodecs;BYTE_ARRAY:Lnet/minecraft/network/codec/PacketCodec;
    • STRING

      static final PacketCodec<ByteBuf,String> STRING
      A codec for a string value with maximum length 32767.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official k Lyc;k:Lye;
      intermediary field_48554 Lnet/minecraft/class_9135;field_48554:Lnet/minecraft/class_9139;
      named STRING Lnet/minecraft/network/codec/PacketCodecs;STRING:Lnet/minecraft/network/codec/PacketCodec;
    • NBT_ELEMENT

      static final PacketCodec<ByteBuf,NbtElement> NBT_ELEMENT
      A codec for an NBT element of unlimited size.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official l Lyc;l:Lye;
      intermediary field_48555 Lnet/minecraft/class_9135;field_48555:Lnet/minecraft/class_9139;
      named NBT_ELEMENT Lnet/minecraft/network/codec/PacketCodecs;NBT_ELEMENT:Lnet/minecraft/network/codec/PacketCodec;
    • field_49676

      static final PacketCodec<ByteBuf,NbtElement> field_49676
      Mappings:
      Namespace Name Mixin selector
      official m Lyc;m:Lye;
      intermediary field_49676 Lnet/minecraft/class_9135;field_49676:Lnet/minecraft/class_9139;
      named field_49676 Lnet/minecraft/network/codec/PacketCodecs;field_49676:Lnet/minecraft/network/codec/PacketCodec;
    • NBT_COMPOUND

      static final PacketCodec<ByteBuf,NbtCompound> NBT_COMPOUND
      A codec for an NBT compound of unlimited size.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official n Lyc;n:Lye;
      intermediary field_48556 Lnet/minecraft/class_9135;field_48556:Lnet/minecraft/class_9139;
      named NBT_COMPOUND Lnet/minecraft/network/codec/PacketCodecs;NBT_COMPOUND:Lnet/minecraft/network/codec/PacketCodec;
    • field_49677

      static final PacketCodec<ByteBuf,NbtCompound> field_49677
      Mappings:
      Namespace Name Mixin selector
      official o Lyc;o:Lye;
      intermediary field_49677 Lnet/minecraft/class_9135;field_49677:Lnet/minecraft/class_9139;
      named field_49677 Lnet/minecraft/network/codec/PacketCodecs;field_49677:Lnet/minecraft/network/codec/PacketCodec;
    • OPTIONAL_NBT

      static final PacketCodec<ByteBuf,Optional<NbtCompound>> OPTIONAL_NBT
      A codec for an optional NBT compound of up to 2097152 bytes.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official p Lyc;p:Lye;
      intermediary field_48557 Lnet/minecraft/class_9135;field_48557:Lnet/minecraft/class_9139;
      named OPTIONAL_NBT Lnet/minecraft/network/codec/PacketCodecs;OPTIONAL_NBT:Lnet/minecraft/network/codec/PacketCodec;
    • VECTOR3F

      static final PacketCodec<ByteBuf,Vector3f> VECTOR3F
      A codec for a Vector3f.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official q Lyc;q:Lye;
      intermediary field_48558 Lnet/minecraft/class_9135;field_48558:Lnet/minecraft/class_9139;
      named VECTOR3F Lnet/minecraft/network/codec/PacketCodecs;VECTOR3F:Lnet/minecraft/network/codec/PacketCodec;
    • QUATERNIONF

      static final PacketCodec<ByteBuf,Quaternionf> QUATERNIONF
      A codec for a Quaternionf.
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official r Lyc;r:Lye;
      intermediary field_48559 Lnet/minecraft/class_9135;field_48559:Lnet/minecraft/class_9139;
      named QUATERNIONF Lnet/minecraft/network/codec/PacketCodecs;QUATERNIONF:Lnet/minecraft/network/codec/PacketCodec;
    • field_49678

      static final PacketCodec<ByteBuf,com.mojang.authlib.properties.PropertyMap> field_49678
      Mappings:
      Namespace Name Mixin selector
      official s Lyc;s:Lye;
      intermediary field_49678 Lnet/minecraft/class_9135;field_49678:Lnet/minecraft/class_9139;
      named field_49678 Lnet/minecraft/network/codec/PacketCodecs;field_49678:Lnet/minecraft/network/codec/PacketCodec;
    • field_49679

      static final PacketCodec<ByteBuf,com.mojang.authlib.GameProfile> field_49679
      Mappings:
      Namespace Name Mixin selector
      official t Lyc;t:Lye;
      intermediary field_49679 Lnet/minecraft/class_9135;field_49679:Lnet/minecraft/class_9139;
      named field_49679 Lnet/minecraft/network/codec/PacketCodecs;field_49679:Lnet/minecraft/network/codec/PacketCodec;
  • Method Details

    • byteArray

      static PacketCodec<ByteBuf,byte[]> byteArray(int maxLength)
      Returns a codec for a byte array with maximum length maxLength.
      Returns:
      a codec for a byte array with maximum length maxLength
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Lyc;a(I)Lye;
      intermediary method_56895 Lnet/minecraft/class_9135;method_56895(I)Lnet/minecraft/class_9139;
      named byteArray Lnet/minecraft/network/codec/PacketCodecs;byteArray(I)Lnet/minecraft/network/codec/PacketCodec;
    • string

      static PacketCodec<ByteBuf,String> string(int maxLength)
      Returns a codec for a string value with maximum length maxLength.
      Returns:
      a codec for a string value with maximum length maxLength
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official b Lyc;b(I)Lye;
      intermediary method_56364 Lnet/minecraft/class_9135;method_56364(I)Lnet/minecraft/class_9139;
      named string Lnet/minecraft/network/codec/PacketCodecs;string(I)Lnet/minecraft/network/codec/PacketCodec;
    • nbt

      Returns a codec for an NBT element.
      Returns:
      a codec for an NBT element
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Lyc;a(Ljava/util/function/Supplier;)Lye;
      intermediary method_56378 Lnet/minecraft/class_9135;method_56378(Ljava/util/function/Supplier;)Lnet/minecraft/class_9139;
      named nbt Lnet/minecraft/network/codec/PacketCodecs;nbt(Ljava/util/function/Supplier;)Lnet/minecraft/network/codec/PacketCodec;
    • method_57998

      static PacketCodec<ByteBuf,NbtCompound> method_57998(Supplier<NbtSizeTracker> supplier)
      Mappings:
      Namespace Name Mixin selector
      official b Lyc;b(Ljava/util/function/Supplier;)Lye;
      intermediary method_57998 Lnet/minecraft/class_9135;method_57998(Ljava/util/function/Supplier;)Lnet/minecraft/class_9139;
      named method_57998 Lnet/minecraft/network/codec/PacketCodecs;method_57998(Ljava/util/function/Supplier;)Lnet/minecraft/network/codec/PacketCodec;
    • method_57987

      static <T> PacketCodec<ByteBuf,T> method_57987(com.mojang.serialization.Codec<T> codec)
      Mappings:
      Namespace Name Mixin selector
      official a Lyc;a(Lcom/mojang/serialization/Codec;)Lye;
      intermediary method_57987 Lnet/minecraft/class_9135;method_57987(Lcom/mojang/serialization/Codec;)Lnet/minecraft/class_9139;
      named method_57987 Lnet/minecraft/network/codec/PacketCodecs;method_57987(Lcom/mojang/serialization/Codec;)Lnet/minecraft/network/codec/PacketCodec;
    • codec

      static <T> PacketCodec<ByteBuf,T> codec(com.mojang.serialization.Codec<T> codec)
      Returns a codec from DataFixerUpper codec codec.

      Internally, the data is serialized as an NBT element of unlimited size.

      Returns:
      a codec from DataFixerUpper codec codec
      Mappings:
      Namespace Name Mixin selector
      official b Lyc;b(Lcom/mojang/serialization/Codec;)Lye;
      intermediary method_56368 Lnet/minecraft/class_9135;method_56368(Lcom/mojang/serialization/Codec;)Lnet/minecraft/class_9139;
      named codec Lnet/minecraft/network/codec/PacketCodecs;codec(Lcom/mojang/serialization/Codec;)Lnet/minecraft/network/codec/PacketCodec;
    • method_57988

      static <T> PacketCodec<ByteBuf,T> method_57988(com.mojang.serialization.Codec<T> codec, Supplier<NbtSizeTracker> supplier)
      Mappings:
      Namespace Name Mixin selector
      official a Lyc;a(Lcom/mojang/serialization/Codec;Ljava/util/function/Supplier;)Lye;
      intermediary method_57988 Lnet/minecraft/class_9135;method_57988(Lcom/mojang/serialization/Codec;Ljava/util/function/Supplier;)Lnet/minecraft/class_9139;
      named method_57988 Lnet/minecraft/network/codec/PacketCodecs;method_57988(Lcom/mojang/serialization/Codec;Ljava/util/function/Supplier;)Lnet/minecraft/network/codec/PacketCodec;
    • method_58002

      static <T> PacketCodec<RegistryByteBuf,T> method_58002(com.mojang.serialization.Codec<T> codec)
      Mappings:
      Namespace Name Mixin selector
      official c Lyc;c(Lcom/mojang/serialization/Codec;)Lye;
      intermediary method_58002 Lnet/minecraft/class_9135;method_58002(Lcom/mojang/serialization/Codec;)Lnet/minecraft/class_9139;
      named method_58002 Lnet/minecraft/network/codec/PacketCodecs;method_58002(Lcom/mojang/serialization/Codec;)Lnet/minecraft/network/codec/PacketCodec;
    • registryCodec

      static <T> PacketCodec<RegistryByteBuf,T> registryCodec(com.mojang.serialization.Codec<T> codec)
      Mappings:
      Namespace Name Mixin selector
      official d Lyc;d(Lcom/mojang/serialization/Codec;)Lye;
      intermediary method_56896 Lnet/minecraft/class_9135;method_56896(Lcom/mojang/serialization/Codec;)Lnet/minecraft/class_9139;
      named registryCodec Lnet/minecraft/network/codec/PacketCodecs;registryCodec(Lcom/mojang/serialization/Codec;)Lnet/minecraft/network/codec/PacketCodec;
    • method_57997

      static <T> PacketCodec<RegistryByteBuf,T> method_57997(com.mojang.serialization.Codec<T> codec, Supplier<NbtSizeTracker> supplier)
      Mappings:
      Namespace Name Mixin selector
      official b Lyc;b(Lcom/mojang/serialization/Codec;Ljava/util/function/Supplier;)Lye;
      intermediary method_57997 Lnet/minecraft/class_9135;method_57997(Lcom/mojang/serialization/Codec;Ljava/util/function/Supplier;)Lnet/minecraft/class_9139;
      named method_57997 Lnet/minecraft/network/codec/PacketCodecs;method_57997(Lcom/mojang/serialization/Codec;Ljava/util/function/Supplier;)Lnet/minecraft/network/codec/PacketCodec;
    • optional

      static <B extends ByteBuf, V> PacketCodec<B,Optional<V>> optional(PacketCodec<B,V> codec)
      Returns a codec wrapping another codec, the value of which is optional.

      This can be used with PacketCodec.collect(net.minecraft.network.codec.PacketCodec.ResultFunction<B, V, O>) like codec.collect(PacketCodecs::optional).

      Returns:
      a codec wrapping another codec, the value of which is optional
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Lyc;a(Lye;)Lye;
      intermediary method_56382 Lnet/minecraft/class_9135;method_56382(Lnet/minecraft/class_9139;)Lnet/minecraft/class_9139;
      named optional Lnet/minecraft/network/codec/PacketCodecs;optional(Lnet/minecraft/network/codec/PacketCodec;)Lnet/minecraft/network/codec/PacketCodec;
    • method_57989

      static int method_57989(ByteBuf byteBuf, int int2)
      Mappings:
      Namespace Name Mixin selector
      official a Lyc;a(Lio/netty/buffer/ByteBuf;I)I
      intermediary method_57989 Lnet/minecraft/class_9135;method_57989(Lio/netty/buffer/ByteBuf;I)I
      named method_57989 Lnet/minecraft/network/codec/PacketCodecs;method_57989(Lio/netty/buffer/ByteBuf;I)I
    • method_57990

      static void method_57990(ByteBuf byteBuf, int int2, int int3)
      Mappings:
      Namespace Name Mixin selector
      official a Lyc;a(Lio/netty/buffer/ByteBuf;II)V
      intermediary method_57990 Lnet/minecraft/class_9135;method_57990(Lio/netty/buffer/ByteBuf;II)V
      named method_57990 Lnet/minecraft/network/codec/PacketCodecs;method_57990(Lio/netty/buffer/ByteBuf;II)V
    • collection

      static <B extends ByteBuf, V, C extends Collection<V>> PacketCodec<B,C> collection(IntFunction<C> factory, PacketCodec<? super B,V> elementCodec)
      Returns a codec for a collection of values.
      Parameters:
      factory - a function that, given the collection's size, returns a new empty collection
      elementCodec - the codec of the collection's elements
      Returns:
      a codec for a collection of values
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Lyc;a(Ljava/util/function/IntFunction;Lye;)Lye;
      intermediary method_56376 Lnet/minecraft/class_9135;method_56376(Ljava/util/function/IntFunction;Lnet/minecraft/class_9139;)Lnet/minecraft/class_9139;
      named collection Lnet/minecraft/network/codec/PacketCodecs;collection(Ljava/util/function/IntFunction;Lnet/minecraft/network/codec/PacketCodec;)Lnet/minecraft/network/codec/PacketCodec;
    • method_57991

      static <B extends ByteBuf, V, C extends Collection<V>> PacketCodec<B,C> method_57991(IntFunction<C> intFunction, PacketCodec<? super B,V> packetCodec, int int2)
      Mappings:
      Namespace Name Mixin selector
      official a Lyc;a(Ljava/util/function/IntFunction;Lye;I)Lye;
      intermediary method_57991 Lnet/minecraft/class_9135;method_57991(Ljava/util/function/IntFunction;Lnet/minecraft/class_9139;I)Lnet/minecraft/class_9139;
      named method_57991 Lnet/minecraft/network/codec/PacketCodecs;method_57991(Ljava/util/function/IntFunction;Lnet/minecraft/network/codec/PacketCodec;I)Lnet/minecraft/network/codec/PacketCodec;
    • toCollection

      static <B extends ByteBuf, V, C extends Collection<V>> PacketCodec.ResultFunction<B,V,C> toCollection(IntFunction<C> collectionFactory)
      Used to make a codec for a collection of values using PacketCodec.collect(net.minecraft.network.codec.PacketCodec.ResultFunction<B, V, O>).

      For example, to make a codec for a set of values, write codec.collect(PacketCodecs.toCollection(HashSet::new)).

      Parameters:
      collectionFactory - a function that, given the collection's size, returns a new empty collection
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Lyc;a(Ljava/util/function/IntFunction;)Lye$a;
      intermediary method_56374 Lnet/minecraft/class_9135;method_56374(Ljava/util/function/IntFunction;)Lnet/minecraft/class_9139$class_9140;
      named toCollection Lnet/minecraft/network/codec/PacketCodecs;toCollection(Ljava/util/function/IntFunction;)Lnet/minecraft/network/codec/PacketCodec$ResultFunction;
    • toList

      static <B extends ByteBuf, V> PacketCodec.ResultFunction<B,V,List<V>> toList()
      Used to make a codec for a list of values using PacketCodec.collect(net.minecraft.network.codec.PacketCodec.ResultFunction<B, V, O>). This creates an ArrayList, so the decoded result can be modified.

      For example, to make a codec for a list of values, write codec.collect(PacketCodecs.toList()).

      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Lyc;a()Lye$a;
      intermediary method_56363 Lnet/minecraft/class_9135;method_56363()Lnet/minecraft/class_9139$class_9140;
      named toList Lnet/minecraft/network/codec/PacketCodecs;toList()Lnet/minecraft/network/codec/PacketCodec$ResultFunction;
    • method_58000

      static <B extends ByteBuf, V> PacketCodec.ResultFunction<B,V,List<V>> method_58000(int int2)
      Mappings:
      Namespace Name Mixin selector
      official c Lyc;c(I)Lye$a;
      intermediary method_58000 Lnet/minecraft/class_9135;method_58000(I)Lnet/minecraft/class_9139$class_9140;
      named method_58000 Lnet/minecraft/network/codec/PacketCodecs;method_58000(I)Lnet/minecraft/network/codec/PacketCodec$ResultFunction;
    • map

      static <B extends ByteBuf, K, V, M extends Map<K, V>> PacketCodec<B,M> map(IntFunction<? extends M> factory, PacketCodec<? super B,K> keyCodec, PacketCodec<? super B,V> valueCodec)
      Returns a codec for a map.
      Parameters:
      factory - a function that, given the map's size, returns a new empty map
      keyCodec - the codec for the map's keys
      valueCodec - the codec for the map's values
      Returns:
      a codec for a map
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Lyc;a(Ljava/util/function/IntFunction;Lye;Lye;)Lye;
      intermediary method_56377 Lnet/minecraft/class_9135;method_56377(Ljava/util/function/IntFunction;Lnet/minecraft/class_9139;Lnet/minecraft/class_9139;)Lnet/minecraft/class_9139;
      named map Lnet/minecraft/network/codec/PacketCodecs;map(Ljava/util/function/IntFunction;Lnet/minecraft/network/codec/PacketCodec;Lnet/minecraft/network/codec/PacketCodec;)Lnet/minecraft/network/codec/PacketCodec;
    • method_57992

      static <B extends ByteBuf, K, V, M extends Map<K, V>> PacketCodec<B,M> method_57992(IntFunction<? extends M> intFunction, PacketCodec<? super B,K> packetCodec, PacketCodec<? super B,V> packetCodec2, int int2)
      Mappings:
      Namespace Name Mixin selector
      official a Lyc;a(Ljava/util/function/IntFunction;Lye;Lye;I)Lye;
      intermediary method_57992 Lnet/minecraft/class_9135;method_57992(Ljava/util/function/IntFunction;Lnet/minecraft/class_9139;Lnet/minecraft/class_9139;I)Lnet/minecraft/class_9139;
      named method_57992 Lnet/minecraft/network/codec/PacketCodecs;method_57992(Ljava/util/function/IntFunction;Lnet/minecraft/network/codec/PacketCodec;Lnet/minecraft/network/codec/PacketCodec;I)Lnet/minecraft/network/codec/PacketCodec;
    • method_57995

      static <B extends ByteBuf, L, R> PacketCodec<B,com.mojang.datafixers.util.Either<L,R>> method_57995(PacketCodec<? super B,L> packetCodec, PacketCodec<? super B,R> packetCodec2)
      Mappings:
      Namespace Name Mixin selector
      official a Lyc;a(Lye;Lye;)Lye;
      intermediary method_57995 Lnet/minecraft/class_9135;method_57995(Lnet/minecraft/class_9139;Lnet/minecraft/class_9139;)Lnet/minecraft/class_9139;
      named method_57995 Lnet/minecraft/network/codec/PacketCodecs;method_57995(Lnet/minecraft/network/codec/PacketCodec;Lnet/minecraft/network/codec/PacketCodec;)Lnet/minecraft/network/codec/PacketCodec;
    • indexed

      static <T> PacketCodec<ByteBuf,T> indexed(IntFunction<T> indexToValue, ToIntFunction<T> valueToIndex)
      Returns a codec for an indexed value.

      An example of an indexed value is an enum.

      Parameters:
      indexToValue - a function that gets a value from its index
      valueToIndex - a function that gets a value's index
      Returns:
      a codec for an indexed value
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Lyc;a(Ljava/util/function/IntFunction;Ljava/util/function/ToIntFunction;)Lye;
      intermediary method_56375 Lnet/minecraft/class_9135;method_56375(Ljava/util/function/IntFunction;Ljava/util/function/ToIntFunction;)Lnet/minecraft/class_9139;
      named indexed Lnet/minecraft/network/codec/PacketCodecs;indexed(Ljava/util/function/IntFunction;Ljava/util/function/ToIntFunction;)Lnet/minecraft/network/codec/PacketCodec;
    • entryOf

      static <T> PacketCodec<ByteBuf,T> entryOf(IndexedIterable<T> iterable)
      Returns a codec for an entry of iterable.
      Returns:
      a codec for an entry of iterable
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Lyc;a(Liq;)Lye;
      intermediary method_56371 Lnet/minecraft/class_9135;method_56371(Lnet/minecraft/class_2359;)Lnet/minecraft/class_9139;
      named entryOf Lnet/minecraft/network/codec/PacketCodecs;entryOf(Lnet/minecraft/util/collection/IndexedIterable;)Lnet/minecraft/network/codec/PacketCodec;
    • registry

      private static <T, R> PacketCodec<RegistryByteBuf,R> registry(RegistryKey<? extends Registry<T>> registry, Function<Registry<T>,IndexedIterable<R>> registryTransformer)
      Mappings:
      Namespace Name Mixin selector
      official a Lyc;a(Lajs;Ljava/util/function/Function;)Lye;
      intermediary method_56366 Lnet/minecraft/class_9135;method_56366(Lnet/minecraft/class_5321;Ljava/util/function/Function;)Lnet/minecraft/class_9139;
      named registry Lnet/minecraft/network/codec/PacketCodecs;registry(Lnet/minecraft/registry/RegistryKey;Ljava/util/function/Function;)Lnet/minecraft/network/codec/PacketCodec;
    • registryValue

      static <T> PacketCodec<RegistryByteBuf,T> registryValue(RegistryKey<? extends Registry<T>> registry)
      Returns a codec for a Registry-registered value.

      This codec only works with RegistryByteBuf, used during the play phase. Consider using entryOf(net.minecraft.util.collection.IndexedIterable<T>) for encoding a value of a static registry during login or configuration phases.

      Returns:
      a codec for a Registry-registered value
      See Also:
      Implementation Note:
      The value is serialized as the corresponding raw ID (as a var int).
      Mappings:
      Namespace Name Mixin selector
      official a Lyc;a(Lajs;)Lye;
      intermediary method_56365 Lnet/minecraft/class_9135;method_56365(Lnet/minecraft/class_5321;)Lnet/minecraft/class_9139;
      named registryValue Lnet/minecraft/network/codec/PacketCodecs;registryValue(Lnet/minecraft/registry/RegistryKey;)Lnet/minecraft/network/codec/PacketCodec;
    • registryEntry

      static <T> PacketCodec<RegistryByteBuf,RegistryEntry<T>> registryEntry(RegistryKey<? extends Registry<T>> registry)
      Returns a codec for a reference RegistryEntry.

      This codec only works with RegistryByteBuf, used during the play phase. Consider using entryOf(net.minecraft.util.collection.IndexedIterable<T>) for encoding a value of a static registry during login or configuration phases.

      Returns:
      a codec for a reference RegistryEntry
      See Also:
      Implementation Note:
      The value is serialized as the corresponding raw ID (as a var int). This does not handle direct (unregistered) entries.
      Mappings:
      Namespace Name Mixin selector
      official b Lyc;b(Lajs;)Lye;
      intermediary method_56383 Lnet/minecraft/class_9135;method_56383(Lnet/minecraft/class_5321;)Lnet/minecraft/class_9139;
      named registryEntry Lnet/minecraft/network/codec/PacketCodecs;registryEntry(Lnet/minecraft/registry/RegistryKey;)Lnet/minecraft/network/codec/PacketCodec;
    • registryEntry

      static <T> PacketCodec<RegistryByteBuf,RegistryEntry<T>> registryEntry(RegistryKey<? extends Registry<T>> registry, PacketCodec<? super RegistryByteBuf,T> directCodec)
      Returns a codec for a RegistryEntry.

      This codec only works with RegistryByteBuf, used during the play phase. Consider using entryOf(net.minecraft.util.collection.IndexedIterable<T>) for encoding a value of a static registry during login or configuration phases.

      Returns:
      a codec for a RegistryEntry
      See Also:
      Implementation Note:
      If the entry is a reference entry, the value is serialized as the corresponding raw ID (as a var int). If it is a direct entry, it is encoded using directCodec.
      Mappings:
      Namespace Name Mixin selector
      official a Lyc;a(Lajs;Lye;)Lye;
      intermediary method_56367 Lnet/minecraft/class_9135;method_56367(Lnet/minecraft/class_5321;Lnet/minecraft/class_9139;)Lnet/minecraft/class_9139;
      named registryEntry Lnet/minecraft/network/codec/PacketCodecs;registryEntry(Lnet/minecraft/registry/RegistryKey;Lnet/minecraft/network/codec/PacketCodec;)Lnet/minecraft/network/codec/PacketCodec;
    • method_58001

      static <T> PacketCodec<RegistryByteBuf,RegistryEntryList<T>> method_58001(RegistryKey<? extends Registry<T>> registryKey)
      Mappings:
      Namespace Name Mixin selector
      official c Lyc;c(Lajs;)Lye;
      intermediary method_58001 Lnet/minecraft/class_9135;method_58001(Lnet/minecraft/class_5321;)Lnet/minecraft/class_9139;
      named method_58001 Lnet/minecraft/network/codec/PacketCodecs;method_58001(Lnet/minecraft/registry/RegistryKey;)Lnet/minecraft/network/codec/PacketCodec;