Skip to content

Commit 482a852

Browse files
committed
Protocol changes for 1.20.70
1 parent fdb0d1d commit 482a852

17 files changed

+143
-89
lines changed

src/AvailableCommandsPacket.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,21 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
5454

5555
public const ARG_TYPE_FULL_INTEGER_RANGE = 23;
5656

57-
public const ARG_TYPE_EQUIPMENT_SLOT = 43;
58-
public const ARG_TYPE_STRING = 44;
57+
public const ARG_TYPE_EQUIPMENT_SLOT = 47;
58+
public const ARG_TYPE_STRING = 48;
5959

60-
public const ARG_TYPE_INT_POSITION = 52;
61-
public const ARG_TYPE_POSITION = 53;
60+
public const ARG_TYPE_INT_POSITION = 64;
61+
public const ARG_TYPE_POSITION = 65;
6262

63-
public const ARG_TYPE_MESSAGE = 55;
63+
public const ARG_TYPE_MESSAGE = 67;
6464

65-
public const ARG_TYPE_RAWTEXT = 58;
65+
public const ARG_TYPE_RAWTEXT = 70;
6666

67-
public const ARG_TYPE_JSON = 62;
67+
public const ARG_TYPE_JSON = 74;
6868

69-
public const ARG_TYPE_BLOCK_STATES = 71;
69+
public const ARG_TYPE_BLOCK_STATES = 84;
7070

71-
public const ARG_TYPE_COMMAND = 74;
71+
public const ARG_TYPE_COMMAND = 87;
7272

