Class MinecraftCodecHelper
java.lang.Object
org.geysermc.mcprotocollib.network.codec.BasePacketCodecHelper
org.geysermc.mcprotocollib.protocol.codec.MinecraftCodecHelper
- All Implemented Interfaces:
PacketCodecHelper
- Direct Known Subclasses:
ItemCodecHelper
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMinecraftCodecHelper(it.unimi.dsi.fastutil.ints.Int2ObjectMap<LevelEventType> levelEvents, Map<String, BuiltinSound> soundNames) -
Method Summary
Modifier and TypeMethodDescription@Nullable BuiltinSoundgetBuiltinSound(String name) @Nullable org.cloudburstmc.nbt.NbtMapThe game registry sent to clients from theClientboundLoginPacket.@Nullable ObjectreadAnyTag(io.netty.buffer.ByteBuf buf) <T> @Nullable TreadAnyTag(io.netty.buffer.ByteBuf buf, org.cloudburstmc.nbt.NbtType<T> expected) readArmadilloState(io.netty.buffer.ByteBuf buf) readBlockBreakStage(io.netty.buffer.ByteBuf buf) @Nullable BlockEntityTypereadBlockEntityType(io.netty.buffer.ByteBuf buf) <T> TreadById(io.netty.buffer.ByteBuf buf, IntFunction<T> registry, Function<io.netty.buffer.ByteBuf, T> custom) byte[]readByteArray(io.netty.buffer.ByteBuf buf) byte[]readByteArray(io.netty.buffer.ByteBuf buf, ToIntFunction<io.netty.buffer.ByteBuf> reader) readChunkSection(io.netty.buffer.ByteBuf buf) readChunkSection(io.netty.buffer.ByteBuf buf, int globalBiomePaletteBits) Deprecated, for removal: This API element is subject to removal in a future version.net.kyori.adventure.text.ComponentreadComponent(io.netty.buffer.ByteBuf buf) @Nullable org.cloudburstmc.nbt.NbtMapreadCompoundTag(io.netty.buffer.ByteBuf buf) @NonNull org.cloudburstmc.nbt.NbtMapreadCompoundTagOrThrow(io.netty.buffer.ByteBuf buf) @Nullable DataComponentsreadDataComponentPatch(io.netty.buffer.ByteBuf buf) readDataPalette(io.netty.buffer.ByteBuf buf, PaletteType paletteType) readDataPalette(io.netty.buffer.ByteBuf buf, PaletteType paletteType, int globalPaletteBits) Deprecated, for removal: This API element is subject to removal in a future version.globalPaletteBits is no longer in use, usereadDataPalette(ByteBuf, PaletteType)instead.readDirection(io.netty.buffer.ByteBuf buf) readEffect(io.netty.buffer.ByteBuf buf) readEntityEvent(io.netty.buffer.ByteBuf buf) EntityMetadata<?,?>[] readEntityMetadata(io.netty.buffer.ByteBuf buf) readEnumSet(io.netty.buffer.ByteBuf buf, E[] values) readFixedBitSet(io.netty.buffer.ByteBuf buf, int length) readGlobalPos(io.netty.buffer.ByteBuf buf) <T> Holder<T>readHolder(io.netty.buffer.ByteBuf buf, Function<io.netty.buffer.ByteBuf, T> readCustom) @NotNull ItemStackreadItemStack(io.netty.buffer.ByteBuf buf) readLevelEvent(io.netty.buffer.ByteBuf buf) readLightUpdateData(io.netty.buffer.ByteBuf buf) <T> List<T>long[]readLongArray(io.netty.buffer.ByteBuf buf) long[]readLongArray(io.netty.buffer.ByteBuf buf, ToIntFunction<io.netty.buffer.ByteBuf> reader) EntityMetadata<?,?> readMetadata(io.netty.buffer.ByteBuf buf, int id) MetadataType<?>readMetadataType(io.netty.buffer.ByteBuf buf) readModifierOperation(io.netty.buffer.ByteBuf buf) readNibbleArray(io.netty.buffer.ByteBuf buf, int size) <T> @Nullable TreadNullable(io.netty.buffer.ByteBuf buf, Function<io.netty.buffer.ByteBuf, T> ifPresent) readNumberFormat(io.netty.buffer.ByteBuf buf) @Nullable ItemStackreadOptionalItemStack(io.netty.buffer.ByteBuf buf) readPaintingType(io.netty.buffer.ByteBuf buf) readParticle(io.netty.buffer.ByteBuf buf) readParticleData(io.netty.buffer.ByteBuf buf, ParticleType type) readParticleType(io.netty.buffer.ByteBuf buf) readPlayerSpawnInfo(io.netty.buffer.ByteBuf buf) readPose(io.netty.buffer.ByteBuf buf) org.cloudburstmc.math.vector.Vector3ireadPosition(io.netty.buffer.ByteBuf buf) readPositionSource(io.netty.buffer.ByteBuf buf) com.github.steveice10.mc.auth.data.GameProfile.PropertyreadProperty(io.netty.buffer.ByteBuf buf) org.cloudburstmc.math.vector.Vector4freadQuaternion(io.netty.buffer.ByteBuf buf) readRecipeIngredient(io.netty.buffer.ByteBuf buf) net.kyori.adventure.key.KeyreadResourceLocation(io.netty.buffer.ByteBuf buf) org.cloudburstmc.math.vector.Vector3freadRotation(io.netty.buffer.ByteBuf buf) readSnifferState(io.netty.buffer.ByteBuf buf) readSoundCategory(io.netty.buffer.ByteBuf buf) readSoundEvent(io.netty.buffer.ByteBuf buf) readStatisticCategory(io.netty.buffer.ByteBuf buf) @NotNull ItemStackreadTradeItemStack(io.netty.buffer.ByteBuf buf) readUUID(io.netty.buffer.ByteBuf buf) readVillagerData(io.netty.buffer.ByteBuf buf) voidsetRegistry(org.cloudburstmc.nbt.NbtMap registry) voidwriteAnyTag(io.netty.buffer.ByteBuf buf, @Nullable Object tag) voidwriteArmadilloState(io.netty.buffer.ByteBuf buf, ArmadilloState state) voidwriteBlockBreakStage(io.netty.buffer.ByteBuf buf, BlockBreakStage stage) voidwriteBlockEntityType(io.netty.buffer.ByteBuf buf, BlockEntityType type) voidwriteByteArray(io.netty.buffer.ByteBuf buf, byte[] bytes) voidwriteByteArray(io.netty.buffer.ByteBuf buf, byte[] bytes, ObjIntConsumer<io.netty.buffer.ByteBuf> writer) voidwriteChunkSection(io.netty.buffer.ByteBuf buf, ChunkSection section) voidwriteComponent(io.netty.buffer.ByteBuf buf, net.kyori.adventure.text.Component component) voidwriteDataComponentPatch(io.netty.buffer.ByteBuf buf, DataComponents dataComponents) voidwriteDataPalette(io.netty.buffer.ByteBuf buf, DataPalette palette) voidwriteDirection(io.netty.buffer.ByteBuf buf, Direction dir) voidwriteEffect(io.netty.buffer.ByteBuf buf, Effect effect) voidwriteEntityEvent(io.netty.buffer.ByteBuf buf, EntityEvent event) voidwriteEntityMetadata(io.netty.buffer.ByteBuf buf, EntityMetadata<?, ?>[] metadata) <E extends Enum<E>>
voidwriteEnumSet(io.netty.buffer.ByteBuf buf, EnumSet<E> enumSet, E[] values) voidwriteFixedBitSet(io.netty.buffer.ByteBuf buf, BitSet bitSet, int length) voidwriteGlobalPos(io.netty.buffer.ByteBuf buf, GlobalPos pos) <T> voidwriteHolder(io.netty.buffer.ByteBuf buf, Holder<T> holder, BiConsumer<io.netty.buffer.ByteBuf, T> writeCustom) voidwriteItemStack(io.netty.buffer.ByteBuf buf, @NotNull ItemStack item) voidwriteLevelEvent(io.netty.buffer.ByteBuf buf, LevelEvent event) voidwriteLightUpdateData(io.netty.buffer.ByteBuf buf, LightUpdateData data) <T> voidwriteList(io.netty.buffer.ByteBuf buf, List<T> value, BiConsumer<io.netty.buffer.ByteBuf, T> writer) voidwriteLongArray(io.netty.buffer.ByteBuf buf, long[] l) voidwriteLongArray(io.netty.buffer.ByteBuf buf, long[] l, ObjIntConsumer<io.netty.buffer.ByteBuf> writer) voidwriteMetadata(io.netty.buffer.ByteBuf buf, EntityMetadata<?, ?> metadata) voidwriteMetadataType(io.netty.buffer.ByteBuf buf, MetadataType<?> type) voidwriteModifierOperation(io.netty.buffer.ByteBuf buf, ModifierOperation operation) voidwriteNibbleArray(io.netty.buffer.ByteBuf buf, NibbleArray3d nibbleArray) <T> voidwriteNullable(io.netty.buffer.ByteBuf buf, @Nullable T value, BiConsumer<io.netty.buffer.ByteBuf, T> ifPresent) voidwriteNumberFormat(io.netty.buffer.ByteBuf buf, NumberFormat numberFormat) voidwriteOptionalItemStack(io.netty.buffer.ByteBuf buf, ItemStack item) voidwritePaintingType(io.netty.buffer.ByteBuf buf, PaintingType type) voidwriteParticle(io.netty.buffer.ByteBuf buf, Particle particle) voidwriteParticleData(io.netty.buffer.ByteBuf buf, ParticleType type, ParticleData data) voidwriteParticleType(io.netty.buffer.ByteBuf buf, ParticleType type) voidwritePlayerSpawnInfo(io.netty.buffer.ByteBuf buf, PlayerSpawnInfo info) voidvoidwritePosition(io.netty.buffer.ByteBuf buf, org.cloudburstmc.math.vector.Vector3i pos) voidwritePositionSource(io.netty.buffer.ByteBuf buf, PositionSource positionSource) voidwriteProperty(io.netty.buffer.ByteBuf buf, com.github.steveice10.mc.auth.data.GameProfile.Property property) voidwriteQuaternion(io.netty.buffer.ByteBuf buf, org.cloudburstmc.math.vector.Vector4f vec4) voidwriteRecipeIngredient(io.netty.buffer.ByteBuf buf, Ingredient ingredient) voidwriteResourceLocation(io.netty.buffer.ByteBuf buf, net.kyori.adventure.key.Key location) voidwriteRotation(io.netty.buffer.ByteBuf buf, org.cloudburstmc.math.vector.Vector3f rot) voidwriteSnifferState(io.netty.buffer.ByteBuf buf, SnifferState state) voidwriteSoundCategory(io.netty.buffer.ByteBuf buf, SoundCategory category) voidwriteSoundEvent(io.netty.buffer.ByteBuf buf, Sound soundEvent) voidwriteStatisticCategory(io.netty.buffer.ByteBuf buf, StatisticCategory category) voidwriteTradeItemStack(io.netty.buffer.ByteBuf buf, @NotNull ItemStack item) voidvoidwriteVillagerData(io.netty.buffer.ByteBuf buf, VillagerData villagerData) Methods inherited from class org.geysermc.mcprotocollib.network.codec.BasePacketCodecHelper
readString, readString, readVarInt, readVarLong, writeString, writeVarInt, writeVarLong
-
Field Details
-
registry
protected org.cloudburstmc.nbt.NbtMap registry
-
-
Constructor Details
-
MinecraftCodecHelper
public MinecraftCodecHelper(it.unimi.dsi.fastutil.ints.Int2ObjectMap<LevelEventType> levelEvents, Map<String, BuiltinSound> soundNames)
-
-
Method Details
-
readNullable
public <T> @Nullable T readNullable(io.netty.buffer.ByteBuf buf, Function<io.netty.buffer.ByteBuf, T> ifPresent) -
writeNullable
public <T> void writeNullable(io.netty.buffer.ByteBuf buf, @Nullable T value, BiConsumer<io.netty.buffer.ByteBuf, T> ifPresent) -
readList
-
writeList
public <T> void writeList(io.netty.buffer.ByteBuf buf, List<T> value, BiConsumer<io.netty.buffer.ByteBuf, T> writer) -
readHolder
-
writeHolder
public <T> void writeHolder(io.netty.buffer.ByteBuf buf, Holder<T> holder, BiConsumer<io.netty.buffer.ByteBuf, T> writeCustom) -
readResourceLocation
public net.kyori.adventure.key.Key readResourceLocation(io.netty.buffer.ByteBuf buf) -
writeResourceLocation
public void writeResourceLocation(io.netty.buffer.ByteBuf buf, net.kyori.adventure.key.Key location) -
readUUID
-
writeUUID
-
readByteArray
public byte[] readByteArray(io.netty.buffer.ByteBuf buf) -
readByteArray
public byte[] readByteArray(io.netty.buffer.ByteBuf buf, ToIntFunction<io.netty.buffer.ByteBuf> reader) -
writeByteArray
public void writeByteArray(io.netty.buffer.ByteBuf buf, byte[] bytes) -
writeByteArray
public void writeByteArray(io.netty.buffer.ByteBuf buf, byte[] bytes, ObjIntConsumer<io.netty.buffer.ByteBuf> writer) -
readLongArray
public long[] readLongArray(io.netty.buffer.ByteBuf buf) -
readLongArray
public long[] readLongArray(io.netty.buffer.ByteBuf buf, ToIntFunction<io.netty.buffer.ByteBuf> reader) -
writeLongArray
public void writeLongArray(io.netty.buffer.ByteBuf buf, long[] l) -
writeLongArray
public void writeLongArray(io.netty.buffer.ByteBuf buf, long[] l, ObjIntConsumer<io.netty.buffer.ByteBuf> writer) -
readCompoundTag
public @Nullable org.cloudburstmc.nbt.NbtMap readCompoundTag(io.netty.buffer.ByteBuf buf) -
readCompoundTagOrThrow
public @NonNull org.cloudburstmc.nbt.NbtMap readCompoundTagOrThrow(io.netty.buffer.ByteBuf buf) -
readAnyTag
public <T> @Nullable T readAnyTag(io.netty.buffer.ByteBuf buf, org.cloudburstmc.nbt.NbtType<T> expected) -
readAnyTag
-
writeAnyTag
-
readOptionalItemStack
-
writeOptionalItemStack
-
readItemStack
-
writeItemStack
-
readDataComponentPatch
-
writeDataComponentPatch
-
readTradeItemStack
-
writeTradeItemStack
-
readPosition
public org.cloudburstmc.math.vector.Vector3i readPosition(io.netty.buffer.ByteBuf buf) -
writePosition
public void writePosition(io.netty.buffer.ByteBuf buf, org.cloudburstmc.math.vector.Vector3i pos) -
readRotation
public org.cloudburstmc.math.vector.Vector3f readRotation(io.netty.buffer.ByteBuf buf) -
writeRotation
public void writeRotation(io.netty.buffer.ByteBuf buf, org.cloudburstmc.math.vector.Vector3f rot) -
readQuaternion
public org.cloudburstmc.math.vector.Vector4f readQuaternion(io.netty.buffer.ByteBuf buf) -
writeQuaternion
public void writeQuaternion(io.netty.buffer.ByteBuf buf, org.cloudburstmc.math.vector.Vector4f vec4) -
readDirection
-
writeDirection
-
readPose
-
writePose
-
readPaintingType
-
writePaintingType
-
readSnifferState
-
writeSnifferState
-
readArmadilloState
-
writeArmadilloState
-
readComponent
public net.kyori.adventure.text.Component readComponent(io.netty.buffer.ByteBuf buf) -
writeComponent
public void writeComponent(io.netty.buffer.ByteBuf buf, net.kyori.adventure.text.Component component) -
readEntityMetadata
-
writeEntityMetadata
-
readMetadata
-
writeMetadata
-
readMetadataType
-
writeMetadataType
-
readGlobalPos
-
writeGlobalPos
-
readPlayerSpawnInfo
-
writePlayerSpawnInfo
-
readParticleType
-
writeParticleType
-
readParticle
-
writeParticle
-
readParticleData
-
writeParticleData
-
readNumberFormat
-
writeNumberFormat
-
readPositionSource
-
writePositionSource
-
readVillagerData
-
writeVillagerData
-
readModifierOperation
-
writeModifierOperation
-
readEffect
-
writeEffect
-
readBlockBreakStage
-
writeBlockBreakStage
-
readBlockEntityType
-
writeBlockEntityType
-
readLightUpdateData
-
writeLightUpdateData
-
readLevelEvent
-
writeLevelEvent
-
readStatisticCategory
-
writeStatisticCategory
-
readSoundCategory
-
writeSoundCategory
-
getBuiltinSound
-
readEntityEvent
-
writeEntityEvent
-
readRecipeIngredient
-
writeRecipeIngredient
-
readDataPalette
-
readDataPalette
@Deprecated(forRemoval=true) public DataPalette readDataPalette(io.netty.buffer.ByteBuf buf, PaletteType paletteType, int globalPaletteBits) Deprecated, for removal: This API element is subject to removal in a future version.globalPaletteBits is no longer in use, usereadDataPalette(ByteBuf, PaletteType)instead. -
writeDataPalette
-
readChunkSection
-
readChunkSection
@Deprecated(forRemoval=true) public ChunkSection readChunkSection(io.netty.buffer.ByteBuf buf, int globalBiomePaletteBits) Deprecated, for removal: This API element is subject to removal in a future version.globalBiomePaletteBits is no longer in use, usereadChunkSection(ByteBuf)instead. -
writeChunkSection
-
readEnumSet
-
writeEnumSet
-
readFixedBitSet
-
writeFixedBitSet
-
readProperty
public com.github.steveice10.mc.auth.data.GameProfile.Property readProperty(io.netty.buffer.ByteBuf buf) -
writeProperty
public void writeProperty(io.netty.buffer.ByteBuf buf, com.github.steveice10.mc.auth.data.GameProfile.Property property) -
readById
public <T> T readById(io.netty.buffer.ByteBuf buf, IntFunction<T> registry, Function<io.netty.buffer.ByteBuf, T> custom) -
readSoundEvent
-
writeSoundEvent
-
readNibbleArray
-
writeNibbleArray
-
getRegistry
public @Nullable org.cloudburstmc.nbt.NbtMap getRegistry()The game registry sent to clients from theClientboundLoginPacket. Implementations are required to set this value if they intend to use it.- Returns:
- the game registry
-
setRegistry
public void setRegistry(org.cloudburstmc.nbt.NbtMap registry)
-
readChunkSection(ByteBuf)instead.