PocketMine-MP
5.25.3 git-afc4a3c7f18d42b41cbfde84ab6a2e4dd7c03045
Toggle main menu visibility
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
g
i
m
n
o
p
r
s
t
Functions
Variables
Enumerations
Enumerator
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Variables
$
a
c
d
e
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
Files
File List
▼
PocketMine-MP
PocketMine-MP API Documentation
Deprecated List
►
Namespaces
►
Classes
▼
Files
▼
File List
►
src
▼
vendor
▼
pocketmine
►
bedrock-data
▼
bedrock-protocol
▼
src
▼
serializer
BitSet.php
ItemTypeDictionary.php
NetworkNbtSerializer.php
PacketBatch.php
bedrock-protocol/src/serializer/PacketSerializer.php
►
types
ActorEventPacket.php
ActorPickRequestPacket.php
AddActorPacket.php
AddBehaviorTreePacket.php
AddItemActorPacket.php
AddPaintingPacket.php
AddPlayerPacket.php
AddVolumeEntityPacket.php
AgentActionEventPacket.php
AgentAnimationPacket.php
AnimateEntityPacket.php
AnimatePacket.php
AnvilDamagePacket.php
AutomationClientConnectPacket.php
AvailableActorIdentifiersPacket.php
AvailableCommandsPacket.php
AwardAchievementPacket.php
BiomeDefinitionListPacket.php
BlockActorDataPacket.php
BlockEventPacket.php
BlockPickRequestPacket.php
BookEditPacket.php
BossEventPacket.php
CameraAimAssistInstructionPacket.php
CameraAimAssistPacket.php
CameraAimAssistPresetsPacket.php
CameraInstructionPacket.php
CameraPacket.php
CameraPresetsPacket.php
CameraShakePacket.php
ChangeDimensionPacket.php
ChangeMobPropertyPacket.php
ChunkRadiusUpdatedPacket.php
ClientboundCloseFormPacket.php
ClientboundDebugRendererPacket.php
ClientboundMapItemDataPacket.php
ClientboundPacket.php
ClientCacheBlobStatusPacket.php
ClientCacheMissResponsePacket.php
ClientCacheStatusPacket.php
ClientToServerHandshakePacket.php
CodeBuilderPacket.php
CodeBuilderSourcePacket.php
CommandBlockUpdatePacket.php
CommandOutputPacket.php
CommandRequestPacket.php
CompletedUsingItemPacket.php
CompressedBiomeDefinitionListPacket.php
ContainerClosePacket.php
ContainerOpenPacket.php
ContainerRegistryCleanupPacket.php
ContainerSetDataPacket.php
CorrectPlayerMovePredictionPacket.php
CraftingDataPacket.php
CreatePhotoPacket.php
CreativeContentPacket.php
CurrentStructureFeaturePacket.php
DataPacket.php
DeathInfoPacket.php
DebugInfoPacket.php
DimensionDataPacket.php
DisconnectPacket.php
EditorNetworkPacket.php
EducationSettingsPacket.php
EduUriResourcePacket.php
EmoteListPacket.php
EmotePacket.php
FeatureRegistryPacket.php
GameRulesChangedPacket.php
GameTestRequestPacket.php
GameTestResultsPacket.php
GuiDataPickItemPacket.php
HurtArmorPacket.php
InteractPacket.php
InventoryContentPacket.php
InventorySlotPacket.php
InventoryTransactionPacket.php
ItemRegistryPacket.php
ItemStackRequestPacket.php
ItemStackResponsePacket.php
JigsawStructureDataPacket.php
LabTablePacket.php
LecternUpdatePacket.php
LegacyTelemetryEventPacket.php
LessonProgressPacket.php
LevelChunkPacket.php
LevelEventGenericPacket.php
LevelEventPacket.php
LevelSoundEventPacket.php
LevelSoundEventPacketV1.php
LevelSoundEventPacketV2.php
LoginPacket.php
MapCreateLockedCopyPacket.php
MapInfoRequestPacket.php
MobArmorEquipmentPacket.php
MobEffectPacket.php
MobEquipmentPacket.php
ModalFormRequestPacket.php
ModalFormResponsePacket.php
MotionPredictionHintsPacket.php
MoveActorAbsolutePacket.php
MoveActorDeltaPacket.php
MovementEffectPacket.php
MovementPredictionSyncPacket.php
MovePlayerPacket.php
MultiplayerSettingsPacket.php
NetworkChunkPublisherUpdatePacket.php
NetworkSettingsPacket.php
NetworkStackLatencyPacket.php
NpcDialoguePacket.php
NpcRequestPacket.php
OnScreenTextureAnimationPacket.php
OpenSignPacket.php
bedrock-protocol/src/Packet.php
PacketDecodeException.php
PacketHandlerDefaultImplTrait.php
PacketHandlerInterface.php
PacketPool.php
PacketViolationWarningPacket.php
PassengerJumpPacket.php
PhotoTransferPacket.php
PlayerActionPacket.php
PlayerArmorDamagePacket.php
PlayerAuthInputPacket.php
PlayerAuthInputVehicleInfo.php
PlayerEnchantOptionsPacket.php
PlayerFogPacket.php
PlayerHotbarPacket.php
PlayerInputPacket.php
PlayerListPacket.php
PlayerSkinPacket.php
PlayerStartItemCooldownPacket.php
PlayerToggleCrafterSlotRequestPacket.php
PlaySoundPacket.php
PlayStatusPacket.php
PositionTrackingDBClientRequestPacket.php
PositionTrackingDBServerBroadcastPacket.php
ProtocolInfo.php
PurchaseReceiptPacket.php
RefreshEntitlementsPacket.php
RemoveActorPacket.php
RemoveObjectivePacket.php
RemoveVolumeEntityPacket.php
RequestAbilityPacket.php
RequestChunkRadiusPacket.php
RequestNetworkSettingsPacket.php
RequestPermissionsPacket.php
ResourcePackChunkDataPacket.php
ResourcePackChunkRequestPacket.php
ResourcePackClientResponsePacket.php
ResourcePackDataInfoPacket.php
ResourcePacksInfoPacket.php
ResourcePackStackPacket.php
RespawnPacket.php
ScriptMessagePacket.php
ServerboundDiagnosticsPacket.php
ServerboundLoadingScreenPacket.php
ServerboundPacket.php
ServerPlayerPostMovePositionPacket.php
ServerSettingsRequestPacket.php
ServerSettingsResponsePacket.php
ServerStatsPacket.php
ServerToClientHandshakePacket.php
SetActorDataPacket.php
SetActorLinkPacket.php
SetActorMotionPacket.php
SetCommandsEnabledPacket.php
SetDefaultGameTypePacket.php
SetDifficultyPacket.php
SetDisplayObjectivePacket.php
SetHealthPacket.php
SetHudPacket.php
SetLastHurtByPacket.php
SetLocalPlayerAsInitializedPacket.php
SetMovementAuthorityPacket.php
SetPlayerGameTypePacket.php
SetPlayerInventoryOptionsPacket.php
SetScoreboardIdentityPacket.php
SetScorePacket.php
SetSpawnPositionPacket.php
SetTimePacket.php
SettingsCommandPacket.php
SetTitlePacket.php
ShowCreditsPacket.php
ShowProfilePacket.php
ShowStoreOfferPacket.php
SimpleEventPacket.php
SimulationTypePacket.php
SpawnExperienceOrbPacket.php
SpawnParticleEffectPacket.php
StartGamePacket.php
StopSoundPacket.php
StructureBlockUpdatePacket.php
StructureTemplateDataRequestPacket.php
StructureTemplateDataResponsePacket.php
SubChunkPacket.php
SubChunkRequestPacket.php
SubClientLoginPacket.php
SyncActorPropertyPacket.php
TakeItemActorPacket.php
TextPacket.php
TickingAreasLoadStatusPacket.php
ToastRequestPacket.php
TransferPacket.php
TrimDataPacket.php
UnlockedRecipesPacket.php
UpdateAbilitiesPacket.php
UpdateAdventureSettingsPacket.php
UpdateAttributesPacket.php
UpdateBlockPacket.php
UpdateBlockSyncedPacket.php
UpdateClientInputLocksPacket.php
UpdateEquipPacket.php
UpdatePlayerGameTypePacket.php
UpdateSoftEnumPacket.php
UpdateSubChunkBlocksPacket.php
UpdateTradePacket.php
►
tools
bedrock-protocol/.php-cs-fixer.php
►
binaryutils
►
callback-validator
►
color
►
errorhandler
►
log
►
math
►
nbt
►
raklib
►
raklib-ipc
►
snooze
•
All
Classes
Namespaces
Functions
Variables
Enumerations
Enumerator
Pages
Loading...
Searching...
No Matches
PacketBatch.php
1
<?php
2
3
/*
4
* This file is part of BedrockProtocol.
5
* Copyright (C) 2014-2022 PocketMine Team <https://github.com/pmmp/BedrockProtocol>
6
*
7
* BedrockProtocol is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU Lesser General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
11
*/
12
13
declare(strict_types=1);
14
15
namespace
pocketmine\network\mcpe\protocol\serializer;
16
17
use
pocketmine\network\mcpe\protocol\Packet
;
18
use
pocketmine\network\mcpe\protocol\PacketDecodeException
;
19
use
pocketmine\network\mcpe\protocol\PacketPool
;
20
use
pocketmine\utils\BinaryDataException
;
21
use
pocketmine\utils\BinaryStream
;
22
use
function
strlen;
23
24
class
PacketBatch
{
25
26
private
function
__construct(){
27
//NOOP
28
}
29
34
final
public
static
function
decodeRaw
(
BinaryStream
$stream) : \
Generator
{
35
$c = 0;
36
while
(!$stream->
feof
()){
37
try
{
38
$length = $stream->
getUnsignedVarInt
();
39
$buffer = $stream->
get
($length);
40
}
catch
(
BinaryDataException
$e){
41
throw
new
PacketDecodeException
(
"Error decoding packet $c in batch: "
. $e->getMessage(), 0, $e);
42
}
43
yield $buffer;
44
$c++;
45
}
46
}
34
final
public
static
function
decodeRaw
(
BinaryStream
$stream) : \
Generator
{
…
}
47
52
final
public
static
function
encodeRaw
(
BinaryStream
$stream, array $packets) : void{
53
foreach($packets as $packet){
54
$stream->
putUnsignedVarInt
(strlen($packet));
55
$stream->put($packet);
56
}
57
}
52
final
public
static
function
encodeRaw
(
BinaryStream
$stream, array $packets) : void {
…
}
58
63
final
public
static
function
decodePackets
(
BinaryStream
$stream,
PacketPool
$packetPool) : \
Generator
{
64
$c = 0;
65
foreach
(self::decodeRaw($stream) as $packetBuffer){
66
$packet = $packetPool->
getPacket
($packetBuffer);
67
if
($packet !==
null
){
68
try
{
69
$packet->decode(PacketSerializer::decoder($packetBuffer, 0));
70
}
catch
(
PacketDecodeException
$e){
71
throw
new
PacketDecodeException
(
"Error decoding packet $c in batch: "
. $e->getMessage(), 0, $e);
72
}
73
yield $packet;
74
}
else
{
75
throw
new
PacketDecodeException
(
"Unknown packet $c in batch"
);
76
}
77
$c++;
78
}
79
}
63
final
public
static
function
decodePackets
(
BinaryStream
$stream,
PacketPool
$packetPool) : \
Generator
{
…
}
80
85
final
public
static
function
encodePackets
(
BinaryStream
$stream, array $packets) : void{
86
foreach($packets as $packet){
87
$serializer = PacketSerializer::encoder();
88
$packet->encode($serializer);
89
$stream->
putUnsignedVarInt
(strlen($serializer->getBuffer()));
90
$stream->put($serializer->getBuffer());
91
}
92
}
85
final
public
static
function
encodePackets
(
BinaryStream
$stream, array $packets) : void {
…
}
93
}
24
class
PacketBatch
{
…
};
pocketmine\network\mcpe\protocol\PacketDecodeException
Definition
PacketDecodeException.php:17
pocketmine\network\mcpe\protocol\PacketPool
Definition
PacketPool.php:20
pocketmine\network\mcpe\protocol\PacketPool\getPacket
getPacket(string $buffer)
Definition
PacketPool.php:256
pocketmine\network\mcpe\protocol\serializer\PacketBatch
Definition
PacketBatch.php:24
pocketmine\network\mcpe\protocol\serializer\PacketBatch\encodePackets
static encodePackets(BinaryStream $stream, array $packets)
Definition
PacketBatch.php:85
pocketmine\network\mcpe\protocol\serializer\PacketBatch\decodePackets
static decodePackets(BinaryStream $stream, PacketPool $packetPool)
Definition
PacketBatch.php:63
pocketmine\network\mcpe\protocol\serializer\PacketBatch\encodeRaw
static encodeRaw(BinaryStream $stream, array $packets)
Definition
PacketBatch.php:52
pocketmine\network\mcpe\protocol\serializer\PacketBatch\decodeRaw
static decodeRaw(BinaryStream $stream)
Definition
PacketBatch.php:34
pocketmine\utils\BinaryDataException
Definition
BinaryDataException.php:26
pocketmine\utils\BinaryStream
Definition
BinaryStream.php:31
pocketmine\utils\BinaryStream\get
get(int $len)
Definition
BinaryStream.php:67
pocketmine\utils\BinaryStream\feof
feof()
Definition
BinaryStream.php:372
pocketmine\utils\BinaryStream\getUnsignedVarInt
getUnsignedVarInt()
Definition
BinaryStream.php:307
pocketmine\utils\BinaryStream\putUnsignedVarInt
putUnsignedVarInt(int $v)
Definition
BinaryStream.php:314
pocketmine\world\generator\Generator
Definition
Generator.php:34
pocketmine\network\mcpe\protocol\Packet
Definition
bedrock-protocol/src/Packet.php:19
vendor
pocketmine
bedrock-protocol
src
serializer
PacketBatch.php
Generated by
1.12.0