Class NeoForgeStreamCodecs
java.lang.Object
net.neoforged.neoforge.network.codec.NeoForgeStreamCodecs
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StreamCodec
<FriendlyByteBuf, ChunkPos> static final StreamCodec
<FriendlyByteBuf, byte[]> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <V> StreamCodec
<RegistryFriendlyByteBuf, V> connectionAware
(StreamCodec<? super RegistryFriendlyByteBuf, V> neoForgeCodec, StreamCodec<? super RegistryFriendlyByteBuf, V> otherCodec) Creates a stream codec that uses different implementation depending on theConnectionType
.static <B extends FriendlyByteBuf,
V extends Enum<V>>
StreamCodec<B, V> static <B,
V> StreamCodec <B, V> lazy
(Supplier<StreamCodec<B, V>> streamCodecSupplier) static <B extends FriendlyByteBuf>
StreamCodec<B, ResourceKey<? extends Registry<?>>> Creates a stream codec to encode and decode aResourceKey
that identifies a registry.static <B,
V> StreamCodec <B, V> uncheckedUnit
(V defaultValue) Similar toStreamCodec.unit(Object)
, but without checks for the value to be encoded.
-
Field Details
-
UNBOUNDED_BYTE_ARRAY
-
CHUNK_POS
-
-
Constructor Details
-
NeoForgeStreamCodecs
public NeoForgeStreamCodecs()
-
-
Method Details
-
lazy
-
enumCodec
public static <B extends FriendlyByteBuf,V extends Enum<V>> StreamCodec<B,V> enumCodec(Class<V> enumClass) -
registryKey
public static <B extends FriendlyByteBuf> StreamCodec<B,ResourceKey<? extends Registry<?>>> registryKey()Creates a stream codec to encode and decode aResourceKey
that identifies a registry. -
connectionAware
public static <V> StreamCodec<RegistryFriendlyByteBuf,V> connectionAware(StreamCodec<? super RegistryFriendlyByteBuf, V> neoForgeCodec, StreamCodec<? super RegistryFriendlyByteBuf, V> otherCodec) Creates a stream codec that uses different implementation depending on theConnectionType
. Should be used to keep vanilla connection compatibility. -
uncheckedUnit
Similar toStreamCodec.unit(Object)
, but without checks for the value to be encoded.
-