Duct tape for inventory transactions, removed ContainerSetSlotPacket

This commit is contained in:
Dylan K. Taylor
2017-08-10 20:02:31 +01:00
parent 5208ad885c
commit 74ee94b385
4 changed files with 128 additions and 165 deletions

View File

@ -35,7 +35,6 @@ use pocketmine\network\mcpe\protocol\ClientToServerHandshakePacket;
use pocketmine\network\mcpe\protocol\CommandBlockUpdatePacket;
use pocketmine\network\mcpe\protocol\CommandRequestPacket;
use pocketmine\network\mcpe\protocol\ContainerClosePacket;
use pocketmine\network\mcpe\protocol\ContainerSetSlotPacket;
use pocketmine\network\mcpe\protocol\CraftingEventPacket;
use pocketmine\network\mcpe\protocol\DataPacket;
use pocketmine\network\mcpe\protocol\DropItemPacket;
@ -183,16 +182,6 @@ class PlayerNetworkSessionAdapter extends NetworkSession{
return $this->player->handlePlayerHotbar($packet);
}
/**
* TODO: REMOVE
* @param ContainerSetSlotPacket $packet
*
* @return bool
*/
public function handleContainerSetSlot(ContainerSetSlotPacket $packet) : bool{
return $this->player->handleContainerSetSlot($packet);
}
public function handleCraftingEvent(CraftingEventPacket $packet) : bool{
return $this->player->handleCraftingEvent($packet);
}

View File

@ -1,64 +0,0 @@
<?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\mcpe\protocol;
#include <rules/DataPacket.h>
use pocketmine\item\Item;
use pocketmine\network\mcpe\NetworkSession;
/**
* @removed
*/
class ContainerSetSlotPacket extends DataPacket{
const NETWORK_ID = ProtocolInfo::CONTAINER_SET_SLOT_PACKET;
public $windowid;
public $slot;
public $hotbarSlot = 0;
/** @var Item */
public $item;
public $selectSlot = 0;
protected function decodePayload(){
$this->windowid = $this->getByte();
$this->slot = $this->getVarInt();
$this->hotbarSlot = $this->getVarInt();
$this->item = $this->getSlot();
$this->selectSlot = $this->getByte();
}
protected function encodePayload(){
$this->putByte($this->windowid);
$this->putVarInt($this->slot);
$this->putVarInt($this->hotbarSlot);
$this->putSlot($this->item);
$this->putByte($this->selectSlot);
}
public function handle(NetworkSession $session) : bool{
return $session->handleContainerSetSlot($this);
}
}