Interface ByteBufCodecs
public interface ByteBufCodecs
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StreamCodec<io.netty.buffer.ByteBuf,net.minecraft.core.BlockPos> static final StreamCodec<io.netty.buffer.ByteBuf,Boolean> static final StreamCodec<io.netty.buffer.ByteBuf,Byte> static final StreamCodec<io.netty.buffer.ByteBuf,byte[]> static final StreamCodec<io.netty.buffer.ByteBuf,net.minecraft.world.level.ChunkPos> static final StreamCodec<io.netty.buffer.ByteBuf,net.minecraft.network.chat.Component> static final StreamCodec<io.netty.buffer.ByteBuf,net.minecraft.nbt.CompoundTag> static final StreamCodec<io.netty.buffer.ByteBuf,net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level>> static final StreamCodec<io.netty.buffer.ByteBuf,net.minecraft.core.Direction> static final StreamCodec<io.netty.buffer.ByteBuf,Double> static final StreamCodec<io.netty.buffer.ByteBuf,Float> static final StreamCodec<io.netty.buffer.ByteBuf,com.mojang.authlib.GameProfile> static final StreamCodec<io.netty.buffer.ByteBuf,com.mojang.authlib.properties.PropertyMap> static final StreamCodec<io.netty.buffer.ByteBuf,net.minecraft.core.GlobalPos> static final StreamCodec<io.netty.buffer.ByteBuf,Integer> static final StreamCodec<io.netty.buffer.ByteBuf,net.minecraft.world.item.ItemStack> A non-empty item stack (1.20.5+'s ByteBufCodecs.ITEM_STACK).static final StreamCodec<io.netty.buffer.ByteBuf,long[]> static final intstatic final StreamCodec<io.netty.buffer.ByteBuf,Optional<net.minecraft.nbt.CompoundTag>> static final StreamCodec<io.netty.buffer.ByteBuf,net.minecraft.world.item.ItemStack> An item stack, which may be empty (1.20.5+'s ByteBufCodecs.OPTIONAL_ITEM_STACK).static final StreamCodec<io.netty.buffer.ByteBuf,OptionalInt> static final StreamCodec<io.netty.buffer.ByteBuf,org.joml.Quaternionf> static final StreamCodec<io.netty.buffer.ByteBuf,net.minecraft.resources.ResourceLocation> static final StreamCodec<io.netty.buffer.ByteBuf,Short> static final StreamCodec<io.netty.buffer.ByteBuf,String> static final StreamCodec<io.netty.buffer.ByteBuf,net.minecraft.nbt.Tag> static final StreamCodec<io.netty.buffer.ByteBuf,net.minecraft.nbt.CompoundTag> static final StreamCodec<io.netty.buffer.ByteBuf,net.minecraft.nbt.Tag> static final StreamCodec<io.netty.buffer.ByteBuf,UUID> static final StreamCodec<io.netty.buffer.ByteBuf,Integer> static final StreamCodec<io.netty.buffer.ByteBuf,Long> static final StreamCodec<io.netty.buffer.ByteBuf,net.minecraft.world.phys.Vec3> static final StreamCodec<io.netty.buffer.ByteBuf,org.joml.Vector3f> -
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic <B extends io.netty.buffer.ByteBuf,V, C extends Collection<V>>
StreamCodec.CodecOperation<B,V, C> collection(IntFunction<C> factory) static <B extends io.netty.buffer.ByteBuf,V, C extends Collection<V>>
StreamCodec<B,C> collection(IntFunction<C> factory, StreamCodec<? super B, V> codec) static <B extends io.netty.buffer.ByteBuf,V, C extends Collection<V>>
StreamCodec<B,C> collection(IntFunction<C> factory, StreamCodec<? super B, V> codec, int max) static StreamCodec<io.netty.buffer.ByteBuf,net.minecraft.nbt.CompoundTag> compoundTagCodec(Supplier<net.minecraft.nbt.NbtAccounter> accounter) static <B extends io.netty.buffer.ByteBuf,L, R>
StreamCodec<B,com.mojang.datafixers.util.Either<L, R>> either(StreamCodec<? super B, L> left, StreamCodec<? super B, R> right) static <T> StreamCodec<io.netty.buffer.ByteBuf,T> fromCodec(com.mojang.serialization.Codec<T> codec) A value written with itsCodecas NBT.static <T> StreamCodec<io.netty.buffer.ByteBuf,T> fromCodec(com.mojang.serialization.Codec<T> codec, Supplier<net.minecraft.nbt.NbtAccounter> accounter) static <T> StreamCodec<io.netty.buffer.ByteBuf,T> fromCodecWithRegistries(com.mojang.serialization.Codec<T> codec) LikefromCodec(Codec), with the registry access of the running server or client world when there is one (1.20.1's buffers carry none).static <T> StreamCodec<io.netty.buffer.ByteBuf,T> idMapper(IntFunction<T> byId, ToIntFunction<T> toId) static <T> StreamCodec<io.netty.buffer.ByteBuf,T> idMapper(net.minecraft.core.IdMap<T> idMap) A value by its id in anIdMap, such asBlock.BLOCK_STATE_REGISTRY.static <B extends io.netty.buffer.ByteBuf,V>
StreamCodec.CodecOperation<B,V, List<V>> list()static <B extends io.netty.buffer.ByteBuf,V>
StreamCodec.CodecOperation<B,V, List<V>> list(int max) static <B extends io.netty.buffer.ByteBuf,K, V, M extends Map<K, V>>
StreamCodec<B,M> map(IntFunction<? extends M> factory, StreamCodec<? super B, K> keyCodec, StreamCodec<? super B, V> valueCodec) static <B extends io.netty.buffer.ByteBuf,K, V, M extends Map<K, V>>
StreamCodec<B,M> map(IntFunction<? extends M> factory, StreamCodec<? super B, K> keyCodec, StreamCodec<? super B, V> valueCodec, int max) static <B extends io.netty.buffer.ByteBuf,V>
StreamCodec<B,Optional<V>> optional(StreamCodec<B, V> codec) static intreadCount(io.netty.buffer.ByteBuf buf, int max) static <T> StreamCodec<io.netty.buffer.ByteBuf,T> registry(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>> registryKey) A value by its network id in one of the built-in registries (1.20.1's buffers carry no registry access).static StreamCodec<io.netty.buffer.ByteBuf,String> stringUtf8(int maxLength) static StreamCodec<io.netty.buffer.ByteBuf,net.minecraft.nbt.Tag> static voidwriteCount(io.netty.buffer.ByteBuf buf, int count, int max)
-
Field Details
-
MAX_INITIAL_COLLECTION_SIZE
static final int MAX_INITIAL_COLLECTION_SIZE- See Also:
-
BOOL
-
BYTE
-
SHORT
-
INT
-
VAR_INT
-
VAR_LONG
-
FLOAT
-
DOUBLE
-
BYTE_ARRAY
-
STRING_UTF8
-
TAG
-
TRUSTED_TAG
-
COMPOUND_TAG
-
TRUSTED_COMPOUND_TAG
static final StreamCodec<io.netty.buffer.ByteBuf,net.minecraft.nbt.CompoundTag> TRUSTED_COMPOUND_TAG -
OPTIONAL_COMPOUND_TAG
static final StreamCodec<io.netty.buffer.ByteBuf,Optional<net.minecraft.nbt.CompoundTag>> OPTIONAL_COMPOUND_TAG -
VECTOR3F
-
QUATERNIONF
-
GAME_PROFILE_PROPERTIES
static final StreamCodec<io.netty.buffer.ByteBuf,com.mojang.authlib.properties.PropertyMap> GAME_PROFILE_PROPERTIES -
GAME_PROFILE
-
LONG_ARRAY
-
OPTIONAL_VAR_INT
-
RESOURCE_LOCATION
static final StreamCodec<io.netty.buffer.ByteBuf,net.minecraft.resources.ResourceLocation> RESOURCE_LOCATION -
BLOCK_POS
-
VEC3
-
CHUNK_POS
-
DIMENSION
static final StreamCodec<io.netty.buffer.ByteBuf,net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level>> DIMENSION -
GLOBAL_POS
-
DIRECTION
-
UUID
-
COMPONENT
-
OPTIONAL_ITEM_STACK
static final StreamCodec<io.netty.buffer.ByteBuf,net.minecraft.world.item.ItemStack> OPTIONAL_ITEM_STACKAn item stack, which may be empty (1.20.5+'s ByteBufCodecs.OPTIONAL_ITEM_STACK). -
ITEM_STACK
A non-empty item stack (1.20.5+'s ByteBufCodecs.ITEM_STACK).
-
-
Method Details
-
stringUtf8
-
tagCodec
static StreamCodec<io.netty.buffer.ByteBuf,net.minecraft.nbt.Tag> tagCodec(Supplier<net.minecraft.nbt.NbtAccounter> accounter) -
compoundTagCodec
static StreamCodec<io.netty.buffer.ByteBuf,net.minecraft.nbt.CompoundTag> compoundTagCodec(Supplier<net.minecraft.nbt.NbtAccounter> accounter) -
optional
static <B extends io.netty.buffer.ByteBuf,V> StreamCodec<B,Optional<V>> optional(StreamCodec<B, V> codec) -
readCount
static int readCount(io.netty.buffer.ByteBuf buf, int max) -
writeCount
static void writeCount(io.netty.buffer.ByteBuf buf, int count, int max) -
collection
static <B extends io.netty.buffer.ByteBuf,V, StreamCodec<B,C extends Collection<V>> C> collection(IntFunction<C> factory, StreamCodec<? super B, V> codec, int max) -
collection
static <B extends io.netty.buffer.ByteBuf,V, StreamCodec<B,C extends Collection<V>> C> collection(IntFunction<C> factory, StreamCodec<? super B, V> codec) -
collection
static <B extends io.netty.buffer.ByteBuf,V, StreamCodec.CodecOperation<B,C extends Collection<V>> V, collectionC> (IntFunction<C> factory) -
list
-
list
-
map
static <B extends io.netty.buffer.ByteBuf,K, StreamCodec<B,V, M extends Map<K, V>> M> map(IntFunction<? extends M> factory, StreamCodec<? super B, K> keyCodec, StreamCodec<? super B, V> valueCodec) -
map
static <B extends io.netty.buffer.ByteBuf,K, StreamCodec<B,V, M extends Map<K, V>> M> map(IntFunction<? extends M> factory, StreamCodec<? super B, K> keyCodec, StreamCodec<? super B, V> valueCodec, int max) -
either
static <B extends io.netty.buffer.ByteBuf,L, StreamCodec<B,R> com.mojang.datafixers.util.Either<L, eitherR>> (StreamCodec<? super B, L> left, StreamCodec<? super B, R> right) -
idMapper
A value by its id in anIdMap, such asBlock.BLOCK_STATE_REGISTRY. -
idMapper
static <T> StreamCodec<io.netty.buffer.ByteBuf,T> idMapper(IntFunction<T> byId, ToIntFunction<T> toId) -
registry
static <T> StreamCodec<io.netty.buffer.ByteBuf,T> registry(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>> registryKey) A value by its network id in one of the built-in registries (1.20.1's buffers carry no registry access). -
fromCodec
static <T> StreamCodec<io.netty.buffer.ByteBuf,T> fromCodec(com.mojang.serialization.Codec<T> codec) A value written with itsCodecas NBT. -
fromCodec
static <T> StreamCodec<io.netty.buffer.ByteBuf,T> fromCodec(com.mojang.serialization.Codec<T> codec, Supplier<net.minecraft.nbt.NbtAccounter> accounter) -
fromCodecWithRegistries
static <T> StreamCodec<io.netty.buffer.ByteBuf,T> fromCodecWithRegistries(com.mojang.serialization.Codec<T> codec) LikefromCodec(Codec), with the registry access of the running server or client world when there is one (1.20.1's buffers carry none).
-