7373
/**
7474
* Enums are a little different: they are composed as follows:

src/ItemFrameDropItemPacket.php

Lines changed: 0 additions & 46 deletions
This file was deleted.

src/LecternUpdatePacket.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,28 @@ class LecternUpdatePacket extends DataPacket implements ServerboundPacket{
2323
public int $page;
2424
public int $totalPages;
2525
public BlockPosition $blockPosition;
26-
public bool $dropBook;
2726

2827
/**
2928
* @generate-create-func
3029
*/
31-
public static function create(int $page, int $totalPages, BlockPosition $blockPosition, bool $dropBook) : self{
30+
public static function create(int $page, int $totalPages, BlockPosition $blockPosition) : self{
3231
$result = new self;
3332
$result->page = $page;
3433
$result->totalPages = $totalPages;
3534
$result->blockPosition = $blockPosition;
36-
$result->dropBook = $dropBook;
3735
return $result;
3836
}
3937

4038
protected function decodePayload(PacketSerializer $in) : void{
4139
$this->page = $in->getByte();
4240
$this->totalPages = $in->getByte();
4341
$this->blockPosition = $in->getBlockPosition();
44-
$this->dropBook = $in->getBool();
4542
}
4643

4744
protected function encodePayload(PacketSerializer $out) : void{
4845
$out->putByte($this->page);
4946
$out->putByte($this->totalPages);
5047
$out->putBlockPosition($this->blockPosition);
51-
$out->putBool($this->dropBook);
5248
}
5349

5450
public function handle(PacketHandlerInterface $handler) : bool{

src/MobEffectPacket.php

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,37 @@ class MobEffectPacket extends DataPacket implements ClientboundPacket{
2929
public int $amplifier = 0;
3030
public bool $particles = true;
3131
public int $duration = 0;
32+
public int $tick = 0;
3233

3334
/**
3435
* @generate-create-func
3536
*/
36-
public static function create(int $actorRuntimeId, int $eventId, int $effectId, int $amplifier, bool $particles, int $duration) : self{
37+
public static function create(
38+
int $actorRuntimeId,
39+
int $eventId,
40+
int $effectId,
41+
int $amplifier,
42+
bool $particles,
43+
int $duration,
44+
int $tick,
45+
) : self{
3746
$result = new self;
3847
$result->actorRuntimeId = $actorRuntimeId;
3948
$result->eventId = $eventId;
4049
$result->effectId = $effectId;
4150
$result->amplifier = $amplifier;
4251
$result->particles = $particles;
4352
$result->duration = $duration;
53+
$result->tick = $tick;
4454
return $result;
4555
}
4656

47-
public static function add(int $actorRuntimeId, bool $replace, int $effectId, int $amplifier, bool $particles, int $duration) : self{
48-
return self::create($actorRuntimeId, $replace ? self::EVENT_MODIFY : self::EVENT_ADD, $effectId, $amplifier, $particles, $duration);
57+
public static function add(int $actorRuntimeId, bool $replace, int $effectId, int $amplifier, bool $particles, int $duration, int $tick) : self{
58+
return self::create($actorRuntimeId, $replace ? self::EVENT_MODIFY : self::EVENT_ADD, $effectId, $amplifier, $particles, $duration, $tick);
4959
}
5060

51-
public static function remove(int $actorRuntimeId, int $effectId) : self{
52-
return self::create($actorRuntimeId, self::EVENT_REMOVE, $effectId, 0, false, 0);
61+
public static function remove(int $actorRuntimeId, int $effectId, int $tick) : self{
62+
return self::create($actorRuntimeId, self::EVENT_REMOVE, $effectId, 0, false, 0, $tick);
5363
}
5464

5565
protected function decodePayload(PacketSerializer $in) : void{
@@ -59,6 +69,7 @@ protected function decodePayload(PacketSerializer $in) : void{
5969
$this->amplifier = $in->getVarInt();
6070
$this->particles = $in->getBool();
6171
$this->duration = $in->getVarInt();
72+
$this->tick = $in->getLLong();
6273
}
6374

6475
protected function encodePayload(PacketSerializer $out) : void{
@@ -68,6 +79,7 @@ protected function encodePayload(PacketSerializer $out) : void{
6879
$out->putVarInt($this->amplifier);
6980
$out->putBool($this->particles);
7081
$out->putVarInt($this->duration);
82+
$out->putLLong($this->tick);
7183
}
7284

7385
public function handle(PacketHandlerInterface $handler) : bool{

src/PacketHandlerDefaultImplTrait.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,6 @@ public function handleChunkRadiusUpdated(ChunkRadiusUpdatedPacket $packet) : boo
290290
return false;
291291
}
292292

293-
public function handleItemFrameDropItem(ItemFrameDropItemPacket $packet) : bool{
294-
return false;
295-
}
296-
297293
public function handleGameRulesChanged(GameRulesChangedPacket $packet) : bool{
298294
return false;
299295
}

src/PacketHandlerInterface.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,6 @@ public function handleRequestChunkRadius(RequestChunkRadiusPacket $packet) : boo
152152

153153
public function handleChunkRadiusUpdated(ChunkRadiusUpdatedPacket $packet) : bool;
154154

155-
public function handleItemFrameDropItem(ItemFrameDropItemPacket $packet) : bool;
156-
157155
public function handleGameRulesChanged(GameRulesChangedPacket $packet) : bool;
158156

159157
public function handleCamera(CameraPacket $packet) : bool;

src/PacketPool.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ public function __construct(){
100100
$this->registerPacket(new MapInfoRequestPacket());
101101
$this->registerPacket(new RequestChunkRadiusPacket());
102102
$this->registerPacket(new ChunkRadiusUpdatedPacket());
103-
$this->registerPacket(new ItemFrameDropItemPacket());
104103
$this->registerPacket(new GameRulesChangedPacket());
105104
$this->registerPacket(new CameraPacket());
106105
$this->registerPacket(new BossEventPacket());

src/PlayerAuthInputPacket.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class PlayerAuthInputPacket extends DataPacket implements ServerboundPacket{
4949
private ?ItemStackRequest $itemStackRequest = null;
5050
/** @var PlayerBlockAction[]|null */
5151
private ?array $blockActions = null;
52-
private ?int $clientPredictedVehicleActorUniqueId = null;
52+
private ?PlayerAuthInputVehicleInfo $vehicleInfo = null;
5353
private float $analogMoveVecX;
5454
private float $analogMoveVecZ;
5555

@@ -78,7 +78,7 @@ public static function create(
7878
?ItemInteractionData $itemInteractionData,
7979
?ItemStackRequest $itemStackRequest,
8080
?array $blockActions,
81-
?int $clientPredictedVehicleActorUniqueId,
81+
?PlayerAuthInputVehicleInfo $vehicleInfo,
8282
float $analogMoveVecX,
8383
float $analogMoveVecZ
8484
) : self{
@@ -104,7 +104,7 @@ public static function create(
104104
if($blockActions !== null){
105105
$result->inputFlags |= 1 << PlayerAuthInputFlags::PERFORM_BLOCK_ACTIONS;
106106
}
107-
if($clientPredictedVehicleActorUniqueId !== null){
107+
if($vehicleInfo !== null){
108108
$result->inputFlags |= 1 << PlayerAuthInputFlags::IN_CLIENT_PREDICTED_VEHICLE;
109109
}
110110

@@ -119,7 +119,7 @@ public static function create(
119119
$result->itemInteractionData = $itemInteractionData;
120120
$result->itemStackRequest = $itemStackRequest;
121121
$result->blockActions = $blockActions;
122-
$result->clientPredictedVehicleActorUniqueId = $clientPredictedVehicleActorUniqueId;
122+
$result->vehicleInfo = $vehicleInfo;
123123
$result->analogMoveVecX = $analogMoveVecX;
124124
$result->analogMoveVecZ = $analogMoveVecZ;
125125
return $result;
@@ -204,7 +204,7 @@ public function getBlockActions() : ?array{
204204
return $this->blockActions;
205205
}
206206

207-
public function getClientPredictedVehicleActorUniqueId() : ?int{ return $this->clientPredictedVehicleActorUniqueId; }
207+
public function getVehicleInfo() : ?PlayerAuthInputVehicleInfo{ return $this->vehicleInfo; }
208208

209209
public function getAnalogMoveVecX() : float{ return $this->analogMoveVecX; }
210210

@@ -249,7 +249,7 @@ protected function decodePayload(PacketSerializer $in) : void{
249249
}
250250
}
251251
if($this->hasFlag(PlayerAuthInputFlags::IN_CLIENT_PREDICTED_VEHICLE)){
252-
$this->clientPredictedVehicleActorUniqueId = $in->getActorUniqueId();
252+
$this->vehicleInfo = PlayerAuthInputVehicleInfo::read($in);
253253
}
254254
$this->analogMoveVecX = $in->getLFloat();
255255
$this->analogMoveVecZ = $in->getLFloat();
@@ -285,8 +285,8 @@ protected function encodePayload(PacketSerializer $out) : void{
285285
$blockAction->write($out);
286286
}
287287
}
288-
if($this->clientPredictedVehicleActorUniqueId !== null){
289-
$out->putActorUniqueId($this->clientPredictedVehicleActorUniqueId);
288+
if($this->vehicleInfo !== null){
289+
$this->vehicleInfo->write($out);
290290
}
291291
$out->putLFloat($this->analogMoveVecX);
292292
$out->putLFloat($this->analogMoveVecZ);

src/PlayerAuthInputVehicleInfo.php

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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;
16+
17+
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
18+
19+
final class PlayerAuthInputVehicleInfo{
20+
21+
public function __construct(
22+
private float $vehicleRotationX,
23+
private float $vehicleRotationZ,
24+
private int $predictedVehicleActorUniqueId
25+
){}
26+
27+
public function getVehicleRotationX() : float{ return $this->vehicleRotationX; }
28+
29+
public function getVehicleRotationZ() : float{ return $this->vehicleRotationZ; }
30+
31+
public function getPredictedVehicleActorUniqueId() : int{ return $this->predictedVehicleActorUniqueId; }
32+
33+
public static function read(PacketSerializer $in) : self{
34+
$vehicleRotationX = $in->getLFloat();
35+
$vehicleRotationZ = $in->getLFloat();
36+
$predictedVehicleActorUniqueId = $in->getActorUniqueId();
37+
38+
return new self($vehicleRotationX, $vehicleRotationZ, $predictedVehicleActorUniqueId);
39+
}
40+
41+
public function write(PacketSerializer $out) : void{
42+
$out->putLFloat($this->vehicleRotationX);
43+
$out->putLFloat($this->vehicleRotationZ);
44+
$out->putActorUniqueId($this->predictedVehicleActorUniqueId);
45+
}
46+
}

src/ProtocolInfo.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ private function __construct(){
3232
*/
3333

3434
/** Actual Minecraft: PE protocol version */
35-
public const CURRENT_PROTOCOL = 649;
35+
public const CURRENT_PROTOCOL = 662;
3636
/** Current Minecraft PE version reported by the server. This is usually the earliest currently supported version. */
37-
public const MINECRAFT_VERSION = 'v1.20.60';
37+
public const MINECRAFT_VERSION = 'v1.20.70';
3838
/** Version number sent to clients in ping responses. */
39-
public const MINECRAFT_VERSION_NETWORK = '1.20.60';
39+
public const MINECRAFT_VERSION_NETWORK = '1.20.70';
4040

4141
public const LOGIN_PACKET = 0x01;
4242
public const PLAY_STATUS_PACKET = 0x02;
@@ -108,7 +108,7 @@ private function __construct(){
108108
public const MAP_INFO_REQUEST_PACKET = 0x44;
109109
public const REQUEST_CHUNK_RADIUS_PACKET = 0x45;
110110
public const CHUNK_RADIUS_UPDATED_PACKET = 0x46;
111-
public const ITEM_FRAME_DROP_ITEM_PACKET = 0x47;
111+
112112
public const GAME_RULES_CHANGED_PACKET = 0x48;
113113
public const CAMERA_PACKET = 0x49;
114114
public const BOSS_EVENT_PACKET = 0x4a;

0 commit comments

Comments
 (0)