Class NeoForgeStreamCodecs

java.lang.Object
net.neoforged.neoforge.network.codec.NeoForgeStreamCodecs

public final class NeoForgeStreamCodecs extends Object
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    private static class 
     
  • 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.FriendlyByteBuf,byte[]>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <V> net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,V>
    connectionAware(net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.RegistryFriendlyByteBuf,V> neoForgeCodec, net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.RegistryFriendlyByteBuf,V> otherCodec)
    Creates a stream codec that uses different implementation depending on the ConnectionType.
    static <B extends net.minecraft.network.FriendlyByteBuf, V extends Enum<V>>
    net.minecraft.network.codec.StreamCodec<B,V>
    enumCodec(Class<V> enumClass)
     
    static <B, V> net.minecraft.network.codec.StreamCodec<B,V>
    lazy(Supplier<net.minecraft.network.codec.StreamCodec<B,V>> streamCodecSupplier)
     
    static <B extends net.minecraft.network.FriendlyByteBuf>
    net.minecraft.network.codec.StreamCodec<B,net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>>>
    Creates a stream codec to encode and decode a ResourceKey that identifies a registry.
    static <B, V> net.minecraft.network.codec.StreamCodec<B,V>
    uncheckedUnit(V defaultValue)
    Similar to StreamCodec.unit(Object), but without checks for the value to be encoded.

    Methods inherited from class java.lang.Object

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

    • UNBOUNDED_BYTE_ARRAY

      public static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.FriendlyByteBuf,byte[]> UNBOUNDED_BYTE_ARRAY
    • CHUNK_POS

      public static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.FriendlyByteBuf,net.minecraft.world.level.ChunkPos> CHUNK_POS
  • Constructor Details

    • NeoForgeStreamCodecs

      public NeoForgeStreamCodecs()
  • Method Details

    • lazy

      public static <B, V> net.minecraft.network.codec.StreamCodec<B,V> lazy(Supplier<net.minecraft.network.codec.StreamCodec<B,V>> streamCodecSupplier)
    • enumCodec

      public static <B extends net.minecraft.network.FriendlyByteBuf, V extends Enum<V>> net.minecraft.network.codec.StreamCodec<B,V> enumCodec(Class<V> enumClass)
    • registryKey

      public static <B extends net.minecraft.network.FriendlyByteBuf> net.minecraft.network.codec.StreamCodec<B,net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>>> registryKey()
      Creates a stream codec to encode and decode a ResourceKey that identifies a registry.
    • connectionAware

      public static <V> net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,V> connectionAware(net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.RegistryFriendlyByteBuf,V> neoForgeCodec, net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.RegistryFriendlyByteBuf,V> otherCodec)
      Creates a stream codec that uses different implementation depending on the ConnectionType. Should be used to keep vanilla connection compatibility.
    • uncheckedUnit

      public static <B, V> net.minecraft.network.codec.StreamCodec<B,V> uncheckedUnit(V defaultValue)
      Similar to StreamCodec.unit(Object), but without checks for the value to be encoded.