mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 01:46:04 +00:00
1.11.0 protocol changes
This commit is contained in:
@ -75,6 +75,7 @@ use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacketV1;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacketV2;
|
||||
use pocketmine\network\mcpe\protocol\LoginPacket;
|
||||
use pocketmine\network\mcpe\protocol\MapCreateLockedCopyPacket;
|
||||
use pocketmine\network\mcpe\protocol\MapInfoRequestPacket;
|
||||
use pocketmine\network\mcpe\protocol\MobArmorEquipmentPacket;
|
||||
use pocketmine\network\mcpe\protocol\MobEffectPacket;
|
||||
@ -87,6 +88,7 @@ use pocketmine\network\mcpe\protocol\MovePlayerPacket;
|
||||
use pocketmine\network\mcpe\protocol\NetworkChunkPublisherUpdatePacket;
|
||||
use pocketmine\network\mcpe\protocol\NetworkStackLatencyPacket;
|
||||
use pocketmine\network\mcpe\protocol\NpcRequestPacket;
|
||||
use pocketmine\network\mcpe\protocol\OnScreenTextureAnimationPacket;
|
||||
use pocketmine\network\mcpe\protocol\PhotoTransferPacket;
|
||||
use pocketmine\network\mcpe\protocol\PlaySoundPacket;
|
||||
use pocketmine\network\mcpe\protocol\PlayStatusPacket;
|
||||
@ -644,4 +646,12 @@ abstract class NetworkSession{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function handleMapCreateLockedCopy(MapCreateLockedCopyPacket $packet) : bool{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function handleOnScreenTextureAnimation(OnScreenTextureAnimationPacket $packet) : bool{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -46,6 +46,8 @@ class ClientboundMapItemDataPacket extends DataPacket{
|
||||
public $type;
|
||||
/** @var int */
|
||||
public $dimensionId = DimensionIds::OVERWORLD;
|
||||
/** @var bool */
|
||||
public $isLocked = false;
|
||||
|
||||
/** @var int[] */
|
||||
public $eids = [];
|
||||
@ -72,6 +74,7 @@ class ClientboundMapItemDataPacket extends DataPacket{
|
||||
$this->mapId = $this->getEntityUniqueId();
|
||||
$this->type = $this->getUnsignedVarInt();
|
||||
$this->dimensionId = $this->getByte();
|
||||
$this->isLocked = $this->getBool();
|
||||
|
||||
if(($this->type & 0x08) !== 0){
|
||||
$count = $this->getUnsignedVarInt();
|
||||
@ -144,6 +147,7 @@ class ClientboundMapItemDataPacket extends DataPacket{
|
||||
|
||||
$this->putUnsignedVarInt($type);
|
||||
$this->putByte($this->dimensionId);
|
||||
$this->putBool($this->isLocked);
|
||||
|
||||
if(($type & 0x08) !== 0){ //TODO: find out what these are for
|
||||
$this->putUnsignedVarInt($eidsCount);
|
||||
|
@ -83,6 +83,7 @@ class CraftingDataPacket extends DataPacket{
|
||||
$entry["output"][] = $this->getSlot();
|
||||
}
|
||||
$entry["uuid"] = $this->getUUID()->toString();
|
||||
$entry["block"] = $this->getString();
|
||||
|
||||
break;
|
||||
case self::ENTRY_SHAPED:
|
||||
@ -100,6 +101,8 @@ class CraftingDataPacket extends DataPacket{
|
||||
$entry["output"][] = $this->getSlot();
|
||||
}
|
||||
$entry["uuid"] = $this->getUUID()->toString();
|
||||
$entry["block"] = $this->getString();
|
||||
|
||||
break;
|
||||
case self::ENTRY_FURNACE:
|
||||
case self::ENTRY_FURNACE_DATA:
|
||||
@ -108,6 +111,8 @@ class CraftingDataPacket extends DataPacket{
|
||||
$entry["inputDamage"] = $this->getVarInt();
|
||||
}
|
||||
$entry["output"] = $this->getSlot();
|
||||
$entry["block"] = $this->getString();
|
||||
|
||||
break;
|
||||
case self::ENTRY_MULTI:
|
||||
$entry["uuid"] = $this->getUUID()->toString();
|
||||
@ -146,6 +151,7 @@ class CraftingDataPacket extends DataPacket{
|
||||
}
|
||||
|
||||
$stream->put(str_repeat("\x00", 16)); //Null UUID
|
||||
$stream->putString("crafting_table"); //TODO: blocktype (no prefix) (this might require internal API breaks)
|
||||
|
||||
return CraftingDataPacket::ENTRY_SHAPELESS;
|
||||
}
|
||||
@ -167,23 +173,21 @@ class CraftingDataPacket extends DataPacket{
|
||||
}
|
||||
|
||||
$stream->put(str_repeat("\x00", 16)); //Null UUID
|
||||
$stream->putString("crafting_table"); //TODO: blocktype (no prefix) (this might require internal API breaks)
|
||||
|
||||
return CraftingDataPacket::ENTRY_SHAPED;
|
||||
}
|
||||
|
||||
private static function writeFurnaceRecipe(FurnaceRecipe $recipe, NetworkBinaryStream $stream){
|
||||
$stream->putVarInt($recipe->getInput()->getId());
|
||||
$result = CraftingDataPacket::ENTRY_FURNACE;
|
||||
if(!$recipe->getInput()->hasAnyDamageValue()){ //Data recipe
|
||||
$stream->putVarInt($recipe->getInput()->getId());
|
||||
$stream->putVarInt($recipe->getInput()->getDamage());
|
||||
$stream->putSlot($recipe->getResult());
|
||||
|
||||
return CraftingDataPacket::ENTRY_FURNACE_DATA;
|
||||
}else{
|
||||
$stream->putVarInt($recipe->getInput()->getId());
|
||||
$stream->putSlot($recipe->getResult());
|
||||
|
||||
return CraftingDataPacket::ENTRY_FURNACE;
|
||||
$result = CraftingDataPacket::ENTRY_FURNACE_DATA;
|
||||
}
|
||||
$stream->putSlot($recipe->getResult());
|
||||
$stream->putString("furnace"); //TODO: blocktype (no prefix) (this might require internal API breaks)
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function addShapelessRecipe(ShapelessRecipe $recipe){
|
||||
|
@ -33,6 +33,8 @@ class LecternUpdatePacket extends DataPacket/* implements ServerboundPacket*/{
|
||||
/** @var int */
|
||||
public $page;
|
||||
/** @var int */
|
||||
public $totalPages;
|
||||
/** @var int */
|
||||
public $x;
|
||||
/** @var int */
|
||||
public $y;
|
||||
@ -43,12 +45,14 @@ class LecternUpdatePacket extends DataPacket/* implements ServerboundPacket*/{
|
||||
|
||||
protected function decodePayload() : void{
|
||||
$this->page = $this->getByte();
|
||||
$this->totalPages = $this->getByte();
|
||||
$this->getBlockPosition($this->x, $this->y, $this->z);
|
||||
$this->dropBook = $this->getBool();
|
||||
}
|
||||
|
||||
protected function encodePayload() : void{
|
||||
$this->putByte($this->page);
|
||||
$this->putByte($this->totalPages);
|
||||
$this->putBlockPosition($this->x, $this->y, $this->z);
|
||||
$this->putBool($this->dropBook);
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ class LevelSoundEventPacket extends DataPacket{
|
||||
public const SOUND_ITEM_TRIDENT_THUNDER = 184;
|
||||
public const SOUND_ITEM_TRIDENT_HIT_GROUND = 185;
|
||||
public const SOUND_DEFAULT = 186;
|
||||
|
||||
public const SOUND_BLOCK_FLETCHING_TABLE_USE = 187;
|
||||
public const SOUND_ELEMCONSTRUCT_OPEN = 188;
|
||||
public const SOUND_ICEBOMB_HIT = 189;
|
||||
public const SOUND_BALLOONPOP = 190;
|
||||
@ -283,7 +283,26 @@ class LevelSoundEventPacket extends DataPacket{
|
||||
public const SOUND_AMBIENT_AGGRESSIVE = 252;
|
||||
public const SOUND_AMBIENT_WORRIED = 253;
|
||||
public const SOUND_CANT_BREED = 254;
|
||||
public const SOUND_UNDEFINED = 255;
|
||||
public const SOUND_ITEM_SHIELD_BLOCK = 255;
|
||||
public const SOUND_ITEM_BOOK_PUT = 256;
|
||||
public const SOUND_BLOCK_GRINDSTONE_USE = 257;
|
||||
public const SOUND_BLOCK_BELL_HIT = 258;
|
||||
public const SOUND_BLOCK_CAMPFIRE_CRACKLE = 259;
|
||||
public const SOUND_ROAR = 260;
|
||||
public const SOUND_STUN = 261;
|
||||
public const SOUND_BLOCK_SWEET_BERRY_BUSH_HURT = 262;
|
||||
public const SOUND_BLOCK_SWEET_BERRY_BUSH_PICK = 263;
|
||||
public const SOUND_UI_CARTOGRAPHY_TABLE_TAKE_RESULT = 264;
|
||||
public const SOUND_UI_STONECUTTER_TAKE_RESULT = 265;
|
||||
public const SOUND_BLOCK_COMPOSTER_EMPTY = 266;
|
||||
public const SOUND_BLOCK_COMPOSTER_FILL = 267;
|
||||
public const SOUND_BLOCK_COMPOSTER_FILL_SUCCESS = 268;
|
||||
public const SOUND_BLOCK_COMPOSTER_READY = 269;
|
||||
public const SOUND_BLOCK_BARREL_OPEN = 270;
|
||||
public const SOUND_BLOCK_BARREL_CLOSE = 271;
|
||||
public const SOUND_RAID_HORN = 272;
|
||||
public const SOUND_BLOCK_LOOM_USE = 273;
|
||||
public const SOUND_UNDEFINED = 274;
|
||||
|
||||
/** @var int */
|
||||
public $sound;
|
||||
|
@ -0,0 +1,51 @@
|
||||
<?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\network\mcpe\NetworkSession;
|
||||
|
||||
class MapCreateLockedCopyPacket extends DataPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::MAP_CREATE_LOCKED_COPY_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $originalMapId;
|
||||
/** @var int */
|
||||
public $newMapId;
|
||||
|
||||
protected function decodePayload() : void{
|
||||
$this->originalMapId = $this->getEntityUniqueId();
|
||||
$this->newMapId = $this->getEntityUniqueId();
|
||||
}
|
||||
|
||||
protected function encodePayload() : void{
|
||||
$this->putEntityUniqueId($this->originalMapId);
|
||||
$this->putEntityUniqueId($this->newMapId);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $handler) : bool{
|
||||
return $handler->handleMapCreateLockedCopy($this);
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
<?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\network\mcpe\NetworkSession;
|
||||
|
||||
class OnScreenTextureAnimationPacket extends DataPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::ON_SCREEN_TEXTURE_ANIMATION_PACKET;
|
||||
|
||||
/** @var int */
|
||||
public $effectId;
|
||||
|
||||
protected function decodePayload() : void{
|
||||
$this->effectId = $this->getLInt(); //unsigned
|
||||
}
|
||||
|
||||
protected function encodePayload() : void{
|
||||
$this->putLInt($this->effectId);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $handler) : bool{
|
||||
return $handler->handleOnScreenTextureAnimation($this);
|
||||
}
|
||||
}
|
@ -156,6 +156,8 @@ class PacketPool{
|
||||
static::registerPacket(new LevelSoundEventPacket());
|
||||
static::registerPacket(new LecternUpdatePacket());
|
||||
static::registerPacket(new VideoStreamConnectPacket());
|
||||
static::registerPacket(new MapCreateLockedCopyPacket());
|
||||
static::registerPacket(new OnScreenTextureAnimationPacket());
|
||||
|
||||
static::registerPacket(new BatchPacket());
|
||||
}
|
||||
|
@ -39,15 +39,15 @@ interface ProtocolInfo{
|
||||
/**
|
||||
* Actual Minecraft: PE protocol version
|
||||
*/
|
||||
public const CURRENT_PROTOCOL = 340;
|
||||
public const CURRENT_PROTOCOL = 354;
|
||||
/**
|
||||
* Current Minecraft PE version reported by the server. This is usually the earliest currently supported version.
|
||||
*/
|
||||
public const MINECRAFT_VERSION = 'v1.10.0';
|
||||
public const MINECRAFT_VERSION = 'v1.11.0';
|
||||
/**
|
||||
* Version number sent to clients in ping responses.
|
||||
*/
|
||||
public const MINECRAFT_VERSION_NETWORK = '1.10.0';
|
||||
public const MINECRAFT_VERSION_NETWORK = '1.11.0';
|
||||
|
||||
public const LOGIN_PACKET = 0x01;
|
||||
public const PLAY_STATUS_PACKET = 0x02;
|
||||
@ -174,5 +174,7 @@ interface ProtocolInfo{
|
||||
public const LEVEL_SOUND_EVENT_PACKET = 0x7b;
|
||||
public const LECTERN_UPDATE_PACKET = 0x7c;
|
||||
public const VIDEO_STREAM_CONNECT_PACKET = 0x7d;
|
||||
public const MAP_CREATE_LOCKED_COPY_PACKET = 0x7e;
|
||||
public const ON_SCREEN_TEXTURE_ANIMATION_PACKET = 0x7f;
|
||||
|
||||
}
|
||||
|
@ -40,45 +40,45 @@ class UpdateTradePacket extends DataPacket{
|
||||
/** @var int */
|
||||
public $windowType = WindowTypes::TRADING; //Mojang hardcoded this -_-
|
||||
/** @var int */
|
||||
public $varint1;
|
||||
public $thisIsAlwaysZero = 0; //hardcoded to 0
|
||||
/** @var int */
|
||||
public $varint2;
|
||||
/** @var int */
|
||||
public $varint3;
|
||||
/** @var bool */
|
||||
public $isWilling;
|
||||
public $tradeTier;
|
||||
/** @var int */
|
||||
public $traderEid;
|
||||
/** @var int */
|
||||
public $playerEid;
|
||||
/** @var string */
|
||||
public $displayName;
|
||||
/** @var bool */
|
||||
public $isWilling;
|
||||
/** @var bool */
|
||||
public $isV2Trading;
|
||||
/** @var string */
|
||||
public $offers;
|
||||
|
||||
protected function decodePayload(){
|
||||
$this->windowId = $this->getByte();
|
||||
$this->windowType = $this->getByte();
|
||||
$this->varint1 = $this->getVarInt();
|
||||
$this->varint2 = $this->getVarInt();
|
||||
$this->varint3 = $this->getVarInt();
|
||||
$this->isWilling = $this->getBool();
|
||||
$this->thisIsAlwaysZero = $this->getVarInt();
|
||||
$this->tradeTier = $this->getVarInt();
|
||||
$this->traderEid = $this->getEntityUniqueId();
|
||||
$this->playerEid = $this->getEntityUniqueId();
|
||||
$this->displayName = $this->getString();
|
||||
$this->isWilling = $this->getBool();
|
||||
$this->isV2Trading = $this->getBool();
|
||||
$this->offers = $this->getRemaining();
|
||||
}
|
||||
|
||||
protected function encodePayload(){
|
||||
$this->putByte($this->windowId);
|
||||
$this->putByte($this->windowType);
|
||||
$this->putVarInt($this->varint1);
|
||||
$this->putVarInt($this->varint2);
|
||||
$this->putVarInt($this->varint3);
|
||||
$this->putBool($this->isWilling);
|
||||
$this->putVarInt($this->thisIsAlwaysZero);
|
||||
$this->putVarInt($this->tradeTier);
|
||||
$this->putEntityUniqueId($this->traderEid);
|
||||
$this->putEntityUniqueId($this->playerEid);
|
||||
$this->putString($this->displayName);
|
||||
$this->putBool($this->isWilling);
|
||||
$this->putBool($this->isV2Trading);
|
||||
$this->put($this->offers);
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,8 @@ namespace pocketmine\network\mcpe\protocol\types;
|
||||
|
||||
interface WindowTypes{
|
||||
|
||||
public const NONE = -9;
|
||||
|
||||
public const INVENTORY = -1;
|
||||
public const CONTAINER = 0;
|
||||
public const WORKBENCH = 1;
|
||||
@ -47,4 +49,13 @@ interface WindowTypes{
|
||||
public const COMMAND_BLOCK = 16;
|
||||
public const JUKEBOX = 17;
|
||||
|
||||
public const COMPOUND_CREATOR = 20;
|
||||
public const ELEMENT_CONSTRUCTOR = 21;
|
||||
public const MATERIAL_REDUCER = 22;
|
||||
public const LAB_TABLE = 23;
|
||||
|
||||
public const BLAST_FURNACE = 27;
|
||||
public const SMOKER = 28;
|
||||
public const STONECUTTER = 29;
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user