mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Move inventory ID constants to their own interface
ContainerSetContentPacket will be removed in 1.2, and these aren't specific to ContainerSetContentPacket anyway.
This commit is contained in:
@ -32,6 +32,7 @@ use pocketmine\network\mcpe\protocol\ContainerSetContentPacket;
|
||||
use pocketmine\network\mcpe\protocol\ContainerSetSlotPacket;
|
||||
use pocketmine\network\mcpe\protocol\MobArmorEquipmentPacket;
|
||||
use pocketmine\network\mcpe\protocol\MobEquipmentPacket;
|
||||
use pocketmine\network\mcpe\protocol\types\ContainerIds;
|
||||
use pocketmine\Player;
|
||||
use pocketmine\Server;
|
||||
|
||||
@ -238,7 +239,7 @@ class PlayerInventory extends BaseInventory{
|
||||
$pk->item = $item;
|
||||
$pk->inventorySlot = $this->getHeldItemSlot();
|
||||
$pk->hotbarSlot = $this->getHeldItemIndex();
|
||||
$pk->windowId = ContainerSetContentPacket::SPECIAL_INVENTORY;
|
||||
$pk->windowId = ContainerIds::INVENTORY;
|
||||
|
||||
if(!is_array($target)){
|
||||
$target->dataPacket($pk);
|
||||
@ -424,7 +425,7 @@ class PlayerInventory extends BaseInventory{
|
||||
foreach($target as $player){
|
||||
if($player === $this->getHolder()){
|
||||
$pk2 = new ContainerSetContentPacket();
|
||||
$pk2->windowid = ContainerSetContentPacket::SPECIAL_ARMOR;
|
||||
$pk2->windowid = ContainerIds::ARMOR;
|
||||
$pk2->slots = $armor;
|
||||
$pk2->targetEid = $player->getId();
|
||||
$player->dataPacket($pk2);
|
||||
@ -473,7 +474,7 @@ class PlayerInventory extends BaseInventory{
|
||||
if($player === $this->getHolder()){
|
||||
/** @var Player $player */
|
||||
$pk2 = new ContainerSetSlotPacket();
|
||||
$pk2->windowid = ContainerSetContentPacket::SPECIAL_ARMOR;
|
||||
$pk2->windowid = ContainerIds::ARMOR;
|
||||
$pk2->slot = $index - $this->getSize();
|
||||
$pk2->item = $this->getItem($index);
|
||||
$player->dataPacket($pk2);
|
||||
@ -523,7 +524,7 @@ class PlayerInventory extends BaseInventory{
|
||||
|
||||
public function sendCreativeContents(){
|
||||
$pk = new ContainerSetContentPacket();
|
||||
$pk->windowid = ContainerSetContentPacket::SPECIAL_CREATIVE;
|
||||
$pk->windowid = ContainerIds::CREATIVE;
|
||||
if($this->getHolder()->getGamemode() === Player::CREATIVE){
|
||||
foreach(Item::getCreativeItems() as $i => $item){
|
||||
$pk->slots[$i] = clone $item;
|
||||
|
Reference in New Issue
Block a user