Skip to content

Commit 2a98eb7

Browse files
committed
Protocol changes for 1.20.50
1 parent 3cb5300 commit 2a98eb7

18 files changed

+334
-99
lines changed

Diff for: src/CraftingEventPacket.php

-83
This file was deleted.

Diff for: src/PacketHandlerDefaultImplTrait.php

+8-4
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,6 @@ public function handleCraftingData(CraftingDataPacket $packet) : bool{
222222
return false;
223223
}
224224

225-
public function handleCraftingEvent(CraftingEventPacket $packet) : bool{
226-
return false;
227-
}
228-
229225
public function handleGuiDataPickItem(GuiDataPickItemPacket $packet) : bool{
230226
return false;
231227
}
@@ -805,4 +801,12 @@ public function handleAgentAnimation(AgentAnimationPacket $packet) : bool{
805801
public function handleRefreshEntitlements(RefreshEntitlementsPacket $packet) : bool{
806802
return false;
807803
}
804+
805+
public function handlePlayerToggleCrafterSlotRequest(PlayerToggleCrafterSlotRequestPacket $packet) : bool{
806+
return false;
807+
}
808+
809+
public function handleSetPlayerInventoryOptions(SetPlayerInventoryOptionsPacket $packet) : bool{
810+
return false;
811+
}
808812
}

Diff for: src/PacketHandlerInterface.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,6 @@ public function handleContainerSetData(ContainerSetDataPacket $packet) : bool;
118118

119119
public function handleCraftingData(CraftingDataPacket $packet) : bool;
120120

121-
public function handleCraftingEvent(CraftingEventPacket $packet) : bool;
122-
123121
public function handleGuiDataPickItem(GuiDataPickItemPacket $packet) : bool;
124122

125123
public function handleBlockActorData(BlockActorDataPacket $packet) : bool;
@@ -409,4 +407,8 @@ public function handleOpenSign(OpenSignPacket $packet) : bool;
409407
public function handleAgentAnimation(AgentAnimationPacket $packet) : bool;
410408

411409
public function handleRefreshEntitlements(RefreshEntitlementsPacket $packet) : bool;
410+
411+
public function handlePlayerToggleCrafterSlotRequest(PlayerToggleCrafterSlotRequestPacket $packet) : bool;
412+
413+
public function handleSetPlayerInventoryOptions(SetPlayerInventoryOptionsPacket $packet) : bool;
412414
}

