mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-18 03:35:33 +00:00
Added new window types and found some UpdateTradePacket fields
This commit is contained in:
parent
e7dbda922a
commit
9e341f74d8
@ -26,13 +26,14 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
|
||||
use pocketmine\network\mcpe\NetworkSession;
|
||||
use pocketmine\network\mcpe\protocol\types\InventoryNetworkIds;
|
||||
|
||||
class UpdateTradePacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::UPDATE_TRADE_PACKET;
|
||||
|
||||
//TODO: find fields
|
||||
public $byte1;
|
||||
public $byte2;
|
||||
public $windowId;
|
||||
public $windowType = InventoryNetworkIds::TRADING; //Mojang hardcoded this -_-
|
||||
public $varint1;
|
||||
public $varint2;
|
||||
public $isWilling;
|
||||
@ -42,8 +43,8 @@ class UpdateTradePacket extends DataPacket{
|
||||
public $offers;
|
||||
|
||||
public function decode(){
|
||||
$this->byte1 = $this->getByte();
|
||||
$this->byte2 = $this->getByte();
|
||||
$this->windowId = $this->getByte();
|
||||
$this->windowType = $this->getByte();
|
||||
$this->varint1 = $this->getVarInt();
|
||||
$this->varint2 = $this->getVarInt();
|
||||
$this->isWilling = $this->getBool();
|
||||
@ -55,8 +56,8 @@ class UpdateTradePacket extends DataPacket{
|
||||
|
||||
public function encode(){
|
||||
$this->reset();
|
||||
$this->putByte($this->byte1);
|
||||
$this->putByte($this->byte2);
|
||||
$this->putByte($this->windowId);
|
||||
$this->putByte($this->windowType);
|
||||
$this->putVarInt($this->varint1);
|
||||
$this->putVarInt($this->varint2);
|
||||
$this->putBool($this->isWilling);
|
||||
|
@ -39,4 +39,9 @@ interface InventoryNetworkIds{
|
||||
const MINECART_CHEST = 10;
|
||||
const MINECART_HOPPER = 11;
|
||||
const HORSE = 12;
|
||||
const BEACON = 13;
|
||||
const STRUCTURE_EDITOR = 14;
|
||||
const TRADING = 15;
|
||||
const COMMAND_BLOCK = 16;
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user