mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-12 00:39:45 +00:00
Added CompletedUsingItemPacket
This commit is contained in:
parent
4ea907ae1a
commit
4e9a2b6d8c
@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\network\mcpe;
|
||||
|
||||
use pocketmine\network\CompletedUsingItemPacket;
|
||||
use pocketmine\network\mcpe\protocol\ActorEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\ActorFallPacket;
|
||||
use pocketmine\network\mcpe\protocol\ActorPickRequestPacket;
|
||||
@ -694,4 +695,8 @@ abstract class NetworkSession{
|
||||
public function handleClientCacheMissResponse(ClientCacheMissResponsePacket $packet) : bool{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function handleCompletedUsingItem(CompletedUsingItemPacket $packet) : bool{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\network;
|
||||
|
||||
use pocketmine\network\mcpe\NetworkSession;
|
||||
use pocketmine\network\mcpe\protocol\DataPacket;
|
||||
use pocketmine\network\mcpe\protocol\ProtocolInfo;
|
||||
|
||||
class CompletedUsingItemPacket extends DataPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::COMPLETED_USING_ITEM_PACKET;
|
||||
|
||||
public const ACTION_UNKNOWN = -1;
|
||||
public const ACTION_EQUIP_ARMOR = 0;
|
||||
public const ACTION_EAT = 1;
|
||||
public const ACTION_ATTACK = 2;
|
||||
public const ACTION_CONSUME = 3;
|
||||
public const ACTION_THROW = 4;
|
||||
public const ACTION_SHOOT = 5;
|
||||
public const ACTION_PLACE = 6;
|
||||
public const ACTION_FILL_BOTTLE = 7;
|
||||
public const ACTION_FILL_BUCKET = 8;
|
||||
public const ACTION_POUR_BUCKET = 9;
|
||||
public const ACTION_USE_TOOL = 10;
|
||||
public const ACTION_INTERACT = 11;
|
||||
public const ACTION_RETRIEVED = 12;
|
||||
public const ACTION_DYED = 13;
|
||||
public const ACTION_TRADED = 14;
|
||||
|
||||
/** @var int */
|
||||
public $itemId;
|
||||
/** @var int */
|
||||
public $action;
|
||||
|
||||
public function decodePayload(){
|
||||
$this->itemId = $this->getShort();
|
||||
$this->action = $this->getLInt();
|
||||
}
|
||||
|
||||
public function encodePayload(){
|
||||
$this->putShort($this->itemId);
|
||||
$this->putLInt($this->action);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
return $session->handleCompletedUsingItem($this);
|
||||
}
|
||||
}
|
@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
use pocketmine\network\CompletedUsingItemPacket;
|
||||
use pocketmine\utils\Binary;
|
||||
use pocketmine\utils\BinaryDataException;
|
||||
|
||||
@ -166,6 +167,7 @@ class PacketPool{
|
||||
static::registerPacket(new UpdateBlockPropertiesPacket());
|
||||
static::registerPacket(new ClientCacheBlobStatusPacket());
|
||||
static::registerPacket(new ClientCacheMissResponsePacket());
|
||||
static::registerPacket(new CompletedUsingItemPacket());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user