Class PacketWrapper<T extends PacketWrapper<T>>
java.lang.Object
com.github.retrooper.packetevents.wrapper.PacketWrapper<T>
- Direct Known Subclasses:
WrapperCommonCookieResponse,WrapperConfigClientConfigurationEndAck,WrapperConfigClientKeepAlive,WrapperConfigClientPluginMessage,WrapperConfigClientPong,WrapperConfigClientResourcePackStatus,WrapperConfigClientSelectKnownPacks,WrapperConfigClientSettings,WrapperConfigServerConfigurationEnd,WrapperConfigServerCookieRequest,WrapperConfigServerDisconnect,WrapperConfigServerKeepAlive,WrapperConfigServerPluginMessage,WrapperConfigServerRegistryData,WrapperConfigServerResetChat,WrapperConfigServerResourcePackRemove,WrapperConfigServerResourcePackSend,WrapperConfigServerSelectKnownPacks,WrapperConfigServerStoreCookie,WrapperConfigServerTransfer,WrapperConfigServerUpdateEnabledFeatures,WrapperHandshakingClientHandshake,WrapperLoginClientEncryptionResponse,WrapperLoginClientLoginStart,WrapperLoginClientLoginSuccessAck,WrapperLoginClientPluginResponse,WrapperLoginServerCookieRequest,WrapperLoginServerDisconnect,WrapperLoginServerEncryptionRequest,WrapperLoginServerLoginSuccess,WrapperLoginServerPluginRequest,WrapperLoginServerSetCompression,WrapperPlayClientAdvancementTab,WrapperPlayClientAnimation,WrapperPlayClientChatAck,WrapperPlayClientChatCommand,WrapperPlayClientChatCommandUnsigned,WrapperPlayClientChatMessage,WrapperPlayClientChatPreview,WrapperPlayClientChatSessionUpdate,WrapperPlayClientChunkBatchAck,WrapperPlayClientClickWindow,WrapperPlayClientClickWindowButton,WrapperPlayClientClientStatus,WrapperPlayClientCloseWindow,WrapperPlayClientConfigurationAck,WrapperPlayClientCraftRecipeRequest,WrapperPlayClientCreativeInventoryAction,WrapperPlayClientDebugPing,WrapperPlayClientDebugSampleSubscription,WrapperPlayClientEditBook,WrapperPlayClientEntityAction,WrapperPlayClientGenerateStructure,WrapperPlayClientHeldItemChange,WrapperPlayClientInteractEntity,WrapperPlayClientKeepAlive,WrapperPlayClientLockDifficulty,WrapperPlayClientNameItem,WrapperPlayClientPickItem,WrapperPlayClientPlayerAbilities,WrapperPlayClientPlayerBlockPlacement,WrapperPlayClientPlayerDigging,WrapperPlayClientPlayerFlying,WrapperPlayClientPluginMessage,WrapperPlayClientPong,WrapperPlayClientQueryBlockNBT,WrapperPlayClientQueryEntityNBT,WrapperPlayClientResourcePackStatus,WrapperPlayClientSelectTrade,WrapperPlayClientSetBeaconEffect,WrapperPlayClientSetDifficulty,WrapperPlayClientSetDisplayedRecipe,WrapperPlayClientSetRecipeBookState,WrapperPlayClientSettings,WrapperPlayClientSlotStateChange,WrapperPlayClientSpectate,WrapperPlayClientSteerBoat,WrapperPlayClientSteerVehicle,WrapperPlayClientTabComplete,WrapperPlayClientTeleportConfirm,WrapperPlayClientUpdateCommandBlock,WrapperPlayClientUpdateCommandBlockMinecart,WrapperPlayClientUpdateJigsawBlock,WrapperPlayClientUpdateSign,WrapperPlayClientUseItem,WrapperPlayClientVehicleMove,WrapperPlayClientWindowConfirmation,WrapperPlayServerAcknowledgeBlockChanges,WrapperPlayServerAcknowledgePlayerDigging,WrapperPlayServerActionBar,WrapperPlayServerAttachEntity,WrapperPlayServerBlockAction,WrapperPlayServerBlockBreakAnimation,WrapperPlayServerBlockChange,WrapperPlayServerBlockEntityData,WrapperPlayServerBundle,WrapperPlayServerCamera,WrapperPlayServerChangeGameState,WrapperPlayServerChatMessage,WrapperPlayServerChatPreview,WrapperPlayServerChunkBatchBegin,WrapperPlayServerChunkBatchEnd,WrapperPlayServerChunkData,WrapperPlayServerChunkDataBulk,WrapperPlayServerClearTitles,WrapperPlayServerCloseWindow,WrapperPlayServerCollectItem,WrapperPlayServerCombatEvent,WrapperPlayServerConfigurationStart,WrapperPlayServerCookieRequest,WrapperPlayServerCraftRecipeResponse,WrapperPlayServerCustomChatCompletions,WrapperPlayServerDeathCombatEvent,WrapperPlayServerDebugPong,WrapperPlayServerDebugSample,WrapperPlayServerDeclareCommands,WrapperPlayServerDeclareRecipes,WrapperPlayServerDeleteChat,WrapperPlayServerDestroyEntities,WrapperPlayServerDifficulty,WrapperPlayServerDisconnect,WrapperPlayServerDisguisedChat,WrapperPlayServerDisplayScoreboard,WrapperPlayServerEndCombatEvent,WrapperPlayServerEnterCombatEvent,WrapperPlayServerEntityAnimation,WrapperPlayServerEntityEffect,WrapperPlayServerEntityEquipment,WrapperPlayServerEntityHeadLook,WrapperPlayServerEntityMetadata,WrapperPlayServerEntityMovement,WrapperPlayServerEntityRelativeMove,WrapperPlayServerEntityRelativeMoveAndRotation,WrapperPlayServerEntityRotation,WrapperPlayServerEntitySoundEffect,WrapperPlayServerEntityStatus,WrapperPlayServerEntityTeleport,WrapperPlayServerEntityVelocity,WrapperPlayServerExplosion,WrapperPlayServerFacePlayer,WrapperPlayServerHeldItemChange,WrapperPlayServerHurtAnimation,WrapperPlayServerInitializeWorldBorder,WrapperPlayServerJoinGame,WrapperPlayServerKeepAlive,WrapperPlayServerMerchantOffers,WrapperPlayServerMultiBlockChange,WrapperPlayServerNBTQueryResponse,WrapperPlayServerOpenBook,WrapperPlayServerOpenHorseWindow,WrapperPlayServerOpenSignEditor,WrapperPlayServerOpenWindow,WrapperPlayServerParticle,WrapperPlayServerPing,WrapperPlayServerPlayerAbilities,WrapperPlayServerPlayerChatHeader,WrapperPlayServerPlayerInfo,WrapperPlayServerPlayerInfoRemove,WrapperPlayServerPlayerInfoUpdate,WrapperPlayServerPlayerListHeaderAndFooter,WrapperPlayServerPlayerPositionAndLook,WrapperPlayServerPluginMessage,WrapperPlayServerProjectilePower,WrapperPlayServerRemoveEntityEffect,WrapperPlayServerResetScore,WrapperPlayServerResourcePackRemove,WrapperPlayServerResourcePackSend,WrapperPlayServerRespawn,WrapperPlayServerScoreboardObjective,WrapperPlayServerSelectAdvancementsTab,WrapperPlayServerServerData,WrapperPlayServerSetCompression,WrapperPlayServerSetCooldown,WrapperPlayServerSetDisplayChatPreview,WrapperPlayServerSetExperience,WrapperPlayServerSetPassengers,WrapperPlayServerSetSlot,WrapperPlayServerSetTitleSubtitle,WrapperPlayServerSetTitleText,WrapperPlayServerSetTitleTimes,WrapperPlayServerSoundEffect,WrapperPlayServerSpawnEntity,WrapperPlayServerSpawnExperienceOrb,WrapperPlayServerSpawnLivingEntity,WrapperPlayServerSpawnPainting,WrapperPlayServerSpawnPlayer,WrapperPlayServerSpawnPosition,WrapperPlayServerSpawnWeatherEntity,WrapperPlayServerStoreCookie,WrapperPlayServerSystemChatMessage,WrapperPlayServerTabComplete,WrapperPlayServerTags,WrapperPlayServerTeams,WrapperPlayServerTickingState,WrapperPlayServerTickingStep,WrapperPlayServerTimeUpdate,WrapperPlayServerTitle,WrapperPlayServerTransfer,WrapperPlayServerUnloadChunk,WrapperPlayServerUpdateAttributes,WrapperPlayServerUpdateEnabledFeatures,WrapperPlayServerUpdateEntityNBT,WrapperPlayServerUpdateHealth,WrapperPlayServerUpdateScore,WrapperPlayServerUpdateSimulationDistance,WrapperPlayServerUpdateViewDistance,WrapperPlayServerUpdateViewPosition,WrapperPlayServerUseBed,WrapperPlayServerVehicleMove,WrapperPlayServerWindowConfirmation,WrapperPlayServerWindowItems,WrapperPlayServerWindowProperty,WrapperPlayServerWorldBorder,WrapperPlayServerWorldBorderCenter,WrapperPlayServerWorldBorderSize,WrapperPlayWorldBorderLerpSize,WrapperPlayWorldBorderWarningDelay,WrapperPlayWorldBorderWarningReach,WrapperStatusClientPing,WrapperStatusClientRequest,WrapperStatusServerPong,WrapperStatusServerResponse
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interface -
Field Summary
FieldsModifier and TypeFieldDescription@Nullable Objectprotected ClientVersionprotected ServerVersionprotected @Nullable User -
Constructor Summary
ConstructorsConstructorDescriptionPacketWrapper(int packetID) PacketWrapper(int packetID, ClientVersion clientVersion) PacketWrapper(PacketReceiveEvent event) PacketWrapper(PacketReceiveEvent event, boolean readData) PacketWrapper(PacketSendEvent event) PacketWrapper(PacketSendEvent event, boolean readData) PacketWrapper(PacketTypeCommon packetType) PacketWrapper(ClientVersion clientVersion, ServerVersion serverVersion, int packetID) -
Method Summary
Modifier and TypeMethodDescriptionvoidstatic PacketWrapper<?>createUniversalPacketWrapper(Object byteBuf) static longgetChunkKey(int chunkX, int chunkZ) static intgetChunkX(long chunkKey) static intgetChunkZ(long chunkKey) intintintDeprecated.static <K> IntFunction<K>limitValue(IntFunction<K> function, int limit) final voidprepareForSend(Object channel, boolean outgoing) final voidprepareForSend(Object channel, boolean outgoing, boolean proxy) voidread()booleanbytereadByte()byte[]byte[]readByteArray(int maxLength) byte[]readByteArrayOfSize(int size) byte[]readBytes(int size) <K,C extends Collection<K>>
CreadCollection(IntFunction<C> function, PacketWrapper.Reader<K> reader) net.kyori.adventure.text.Componentnet.kyori.adventure.text.Componentnet.kyori.adventure.text.ComponentDeprecated.double<Z extends Enum<?>>
Z<Z extends Enum<?>>
ZreadEnum(Z[] values) readEnumSet(Class<T> enumClazz) final voidreadEvent(ProtocolPacketEvent<?> event) floatreadIdentifier(int maxLen) intreadInt()@NotNull ItemStack<K> List<K>readList(PacketWrapper.Reader<K> reader) longreadLong()long[]long[]readLongArray(int size) <K,V> Map<K, V> readMap(PacketWrapper.Reader<K> keyFunction, PacketWrapper.Reader<V> valueFunction) <Z extends MappedEntity>
ZreadMappedEntity(BiFunction<ClientVersion, Integer, Z> getter) <Z extends MappedEntity>
ZreadMappedEntityOrDirect(BiFunction<ClientVersion, Integer, Z> getter, PacketWrapper.Reader<Z> directReader) <U,V, R> U readMultiVersional(VersionComparison version, ServerVersion target, PacketWrapper.Reader<V> first, PacketWrapper.Reader<R> second) readNBT()readNode()<R> RreadOptional(PacketWrapper.Reader<R> reader) byte[]shortreadString(int maxLen) net.kyori.adventure.text.format.StyleshortintreadUUID()intint[]int[]readVarIntArrayOfSize(int size) longintvoidvoidDeprecated.voidsetClientVersion(ClientVersion clientVersion) voidsetNativePacketId(int nativePacketId) voidsetPacketId(int packetID) Deprecated.voidsetServerVersion(ServerVersion serverVersion) voidwrite()voidwriteBitSet(BitSet bitSet) voidvoidwriteBoolean(boolean value) voidwriteByte(int value) voidwriteByteArray(byte[] array) voidwriteByteArrayOfSize(byte[] array) voidwriteBytes(byte[] array) void<K> voidwriteCollection(Collection<K> collection, PacketWrapper.Writer<K> writer) voidwriteComponent(net.kyori.adventure.text.Component component) voidwriteComponentAsJSON(net.kyori.adventure.text.Component component) voidwriteComponentAsNBT(net.kyori.adventure.text.Component component) voidwriteComponentJSON(String json) Deprecated.voidwriteDimension(Dimension dimension) voidwriteDouble(double value) voidwriteEntityMetadata(EntityMetadataProvider metadata) voidwriteEntityMetadata(List<EntityData> list) void<T extends Enum<T>>
voidwriteEnumSet(EnumSet<T> set, Class<T> enumClazz) voidwriteFilterMask(FilterMask filterMask) voidwriteFloat(float value) voidwriteGameMode(@Nullable GameMode mode) voidwriteIdentifier(ResourceLocation identifier) voidwriteIdentifier(ResourceLocation identifier, int maxLen) voidwriteInt(int value) voidwriteItemStack(ItemStack itemStack) voidwriteItemStackModern(ItemStack itemStack) voidwriteKnownPack(KnownPack knownPack) voidvoidwriteLastSeenMessages(LastSeenMessages lastSeenMessages) voidwriteLastSeenMessagesPacked(LastSeenMessages.Packed lastSeenMessagesPacked) voidvoid<K> voidwriteList(List<K> list, PacketWrapper.Writer<K> writer) voidwriteLong(long value) voidwriteLongArray(long[] array) <K,V> void writeMap(Map<K, V> map, PacketWrapper.Writer<K> keyConsumer, PacketWrapper.Writer<V> valueConsumer) voidwriteMappedEntity(MappedEntity entity) <Z extends MappedEntity>
voidwriteMappedEntityOrDirect(Z entity, PacketWrapper.Writer<Z> writer) voidvoidwriteMessageSignaturePacked(MessageSignature.Packed messageSignaturePacked) <V> voidwriteMultiVersional(VersionComparison version, ServerVersion target, V value, PacketWrapper.Writer<V> first, PacketWrapper.Writer<V> second) voidwriteNBT(NBTCompound nbt) voidwriteNBTRaw(NBT nbt) void<V> voidwriteOptional(V value, PacketWrapper.Writer<V> writer) voidwritePresentItemStack(ItemStack itemStack) voidwritePublicKey(PublicKey publicKey) voidvoidwriteRemoteChatSession(RemoteChatSession chatSession) voidwriteSaltSignature(SaltSignature signature) voidwriteShort(int value) voidwriteSignatureData(SignatureData signatureData) voidwriteSignedCommandArguments(List<SignedCommandArgument> signedArguments) voidvoidwriteString(String s, int maxLen) voidwriteString(String s, int maxLen, boolean substr) voidwriteStyle(net.kyori.adventure.text.format.Style style) voidwriteTimestamp(Instant timestamp) voidvoidwriteVarInt(int value) voidwriteVarIntArray(int[] array) voidwriteVarIntArrayOfSize(int[] array) voidwriteVarLong(long l) voidwriteVarShort(int value) voidvoid
-
Field Details
-
buffer
-
clientVersion
-
serverVersion
-
user
-
-
Constructor Details
-
PacketWrapper
-
PacketWrapper
-
PacketWrapper
-
PacketWrapper
-
PacketWrapper
-
PacketWrapper
-
PacketWrapper
public PacketWrapper(int packetID) -
PacketWrapper
-
-
Method Details
-
createUniversalPacketWrapper
-
getChunkX
public static int getChunkX(long chunkKey) -
getChunkZ
public static int getChunkZ(long chunkKey) -
getChunkKey
public static long getChunkKey(int chunkX, int chunkZ) -
prepareForSend
-
prepareForSend
-
read
public void read() -
write
public void write() -
copy
-
readEvent
-
getClientVersion
-
setClientVersion
-
getServerVersion
-
setServerVersion
-
getBuffer
-
getPacketId
Deprecated.Gets the Packet ID for the current platform version- Returns:
- Packet ID
-
setPacketId
Deprecated.Sets the Packet ID for the current platform version -
getNativePacketId
public int getNativePacketId() -
setNativePacketId
public void setNativePacketId(int nativePacketId) -
getPacketTypeData
-
getMaxMessageLength
public int getMaxMessageLength() -
resetByteBuf
Deprecated. -
resetBuffer
public void resetBuffer() -
readByte
public byte readByte() -
writeByte
public void writeByte(int value) -
readUnsignedByte
public short readUnsignedByte() -
readBoolean
public boolean readBoolean() -
writeBoolean
public void writeBoolean(boolean value) -
readInt
public int readInt() -
writeInt
public void writeInt(int value) -
readVarInt
public int readVarInt() -
writeVarInt
public void writeVarInt(int value) -
readMap
public <K,V> Map<K,V> readMap(PacketWrapper.Reader<K> keyFunction, PacketWrapper.Reader<V> valueFunction) -
writeMap
public <K,V> void writeMap(Map<K, V> map, PacketWrapper.Writer<K> keyConsumer, PacketWrapper.Writer<V> valueConsumer) -
readVillagerData
-
writeVillagerData
-
readItemStackModern
-
readPresentItemStack
-
readItemStack
-
writeItemStackModern
-
writePresentItemStack
-
writeItemStack
-
readNBT
-
readNBTRaw
-
writeNBT
-
writeNBTRaw
-
readString
-
readString
-
readComponentJSON
Deprecated. -
writeString
-
writeString
-
writeString
-
writeComponentJSON
Deprecated. -
readComponent
public net.kyori.adventure.text.Component readComponent() -
readComponentAsNBT
public net.kyori.adventure.text.Component readComponentAsNBT() -
readComponentAsJSON
public net.kyori.adventure.text.Component readComponentAsJSON() -
writeComponent
public void writeComponent(net.kyori.adventure.text.Component component) -
writeComponentAsNBT
public void writeComponentAsNBT(net.kyori.adventure.text.Component component) -
writeComponentAsJSON
public void writeComponentAsJSON(net.kyori.adventure.text.Component component) -
readStyle
public net.kyori.adventure.text.format.Style readStyle() -
writeStyle
public void writeStyle(net.kyori.adventure.text.format.Style style) -
readIdentifier
-
readIdentifier
-
writeIdentifier
-
writeIdentifier
-
readUnsignedShort
public int readUnsignedShort() -
readShort
public short readShort() -
writeShort
public void writeShort(int value) -
readVarShort
public int readVarShort() -
writeVarShort
public void writeVarShort(int value) -
readLong
public long readLong() -
writeLong
public void writeLong(long value) -
readVarLong
public long readVarLong() -
writeVarLong
public void writeVarLong(long l) -
readFloat
public float readFloat() -
writeFloat
public void writeFloat(float value) -
readDouble
public double readDouble() -
writeDouble
public void writeDouble(double value) -
readRemainingBytes
public byte[] readRemainingBytes() -
readBytes
public byte[] readBytes(int size) -
writeBytes
public void writeBytes(byte[] array) -
readByteArray
public byte[] readByteArray(int maxLength) -
readByteArray
public byte[] readByteArray() -
writeByteArray
public void writeByteArray(byte[] array) -
readVarIntArray
public int[] readVarIntArray() -
writeVarIntArray
public void writeVarIntArray(int[] array) -
readLongArray
public long[] readLongArray(int size) -
readByteArrayOfSize
public byte[] readByteArrayOfSize(int size) -
writeByteArrayOfSize
public void writeByteArrayOfSize(byte[] array) -
readVarIntArrayOfSize
public int[] readVarIntArrayOfSize(int size) -
writeVarIntArrayOfSize
public void writeVarIntArrayOfSize(int[] array) -
readLongArray
public long[] readLongArray() -
writeLongArray
public void writeLongArray(long[] array) -
readUUID
-
writeUUID
-
readBlockPosition
-
writeBlockPosition
-
readGameMode
-
writeGameMode
-
readEntityMetadata
-
writeEntityMetadata
-
writeEntityMetadata
-
readDimension
-
writeDimension
-
readSaltSignature
-
writeSaltSignature
-
readPublicKey
-
writePublicKey
-
readPublicProfileKey
-
writePublicProfileKey
-
readRemoteChatSession
-
writeRemoteChatSession
-
readTimestamp
-
writeTimestamp
-
readSignatureData
-
writeSignatureData
-
limitValue
-
readWorldBlockPosition
-
writeWorldBlockPosition
-
readLastSeenMessagesEntry
-
writeLastMessagesEntry
-
readLastSeenMessagesUpdate
-
writeLastSeenMessagesUpdate
-
readLegacyLastSeenMessagesUpdate
-
writeLegacyLastSeenMessagesUpdate
-
readMessageSignaturePacked
-
writeMessageSignaturePacked
-
readLastSeenMessagesPacked
-
writeLastSeenMessagesPacked
-
readLastSeenMessages
-
writeLastSeenMessages
-
readSignedCommandArguments
-
writeSignedCommandArguments
-
readBitSet
-
writeBitSet
-
readFilterMask
-
writeFilterMask
-
readMerchantOffer
-
writeMerchantOffer
-
readChatTypeBoundNetwork
-
writeChatTypeBoundNetwork
-
readNode
-
writeNode
-
readKnownPack
-
writeKnownPack
-
readEnumSet
-
writeEnumSet
-
readMultiVersional
@Experimental public <U,V, U readMultiVersionalR> (VersionComparison version, ServerVersion target, PacketWrapper.Reader<V> first, PacketWrapper.Reader<R> second) -
writeMultiVersional
@Experimental public <V> void writeMultiVersional(VersionComparison version, ServerVersion target, V value, PacketWrapper.Writer<V> first, PacketWrapper.Writer<V> second) -
readOptional
-
writeOptional
-
readCollection
public <K,C extends Collection<K>> C readCollection(IntFunction<C> function, PacketWrapper.Reader<K> reader) -
writeCollection
-
readList
-
writeList
-
readEnum
-
readEnum
-
writeEnum
-
readMappedEntity
-
readMappedEntityOrDirect
public <Z extends MappedEntity> Z readMappedEntityOrDirect(BiFunction<ClientVersion, Integer, Z> getter, PacketWrapper.Reader<Z> directReader) -
writeMappedEntity
-
writeMappedEntityOrDirect
public <Z extends MappedEntity> void writeMappedEntityOrDirect(Z entity, PacketWrapper.Writer<Z> writer)
-
getNativePacketId()