Diff for: src/PacketPool.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ public function __construct(){
8383
$this->registerPacket(new InventorySlotPacket());
8484
$this->registerPacket(new ContainerSetDataPacket());
8585
$this->registerPacket(new CraftingDataPacket());
86-
$this->registerPacket(new CraftingEventPacket());
8786
$this->registerPacket(new GuiDataPickItemPacket());
8887
$this->registerPacket(new BlockActorDataPacket());
8988
$this->registerPacket(new PlayerInputPacket());
@@ -229,6 +228,8 @@ public function __construct(){
229228
$this->registerPacket(new OpenSignPacket());
230229
$this->registerPacket(new AgentAnimationPacket());
231230
$this->registerPacket(new RefreshEntitlementsPacket());
231+
$this->registerPacket(new PlayerToggleCrafterSlotRequestPacket());
232+
$this->registerPacket(new SetPlayerInventoryOptionsPacket());
232233
}
233234

234235
public function registerPacket(Packet $packet) : void{

Diff for: src/PlayerToggleCrafterSlotRequestPacket.php

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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+
use pocketmine\network\mcpe\protocol\types\BlockPosition;
19+
20+
class PlayerToggleCrafterSlotRequestPacket extends DataPacket implements ServerboundPacket{
21+
public const NETWORK_ID = ProtocolInfo::PLAYER_TOGGLE_CRAFTER_SLOT_REQUEST_PACKET;
22+
23+
private BlockPosition $position;
24+
private int $slot;
25+
private bool $disabled;
26+
27+
/**
28+
* @generate-create-func
29+
*/
30+
public static function create(BlockPosition $position, int $slot, bool $disabled) : self{
31+
$result = new self;
32+
$result->position = $position;
33+
$result->slot = $slot;
34+
$result->disabled = $disabled;
35+
return $result;
36+
}
37+
38+
public function getPosition() : BlockPosition{ return $this->position; }
39+
40+
public function getSlot() : int{ return $this->slot; }
41+
42+
public function isDisabled() : bool{ return $this->disabled; }
43+
44+
protected function decodePayload(PacketSerializer $in) : void{
45+
$x = $in->getLInt();
46+
$y = $in->getLInt();
47+
$z = $in->getLInt();
48+
$this->position = new BlockPosition($x, $y, $z);
49+
$this->slot = $in->getByte();
50+
$this->disabled = $in->getBool();
51+
}
52+
53+
protected function encodePayload(PacketSerializer $out) : void{
54+
$out->putLInt($this->position->getX());
55+
$out->putLInt($this->position->getY());
56+
$out->putLInt($this->position->getZ());
57+
$out->putByte($this->slot);
58+
$out->putBool($this->disabled);
59+
}
60+
61+
public function handle(PacketHandlerInterface $handler) : bool{
62+
return $handler->handlePlayerToggleCrafterSlotRequest($this);
63+
}
64+
}

Diff for: src/ProtocolInfo.php

+6-4
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 = 622;
35+
public const CURRENT_PROTOCOL = 630;
3636
/** Current Minecraft PE version reported by the server. This is usually the earliest currently supported version. */
37-
public const MINECRAFT_VERSION = 'v1.20.40';
37+
public const MINECRAFT_VERSION = 'v1.20.50';
3838
/** Version number sent to clients in ping responses. */
39-
public const MINECRAFT_VERSION_NETWORK = '1.20.40';
39+
public const MINECRAFT_VERSION_NETWORK = '1.20.50';
4040

4141
public const LOGIN_PACKET = 0x01;
4242
public const PLAY_STATUS_PACKET = 0x02;
@@ -90,7 +90,7 @@ private function __construct(){
9090
public const INVENTORY_SLOT_PACKET = 0x32;
9191
public const CONTAINER_SET_DATA_PACKET = 0x33;
9292
public const CRAFTING_DATA_PACKET = 0x34;
93-
public const CRAFTING_EVENT_PACKET = 0x35;
93+
9494
public const GUI_DATA_PICK_ITEM_PACKET = 0x36;
9595

9696
public const BLOCK_ACTOR_DATA_PACKET = 0x38;
@@ -243,5 +243,7 @@ private function __construct(){
243243
public const OPEN_SIGN_PACKET = 0x12f;
244244
public const AGENT_ANIMATION_PACKET = 0x130;
245245
public const REFRESH_ENTITLEMENTS_PACKET = 0x131;
246+
public const PLAYER_TOGGLE_CRAFTER_SLOT_REQUEST_PACKET = 0x132;
247+
public const SET_PLAYER_INVENTORY_OPTIONS_PACKET = 0x133;
246248

247249
}

Diff for: src/SetPlayerInventoryOptionsPacket.php

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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+
use pocketmine\network\mcpe\protocol\types\inventory\InventoryLayout;
19+
use pocketmine\network\mcpe\protocol\types\inventory\InventoryLeftTab;
20+
use pocketmine\network\mcpe\protocol\types\inventory\InventoryRightTab;
21+
22+
class SetPlayerInventoryOptionsPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
23+
public const NETWORK_ID = ProtocolInfo::SET_PLAYER_INVENTORY_OPTIONS_PACKET;
24+
25+
private InventoryLeftTab $leftTab;
26+
private InventoryRightTab $rightTab;
27+
private bool $filtering;
28+
private InventoryLayout $inventoryLayout;
29+
private InventoryLayout $craftingLayout;
30+
31+
/**
32+
* @generate-create-func
33+
*/
34+
public static function create(InventoryLeftTab $leftTab, InventoryRightTab $rightTab, bool $filtering, InventoryLayout $inventoryLayout, InventoryLayout $craftingLayout) : self{
35+
$result = new self;
36+
$result->leftTab = $leftTab;
37+
$result->rightTab = $rightTab;
38+
$result->filtering = $filtering;
39+
$result->inventoryLayout = $inventoryLayout;
40+
$result->craftingLayout = $craftingLayout;
41+
return $result;
42+
}
43+
44+
public function getLeftTab() : InventoryLeftTab{ return $this->leftTab; }
45+
46+
public function getRightTab() : InventoryRightTab{ return $this->rightTab; }
47+
48+
public function isFiltering() : bool{ return $this->filtering; }
49+
50+
public function getInventoryLayout() : InventoryLayout{ return $this->inventoryLayout; }
51+
52+
public function getCraftingLayout() : InventoryLayout{ return $this->craftingLayout; }
53+
54+
protected function decodePayload(PacketSerializer $in) : void{
55+
$this->leftTab = InventoryLeftTab::fromPacket($in->getVarInt());
56+
$this->rightTab = InventoryRightTab::fromPacket($in->getVarInt());
57+
$this->filtering = $in->getBool();
58+
$this->inventoryLayout = InventoryLayout::fromPacket($in->getVarInt());
59+
$this->craftingLayout = InventoryLayout::fromPacket($in->getVarInt());
60+
}
61+
62+
protected function encodePayload(PacketSerializer $out) : void{
63+
$out->putVarInt($this->leftTab->value);
64+
$out->putVarInt($this->rightTab->value);
65+
$out->putBool($this->filtering);
66+
$out->putVarInt($this->inventoryLayout->value);
67+
$out->putVarInt($this->craftingLayout->value);
68+
}
69+
70+
public function handle(PacketHandlerInterface $handler) : bool{
71+
return $handler->handleSetPlayerInventoryOptions($this);
72+
}
73+
}

Diff for: src/ShowStoreOfferPacket.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@
1515
namespace pocketmine\network\mcpe\protocol;
1616

1717
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
18+
use pocketmine\network\mcpe\protocol\types\ShowStoreOfferRedirectType;
1819

1920
class ShowStoreOfferPacket extends DataPacket implements ClientboundPacket{
2021
public const NETWORK_ID = ProtocolInfo::SHOW_STORE_OFFER_PACKET;
2122

2223
public string $offerId;
23-
public bool $showAll;
24+
public ShowStoreOfferRedirectType $redirectType;
2425

2526
/**
2627
* @generate-create-func
@@ -34,12 +35,12 @@ public static function create(string $offerId, bool $showAll) : self{
3435

3536
protected function decodePayload(PacketSerializer $in) : void{
3637
$this->offerId = $in->getString();
37-
$this->showAll = $in->getBool();
38+
$this->redirectType = ShowStoreOfferRedirectType::fromPacket($in->getByte());
3839
}
3940

4041
protected function encodePayload(PacketSerializer $out) : void{
4142
$out->putString($this->offerId);
42-
$out->putBool($this->showAll);
43+
$out->putByte($this->redirectType->value);
4344
}
4445

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

Diff for: src/types/LevelEvent.php

+3
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ private function __construct(){
101101
public const PARTICLE_SCULK_SHRIEK = 2035;
102102
public const PARTICLE_SCULK_CATALYST_BLOOM = 2036;
103103

104+
public const PARTICLE_DUST_PLUME = 2040;
105+
104106
public const START_RAIN = 3001;
105107
public const START_THUNDER = 3002;
106108
public const STOP_RAIN = 3003;
@@ -135,6 +137,7 @@ private function __construct(){
135137
public const PARTICLE_PUNCH_BLOCK_SOUTH = 3606;
136138
public const PARTICLE_PUNCH_BLOCK_WEST = 3607;
137139
public const PARTICLE_PUNCH_BLOCK_EAST = 3608;
140+
public const PARTICLE_SHOOT_WHITE_SMOKE = 3609;
138141

139142
public const SET_DATA = 4000;
140143

Diff for: src/types/LevelSoundEvent.php

+10
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,16 @@ private function __construct(){
467467
public const MOB_HOGLIN_CONVERTED_TO_ZOMBIFIED = 474;
468468
public const AMBIENT_UNDERWATER_ENTER = 475;
469469
public const AMBIENT_UNDERWATER_EXIT = 476;
470+
public const BOTTLE_FILL = 477;
471+
public const BOTTLE_EMPTY = 478;
472+
public const CRAFTER_CRAFT = 479;
473+
public const CRAFTER_FAIL = 480;
474+
public const BLOCK_DECORATED_POT_INSERT = 481;
475+
public const BLOCK_DECORATED_POT_INSERT_FAIL = 482;
476+
public const CRAFTER_DISABLE_SLOT = 483;
477+
478+
public const BLOCK_COPPER_BULB_TURN_ON = 490;
479+
public const BLOCK_COPPER_BULB_TURN_OFF = 491;
470480

471481
//The following aliases are kept for backwards compatibility only
472482
public const SCULK_SENSOR_POWER_ON = self::POWER_ON_SCULK_SENSOR;

0 commit comments

Comments
 (0)