Class MinecraftCodecHelper
java.lang.Object
com.github.steveice10.packetlib.codec.BasePacketCodecHelper
com.github.steveice10.mc.protocol.codec.MinecraftCodecHelper
- All Implemented Interfaces:
PacketCodecHelper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable BuiltinSoundgetBuiltinSound(String name) @Nullable com.github.steveice10.opennbt.tag.builtin.CompoundTagThe game registry sent to clients from theClientboundLoginPacket.@Nullable com.github.steveice10.opennbt.tag.builtin.CompoundTagreadAnyTag(io.netty.buffer.ByteBuf buf) <T extends com.github.steveice10.opennbt.tag.builtin.Tag>
TreadAnyTag(io.netty.buffer.ByteBuf buf, Class<T> expected) @NotNull com.github.steveice10.opennbt.tag.builtin.CompoundTagreadAnyTagOrThrow(io.netty.buffer.ByteBuf buf) readBlockBreakStage(io.netty.buffer.ByteBuf buf) @NotNull 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, int globalBiomePaletteBits) net.kyori.adventure.text.ComponentreadComponent(io.netty.buffer.ByteBuf buf) readDataPalette(io.netty.buffer.ByteBuf buf, PaletteType paletteType, int globalPaletteBits) 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) @Nullable ItemStackreadItemStack(io.netty.buffer.ByteBuf buf) readLevelEvent(io.netty.buffer.ByteBuf buf) readLightUpdateData(io.netty.buffer.ByteBuf buf) 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,E extends Throwable>
TreadNullable(io.netty.buffer.ByteBuf buf, CheckedFunction<io.netty.buffer.ByteBuf, T, E> ifPresent) readNumberFormat(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) readResourceLocation(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) readUUID(io.netty.buffer.ByteBuf buf) readVillagerData(io.netty.buffer.ByteBuf buf) voidsetRegistry(com.github.steveice10.opennbt.tag.builtin.CompoundTag registry) <T extends com.github.steveice10.opennbt.tag.builtin.Tag>
voidwriteAnyTag(io.netty.buffer.ByteBuf buf, T tag) 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) 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) voidwriteItemStack(io.netty.buffer.ByteBuf buf, ItemStack item) voidwriteLevelEvent(io.netty.buffer.ByteBuf buf, LevelEvent event) voidwriteLightUpdateData(io.netty.buffer.ByteBuf buf, LightUpdateData data) 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,E extends Throwable>
voidwriteNullable(io.netty.buffer.ByteBuf buf, T value, CheckedBiConsumer<io.netty.buffer.ByteBuf, T, E> ifPresent) voidwriteNumberFormat(io.netty.buffer.ByteBuf buf, NumberFormat numberFormat) 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, String 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) voidvoidwriteVillagerData(io.netty.buffer.ByteBuf buf, VillagerData villagerData) Methods inherited from class com.github.steveice10.packetlib.codec.BasePacketCodecHelper
readString, readString, readVarInt, readVarLong, writeString, writeVarInt, writeVarLong
-
Constructor Details
-
MinecraftCodecHelper
public MinecraftCodecHelper()
-
-
Method Details
-
readNullable
@Nullable public <T,E extends Throwable> T readNullable(io.netty.buffer.ByteBuf buf, CheckedFunction<io.netty.buffer.ByteBuf, T, throws EE> ifPresent) - Throws:
E extends Throwable
-
writeNullable
public <T,E extends Throwable> void writeNullable(io.netty.buffer.ByteBuf buf, @Nullable T value, CheckedBiConsumer<io.netty.buffer.ByteBuf, T, throws EE> ifPresent) - Throws:
E extends Throwable
-
readResourceLocation
-
writeResourceLocation
-
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) -
readAnyTag
@Nullable public @Nullable com.github.steveice10.opennbt.tag.builtin.CompoundTag readAnyTag(io.netty.buffer.ByteBuf buf) throws IOException - Throws:
IOException
-
readAnyTagOrThrow
@NotNull public @NotNull com.github.steveice10.opennbt.tag.builtin.CompoundTag readAnyTagOrThrow(io.netty.buffer.ByteBuf buf) throws IOException - Throws:
IOException
-
readAnyTag
@Nullable public <T extends com.github.steveice10.opennbt.tag.builtin.Tag> T readAnyTag(io.netty.buffer.ByteBuf buf, Class<T> expected) throws IOException - Throws:
IOException
-
writeAnyTag
public <T extends com.github.steveice10.opennbt.tag.builtin.Tag> void writeAnyTag(io.netty.buffer.ByteBuf buf, @Nullable T tag) throws IOException - Throws:
IOException
-
readItemStack
- Throws:
IOException
-
writeItemStack
- Throws:
IOException
-
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
-
readComponent
public net.kyori.adventure.text.Component readComponent(io.netty.buffer.ByteBuf buf) throws IOException - Throws:
IOException
-
writeComponent
public void writeComponent(io.netty.buffer.ByteBuf buf, net.kyori.adventure.text.Component component) throws IOException - Throws:
IOException
-
readEntityMetadata
- Throws:
IOException
-
writeEntityMetadata
public void writeEntityMetadata(io.netty.buffer.ByteBuf buf, EntityMetadata<?, ?>[] metadata) throws IOException- Throws:
IOException
-
readMetadata
- Throws:
IOException
-
writeMetadata
public void writeMetadata(io.netty.buffer.ByteBuf buf, EntityMetadata<?, ?> metadata) throws IOException- Throws:
IOException
-
readMetadataType
-
writeMetadataType
-
readGlobalPos
-
writeGlobalPos
-
readPlayerSpawnInfo
-
writePlayerSpawnInfo
-
readParticleType
-
writeParticleType
-
readParticle
- Throws:
IOException
-
writeParticle
- Throws:
IOException
-
readParticleData
public ParticleData readParticleData(io.netty.buffer.ByteBuf buf, ParticleType type) throws IOException - Throws:
IOException
-
writeParticleData
public void writeParticleData(io.netty.buffer.ByteBuf buf, ParticleType type, ParticleData data) throws IOException - Throws:
IOException
-
readNumberFormat
- Throws:
IOException
-
writeNumberFormat
public void writeNumberFormat(io.netty.buffer.ByteBuf buf, NumberFormat numberFormat) throws IOException - Throws:
IOException
-
readPositionSource
-
writePositionSource
-
readVillagerData
-
writeVillagerData
-
readModifierOperation
-
writeModifierOperation
-
readEffect
-
writeEffect
-
readBlockBreakStage
-
writeBlockBreakStage
-
readBlockEntityType
-
writeBlockEntityType
-
readLightUpdateData
-
writeLightUpdateData
-
readLevelEvent
-
writeLevelEvent
-
readStatisticCategory
-
writeStatisticCategory
-
readSoundCategory
-
writeSoundCategory
-
getBuiltinSound
-
readEntityEvent
-
writeEntityEvent
-
readRecipeIngredient
- Throws:
IOException
-
writeRecipeIngredient
public void writeRecipeIngredient(io.netty.buffer.ByteBuf buf, Ingredient ingredient) throws IOException - Throws:
IOException
-
readDataPalette
public DataPalette readDataPalette(io.netty.buffer.ByteBuf buf, PaletteType paletteType, int globalPaletteBits) throws IOException - Throws:
IOException
-
writeDataPalette
-
readChunkSection
public ChunkSection readChunkSection(io.netty.buffer.ByteBuf buf, int globalBiomePaletteBits) throws IOException - Throws:
IOException
-
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
@Nullable public @Nullable com.github.steveice10.opennbt.tag.builtin.CompoundTag 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(com.github.steveice10.opennbt.tag.builtin.CompoundTag registry)
-