-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
334 additions
and
99 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of BedrockProtocol. | ||
* Copyright (C) 2014-2022 PocketMine Team <https://github.com/pmmp/BedrockProtocol> | ||
* | ||
* BedrockProtocol is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace pocketmine\network\mcpe\protocol; | ||
|
||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer; | ||
use pocketmine\network\mcpe\protocol\types\BlockPosition; | ||
|
||
class PlayerToggleCrafterSlotRequestPacket extends DataPacket implements ServerboundPacket{ | ||
public const NETWORK_ID = ProtocolInfo::PLAYER_TOGGLE_CRAFTER_SLOT_REQUEST_PACKET; | ||
|
||
private BlockPosition $position; | ||
private int $slot; | ||
private bool $disabled; | ||
|
||
/** | ||
* @generate-create-func | ||
*/ | ||
public static function create(BlockPosition $position, int $slot, bool $disabled) : self{ | ||
$result = new self; | ||
$result->position = $position; | ||
$result->slot = $slot; | ||
$result->disabled = $disabled; | ||
return $result; | ||
} | ||
|
||
public function getPosition() : BlockPosition{ return $this->position; } | ||
|
||
public function getSlot() : int{ return $this->slot; } | ||
|
||
public function isDisabled() : bool{ return $this->disabled; } | ||
|
||
protected function decodePayload(PacketSerializer $in) : void{ | ||
$x = $in->getLInt(); | ||
$y = $in->getLInt(); | ||
$z = $in->getLInt(); | ||
$this->position = new BlockPosition($x, $y, $z); | ||
$this->slot = $in->getByte(); | ||
$this->disabled = $in->getBool(); | ||
} | ||
|
||
protected function encodePayload(PacketSerializer $out) : void{ | ||
$out->putLInt($this->position->getX()); | ||
$out->putLInt($this->position->getY()); | ||
$out->putLInt($this->position->getZ()); | ||
$out->putByte($this->slot); | ||
$out->putBool($this->disabled); | ||
} | ||
|
||
public function handle(PacketHandlerInterface $handler) : bool{ | ||
return $handler->handlePlayerToggleCrafterSlotRequest($this); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of BedrockProtocol. | ||
* Copyright (C) 2014-2022 PocketMine Team <https://github.com/pmmp/BedrockProtocol> | ||
* | ||
* BedrockProtocol is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace pocketmine\network\mcpe\protocol; | ||
|
||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer; | ||
use pocketmine\network\mcpe\protocol\types\inventory\InventoryLayout; | ||
use pocketmine\network\mcpe\protocol\types\inventory\InventoryLeftTab; | ||
use pocketmine\network\mcpe\protocol\types\inventory\InventoryRightTab; | ||
|
||
class SetPlayerInventoryOptionsPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{ | ||
public const NETWORK_ID = ProtocolInfo::SET_PLAYER_INVENTORY_OPTIONS_PACKET; | ||
|
||
private InventoryLeftTab $leftTab; | ||
private InventoryRightTab $rightTab; | ||
private bool $filtering; | ||
private InventoryLayout $inventoryLayout; | ||
private InventoryLayout $craftingLayout; | ||
|
||
/** | ||
* @generate-create-func | ||
*/ | ||
public static function create(InventoryLeftTab $leftTab, InventoryRightTab $rightTab, bool $filtering, InventoryLayout $inventoryLayout, InventoryLayout $craftingLayout) : self{ | ||
$result = new self; | ||
$result->leftTab = $leftTab; | ||
$result->rightTab = $rightTab; | ||
$result->filtering = $filtering; | ||
$result->inventoryLayout = $inventoryLayout; | ||
$result->craftingLayout = $craftingLayout; | ||
return $result; | ||
} | ||
|
||
public function getLeftTab() : InventoryLeftTab{ return $this->leftTab; } | ||
|
||
public function getRightTab() : InventoryRightTab{ return $this->rightTab; } | ||
|
||
public function isFiltering() : bool{ return $this->filtering; } | ||
|
||
public function getInventoryLayout() : InventoryLayout{ return $this->inventoryLayout; } | ||
|
||
public function getCraftingLayout() : InventoryLayout{ return $this->craftingLayout; } | ||
|
||
protected function decodePayload(PacketSerializer $in) : void{ | ||
$this->leftTab = InventoryLeftTab::fromPacket($in->getVarInt()); | ||
$this->rightTab = InventoryRightTab::fromPacket($in->getVarInt()); | ||
$this->filtering = $in->getBool(); | ||
$this->inventoryLayout = InventoryLayout::fromPacket($in->getVarInt()); | ||
$this->craftingLayout = InventoryLayout::fromPacket($in->getVarInt()); | ||
} | ||
|
||
protected function encodePayload(PacketSerializer $out) : void{ | ||
$out->putVarInt($this->leftTab->value); | ||
$out->putVarInt($this->rightTab->value); | ||
$out->putBool($this->filtering); | ||
$out->putVarInt($this->inventoryLayout->value); | ||
$out->putVarInt($this->craftingLayout->value); | ||
} | ||
|
||
public function handle(PacketHandlerInterface $handler) : bool{ | ||
return $handler->handleSetPlayerInventoryOptions($this); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.