mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-13 15:05:33 +00:00
Moved inventory action magic slot constants where they belong
This commit is contained in:
parent
8e7ad532f1
commit
6897cb4774
@ -48,14 +48,6 @@ class InventoryTransactionPacket extends DataPacket{
|
|||||||
const USE_ITEM_ON_ENTITY_ACTION_ATTACK = 1;
|
const USE_ITEM_ON_ENTITY_ACTION_ATTACK = 1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const ACTION_MAGIC_SLOT_DROP_ITEM = 0;
|
|
||||||
const ACTION_MAGIC_SLOT_PICKUP_ITEM = 1;
|
|
||||||
|
|
||||||
const ACTION_MAGIC_SLOT_CREATIVE_DELETE_ITEM = 0;
|
|
||||||
const ACTION_MAGIC_SLOT_CREATIVE_CREATE_ITEM = 1;
|
|
||||||
|
|
||||||
/** @var int */
|
/** @var int */
|
||||||
public $transactionType;
|
public $transactionType;
|
||||||
|
|
||||||
|
@ -71,6 +71,11 @@ class NetworkInventoryAction{
|
|||||||
/** Any client-side window dropping its contents when the player closes it */
|
/** Any client-side window dropping its contents when the player closes it */
|
||||||
const SOURCE_TYPE_CONTAINER_DROP_CONTENTS = -100;
|
const SOURCE_TYPE_CONTAINER_DROP_CONTENTS = -100;
|
||||||
|
|
||||||
|
const ACTION_MAGIC_SLOT_CREATIVE_DELETE_ITEM = 0;
|
||||||
|
const ACTION_MAGIC_SLOT_CREATIVE_CREATE_ITEM = 1;
|
||||||
|
|
||||||
|
const ACTION_MAGIC_SLOT_DROP_ITEM = 0;
|
||||||
|
const ACTION_MAGIC_SLOT_PICKUP_ITEM = 1;
|
||||||
|
|
||||||
/** @var int */
|
/** @var int */
|
||||||
public $sourceType;
|
public $sourceType;
|
||||||
@ -159,17 +164,17 @@ class NetworkInventoryAction{
|
|||||||
|
|
||||||
throw new \InvalidStateException("Player " . $player->getName() . " has no open container with window ID $this->windowId");
|
throw new \InvalidStateException("Player " . $player->getName() . " has no open container with window ID $this->windowId");
|
||||||
case self::SOURCE_WORLD:
|
case self::SOURCE_WORLD:
|
||||||
if($this->inventorySlot !== InventoryTransactionPacket::ACTION_MAGIC_SLOT_DROP_ITEM){
|
if($this->inventorySlot !== self::ACTION_MAGIC_SLOT_DROP_ITEM){
|
||||||
throw new \UnexpectedValueException("Only expecting drop-item world actions from the client!");
|
throw new \UnexpectedValueException("Only expecting drop-item world actions from the client!");
|
||||||
}
|
}
|
||||||
|
|
||||||
return new DropItemAction($this->oldItem, $this->newItem);
|
return new DropItemAction($this->oldItem, $this->newItem);
|
||||||
case self::SOURCE_CREATIVE:
|
case self::SOURCE_CREATIVE:
|
||||||
switch($this->inventorySlot){
|
switch($this->inventorySlot){
|
||||||
case InventoryTransactionPacket::ACTION_MAGIC_SLOT_CREATIVE_DELETE_ITEM:
|
case self::ACTION_MAGIC_SLOT_CREATIVE_DELETE_ITEM:
|
||||||
$type = CreativeInventoryAction::TYPE_DELETE_ITEM;
|
$type = CreativeInventoryAction::TYPE_DELETE_ITEM;
|
||||||
break;
|
break;
|
||||||
case InventoryTransactionPacket::ACTION_MAGIC_SLOT_CREATIVE_CREATE_ITEM:
|
case self::ACTION_MAGIC_SLOT_CREATIVE_CREATE_ITEM:
|
||||||
$type = CreativeInventoryAction::TYPE_CREATE_ITEM;
|
$type = CreativeInventoryAction::TYPE_CREATE_ITEM;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user