Class NeoForgeStreamCodecs
java.lang.Object
net.neoforged.neoforge.network.codec.NeoForgeStreamCodecs
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic 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 -
Method Summary
Modifier and TypeMethodDescriptionstatic <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 theConnectionType
.static <B extends net.minecraft.network.FriendlyByteBuf,
V extends Enum<V>>
net.minecraft.network.codec.StreamCodec<B, V> static <B,
V> net.minecraft.network.codec.StreamCodec <B, V> 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 aResourceKey
that identifies a registry.static <B,
V> net.minecraft.network.codec.StreamCodec <B, V> uncheckedUnit
(V defaultValue) Similar toStreamCodec.unit(Object)
, but without checks for the value to be encoded.
-
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
-
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 aResourceKey
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 theConnectionType
. Should be used to keep vanilla connection compatibility. -
uncheckedUnit
public static <B,V> net.minecraft.network.codec.StreamCodec<B,V> uncheckedUnit(V defaultValue) Similar toStreamCodec.unit(Object)
, but without checks for the value to be encoded.
-