diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index c43370272c..dcec663c40 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -156,6 +156,8 @@ use pocketmine\network\mcpe\protocol\types\inventory\UIInventorySlotOffset; use pocketmine\network\mcpe\protocol\types\NetworkInventoryAction; use pocketmine\network\mcpe\protocol\types\PersonaPieceTintColor; use pocketmine\network\mcpe\protocol\types\PersonaSkinPiece; +use pocketmine\network\mcpe\protocol\types\PlayerMovementSettings; +use pocketmine\network\mcpe\protocol\types\PlayerMovementType; use pocketmine\network\mcpe\protocol\types\PlayerPermissions; use pocketmine\network\mcpe\protocol\types\SkinAdapterSingleton; use pocketmine\network\mcpe\protocol\types\SkinAnimation; @@ -1957,6 +1959,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $skinData = new SkinData( $packet->clientData["SkinId"], + $packet->clientData["PlayFabId"], base64_decode($packet->clientData["SkinResourcePatch"] ?? "", true), new SkinImage( $packet->clientData["SkinImageHeight"], @@ -2268,6 +2271,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $pk->worldName = $this->server->getMotd(); $pk->experiments = new Experiments([], false); $pk->itemTable = ItemTypeDictionary::getInstance()->getEntries(); + $pk->playerMovementSettings = new PlayerMovementSettings(PlayerMovementType::LEGACY, 0, false); $this->dataPacket($pk); $this->sendDataPacket(new AvailableActorIdentifiersPacket()); @@ -2975,7 +2979,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ case PlayerActionPacket::ACTION_START_GLIDE: case PlayerActionPacket::ACTION_STOP_GLIDE: break; //TODO - case PlayerActionPacket::ACTION_CONTINUE_BREAK: + case PlayerActionPacket::ACTION_CRACK_BREAK: $block = $this->level->getBlock($pos); $this->level->broadcastLevelEvent($pos, LevelEventPacket::EVENT_PARTICLE_PUNCH_BLOCK, $block->getRuntimeId() | ($packet->face << 24)); //TODO: destroy-progress level event diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index 87f25c208d..419a4ee14d 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -175,56 +175,56 @@ abstract class Entity extends Location implements Metadatable, EntityIds{ public const DATA_RIDER_ROTATION_LOCKED = 57; //byte public const DATA_RIDER_MAX_ROTATION = 58; //float public const DATA_RIDER_MIN_ROTATION = 59; //float - public const DATA_AREA_EFFECT_CLOUD_RADIUS = 60; //float - public const DATA_AREA_EFFECT_CLOUD_WAITING = 61; //int - public const DATA_AREA_EFFECT_CLOUD_PARTICLE_ID = 62; //int - /* 63 (int) shulker-related */ - public const DATA_SHULKER_ATTACH_FACE = 64; //byte - /* 65 (short) shulker-related */ - public const DATA_SHULKER_ATTACH_POS = 66; //block coords - public const DATA_TRADING_PLAYER_EID = 67; //long + public const DATA_AREA_EFFECT_CLOUD_RADIUS = 61; //float + public const DATA_AREA_EFFECT_CLOUD_WAITING = 62; //int + public const DATA_AREA_EFFECT_CLOUD_PARTICLE_ID = 63; //int + /* 64 (int) shulker-related */ + public const DATA_SHULKER_ATTACH_FACE = 65; //byte + /* 66 (short) shulker-related */ + public const DATA_SHULKER_ATTACH_POS = 67; //block coords + public const DATA_TRADING_PLAYER_EID = 68; //long - /* 69 (byte) command-block */ - public const DATA_COMMAND_BLOCK_COMMAND = 70; //string - public const DATA_COMMAND_BLOCK_LAST_OUTPUT = 71; //string - public const DATA_COMMAND_BLOCK_TRACK_OUTPUT = 72; //byte - public const DATA_CONTROLLING_RIDER_SEAT_NUMBER = 73; //byte - public const DATA_STRENGTH = 74; //int - public const DATA_MAX_STRENGTH = 75; //int - /* 76 (int) */ - public const DATA_LIMITED_LIFE = 77; - public const DATA_ARMOR_STAND_POSE_INDEX = 78; //int - public const DATA_ENDER_CRYSTAL_TIME_OFFSET = 79; //int - public const DATA_ALWAYS_SHOW_NAMETAG = 80; //byte: -1 = default, 0 = only when looked at, 1 = always - public const DATA_COLOR_2 = 81; //byte - /* 82 (unknown) */ - public const DATA_SCORE_TAG = 83; //string - public const DATA_BALLOON_ATTACHED_ENTITY = 84; //int64, entity unique ID of owner - public const DATA_PUFFERFISH_SIZE = 85; //byte - public const DATA_BOAT_BUBBLE_TIME = 86; //int (time in bubble column) - public const DATA_PLAYER_AGENT_EID = 87; //long - /* 88 (float) related to panda sitting - * 89 (float) related to panda sitting */ - public const DATA_EAT_COUNTER = 90; //int (used by pandas) - public const DATA_FLAGS2 = 91; //long (extended data flags) - /* 92 (float) related to panda lying down - * 93 (float) related to panda lying down */ - public const DATA_AREA_EFFECT_CLOUD_DURATION = 94; //int - public const DATA_AREA_EFFECT_CLOUD_SPAWN_TIME = 95; //int - public const DATA_AREA_EFFECT_CLOUD_RADIUS_PER_TICK = 96; //float, usually negative - public const DATA_AREA_EFFECT_CLOUD_RADIUS_CHANGE_ON_PICKUP = 97; //float - public const DATA_AREA_EFFECT_CLOUD_PICKUP_COUNT = 98; //int - public const DATA_INTERACTIVE_TAG = 99; //string (button text) - public const DATA_TRADE_TIER = 100; //int - public const DATA_MAX_TRADE_TIER = 101; //int - public const DATA_TRADE_XP = 102; //int - public const DATA_SKIN_ID = 103; //int ??? - /* 104 (int) related to wither */ - public const DATA_COMMAND_BLOCK_TICK_DELAY = 105; //int - public const DATA_COMMAND_BLOCK_EXECUTE_ON_FIRST_TICK = 106; //byte - public const DATA_AMBIENT_SOUND_INTERVAL_MIN = 107; //float - public const DATA_AMBIENT_SOUND_INTERVAL_RANGE = 108; //float - public const DATA_AMBIENT_SOUND_EVENT = 109; //string + /* 70 (byte) command-block */ + public const DATA_COMMAND_BLOCK_COMMAND = 71; //string + public const DATA_COMMAND_BLOCK_LAST_OUTPUT = 72; //string + public const DATA_COMMAND_BLOCK_TRACK_OUTPUT = 73; //byte + public const DATA_CONTROLLING_RIDER_SEAT_NUMBER = 74; //byte + public const DATA_STRENGTH = 75; //int + public const DATA_MAX_STRENGTH = 76; //int + /* 77 (int) */ + public const DATA_LIMITED_LIFE = 78; + public const DATA_ARMOR_STAND_POSE_INDEX = 79; //int + public const DATA_ENDER_CRYSTAL_TIME_OFFSET = 80; //int + public const DATA_ALWAYS_SHOW_NAMETAG = 81; //byte: -1 = default, 0 = only when looked at, 1 = always + public const DATA_COLOR_2 = 82; //byte + /* 83 (unknown) */ + public const DATA_SCORE_TAG = 84; //string + public const DATA_BALLOON_ATTACHED_ENTITY = 85; //int64, entity unique ID of owner + public const DATA_PUFFERFISH_SIZE = 86; //byte + public const DATA_BOAT_BUBBLE_TIME = 87; //int (time in bubble column) + public const DATA_PLAYER_AGENT_EID = 88; //long + /* 89 (float) related to panda sitting + * 90 (float) related to panda sitting */ + public const DATA_EAT_COUNTER = 91; //int (used by pandas) + public const DATA_FLAGS2 = 92; //long (extended data flags) + /* 93 (float) related to panda lying down + * 94 (float) related to panda lying down */ + public const DATA_AREA_EFFECT_CLOUD_DURATION = 95; //int + public const DATA_AREA_EFFECT_CLOUD_SPAWN_TIME = 96; //int + public const DATA_AREA_EFFECT_CLOUD_RADIUS_PER_TICK = 97; //float, usually negative + public const DATA_AREA_EFFECT_CLOUD_RADIUS_CHANGE_ON_PICKUP = 98; //float + public const DATA_AREA_EFFECT_CLOUD_PICKUP_COUNT = 99; //int + public const DATA_INTERACTIVE_TAG = 100; //string (button text) + public const DATA_TRADE_TIER = 101; //int + public const DATA_MAX_TRADE_TIER = 102; //int + public const DATA_TRADE_XP = 103; //int + public const DATA_SKIN_ID = 104; //int ??? + /* 105 (int) related to wither */ + public const DATA_COMMAND_BLOCK_TICK_DELAY = 106; //int + public const DATA_COMMAND_BLOCK_EXECUTE_ON_FIRST_TICK = 107; //byte + public const DATA_AMBIENT_SOUND_INTERVAL_MIN = 108; //float + public const DATA_AMBIENT_SOUND_INTERVAL_RANGE = 109; //float + public const DATA_AMBIENT_SOUND_EVENT = 110; //string public const DATA_FLAG_ONFIRE = 0; public const DATA_FLAG_SNEAKING = 1; diff --git a/src/pocketmine/network/mcpe/NetworkBinaryStream.php b/src/pocketmine/network/mcpe/NetworkBinaryStream.php index 66c10c573a..a045ce3e58 100644 --- a/src/pocketmine/network/mcpe/NetworkBinaryStream.php +++ b/src/pocketmine/network/mcpe/NetworkBinaryStream.php @@ -87,6 +87,7 @@ class NetworkBinaryStream extends BinaryStream{ public function getSkin() : SkinData{ $skinId = $this->getString(); + $skinPlayFabId = $this->getString(); $skinResourcePatch = $this->getString(); $skinData = $this->getSkinImage(); $animationCount = $this->getLInt(); @@ -133,7 +134,7 @@ class NetworkBinaryStream extends BinaryStream{ ); } - return new SkinData($skinId, $skinResourcePatch, $skinData, $animations, $capeData, $geometryData, $animationData, $premium, $persona, $capeOnClassic, $capeId, $fullSkinId, $armSize, $skinColor, $personaPieces, $pieceTintColors); + return new SkinData($skinId, $skinPlayFabId, $skinResourcePatch, $skinData, $animations, $capeData, $geometryData, $animationData, $premium, $persona, $capeOnClassic, $capeId, $fullSkinId, $armSize, $skinColor, $personaPieces, $pieceTintColors); } /** @@ -141,6 +142,7 @@ class NetworkBinaryStream extends BinaryStream{ */ public function putSkin(SkinData $skin){ $this->putString($skin->getSkinId()); + $this->putString($skin->getPlayFabId()); $this->putString($skin->getResourcePatch()); $this->putSkinImage($skin->getSkinImage()); $this->putLInt(count($skin->getAnimations())); diff --git a/src/pocketmine/network/mcpe/NetworkSession.php b/src/pocketmine/network/mcpe/NetworkSession.php index f6b6cecbe8..f9b77f8fef 100644 --- a/src/pocketmine/network/mcpe/NetworkSession.php +++ b/src/pocketmine/network/mcpe/NetworkSession.php @@ -48,6 +48,7 @@ use pocketmine\network\mcpe\protocol\CameraPacket; use pocketmine\network\mcpe\protocol\CameraShakePacket; use pocketmine\network\mcpe\protocol\ChangeDimensionPacket; use pocketmine\network\mcpe\protocol\ChunkRadiusUpdatedPacket; +use pocketmine\network\mcpe\protocol\ClientboundDebugRendererPacket; use pocketmine\network\mcpe\protocol\ClientboundMapItemDataPacket; use pocketmine\network\mcpe\protocol\ClientCacheBlobStatusPacket; use pocketmine\network\mcpe\protocol\ClientCacheMissResponsePacket; @@ -821,4 +822,8 @@ abstract class NetworkSession{ public function handleFilterText(FilterTextPacket $packet) : bool{ return false; } + + public function handleClientboundDebugRenderer(ClientboundDebugRendererPacket $packet) : bool{ + return false; + } } diff --git a/src/pocketmine/network/mcpe/protocol/AdventureSettingsPacket.php b/src/pocketmine/network/mcpe/protocol/AdventureSettingsPacket.php index b6c72b01e3..427784d325 100644 --- a/src/pocketmine/network/mcpe/protocol/AdventureSettingsPacket.php +++ b/src/pocketmine/network/mcpe/protocol/AdventureSettingsPacket.php @@ -54,13 +54,15 @@ class AdventureSettingsPacket extends DataPacket{ public const FLYING = 0x200; public const MUTED = 0x400; - public const BUILD_AND_MINE = 0x01 | self::BITFLAG_SECOND_SET; + public const MINE = 0x01 | self::BITFLAG_SECOND_SET; public const DOORS_AND_SWITCHES = 0x02 | self::BITFLAG_SECOND_SET; public const OPEN_CONTAINERS = 0x04 | self::BITFLAG_SECOND_SET; public const ATTACK_PLAYERS = 0x08 | self::BITFLAG_SECOND_SET; public const ATTACK_MOBS = 0x10 | self::BITFLAG_SECOND_SET; public const OPERATOR = 0x20 | self::BITFLAG_SECOND_SET; public const TELEPORT = 0x80 | self::BITFLAG_SECOND_SET; + public const BUILD = 0x100 | self::BITFLAG_SECOND_SET; + public const DEFAULT = 0x200 | self::BITFLAG_SECOND_SET; /** @var int */ public $flags = 0; diff --git a/src/pocketmine/network/mcpe/protocol/CameraShakePacket.php b/src/pocketmine/network/mcpe/protocol/CameraShakePacket.php index 553912abb7..9f6a7acd43 100644 --- a/src/pocketmine/network/mcpe/protocol/CameraShakePacket.php +++ b/src/pocketmine/network/mcpe/protocol/CameraShakePacket.php @@ -33,18 +33,24 @@ class CameraShakePacket extends DataPacket/* implements ClientboundPacket*/{ public const TYPE_POSITIONAL = 0; public const TYPE_ROTATIONAL = 1; + public const ACTION_ADD = 0; + public const ACTION_STOP = 1; + /** @var float */ private $intensity; /** @var float */ private $duration; /** @var int */ private $shakeType; + /** @var int */ + private $shakeAction; - public static function create(float $intensity, float $duration, int $shakeType) : self{ + public static function create(float $intensity, float $duration, int $shakeType, int $shakeAction) : self{ $result = new self; $result->intensity = $intensity; $result->duration = $duration; $result->shakeType = $shakeType; + $result->shakeAction = $shakeAction; return $result; } @@ -54,16 +60,20 @@ class CameraShakePacket extends DataPacket/* implements ClientboundPacket*/{ public function getShakeType() : int{ return $this->shakeType; } + public function getShakeAction() : int{ return $this->shakeAction; } + protected function decodePayload() : void{ $this->intensity = $this->getLFloat(); $this->duration = $this->getLFloat(); $this->shakeType = $this->getByte(); + $this->shakeAction = $this->getByte(); } protected function encodePayload() : void{ $this->putLFloat($this->intensity); $this->putLFloat($this->duration); $this->putByte($this->shakeType); + $this->putByte($this->shakeAction); } public function handle(NetworkSession $handler) : bool{ diff --git a/src/pocketmine/network/mcpe/protocol/ClientboundDebugRendererPacket.php b/src/pocketmine/network/mcpe/protocol/ClientboundDebugRendererPacket.php new file mode 100644 index 0000000000..30f78fd0f6 --- /dev/null +++ b/src/pocketmine/network/mcpe/protocol/ClientboundDebugRendererPacket.php @@ -0,0 +1,137 @@ + + +use pocketmine\math\Vector3; +use pocketmine\network\mcpe\NetworkSession; + +class ClientboundDebugRendererPacket extends DataPacket/* implements ClientboundPacket*/{ + public const NETWORK_ID = ProtocolInfo::CLIENTBOUND_DEBUG_RENDERER_PACKET; + + public const TYPE_CLEAR = 1; + public const TYPE_ADD_CUBE = 2; + + /** @var int */ + private $type; + + //TODO: if more types are added, we'll probably want to make a separate data type and interfaces + /** @var string */ + private $text; + /** @var Vector3 */ + private $position; + /** @var float */ + private $red; + /** @var float */ + private $green; + /** @var float */ + private $blue; + /** @var float */ + private $alpha; + /** @var int */ + private $durationMillis; + + private static function base(int $type) : self{ + $result = new self; + $result->type = $type; + return $result; + } + + public static function clear() : self{ return self::base(self::TYPE_CLEAR); } + + public static function addCube(string $text, Vector3 $position, float $red, float $green, float $blue, float $alpha, int $durationMillis) : self{ + $result = self::base(self::TYPE_ADD_CUBE); + $result->text = $text; + $result->position = $position; + $result->red = $red; + $result->green = $green; + $result->blue = $blue; + $result->alpha = $alpha; + $result->durationMillis = $durationMillis; + return $result; + } + + public function getType() : int{ return $this->type; } + + public function getText() : string{ return $this->text; } + + public function getPosition() : Vector3{ return $this->position; } + + public function getRed() : float{ return $this->red; } + + public function getGreen() : float{ return $this->green; } + + public function getBlue() : float{ return $this->blue; } + + public function getAlpha() : float{ return $this->alpha; } + + public function getDurationMillis() : int{ return $this->durationMillis; } + + protected function decodePayload() : void{ + $this->type = $this->getLInt(); + + switch($this->type){ + case self::TYPE_CLEAR: + //NOOP + break; + case self::TYPE_ADD_CUBE: + $this->text = $this->getString(); + $this->position = $this->getVector3(); + $this->red = $this->getLFloat(); + $this->green = $this->getLFloat(); + $this->blue = $this->getLFloat(); + $this->alpha = $this->getLFloat(); + $this->durationMillis = $this->getLLong(); + break; + default: + throw new \UnexpectedValueException("Unknown type " . $this->type); + } + } + + protected function encodePayload() : void{ + $this->putLInt($this->type); + + switch($this->type){ + case self::TYPE_CLEAR: + //NOOP + break; + case self::TYPE_ADD_CUBE: + $this->putString($this->text); + $this->putVector3($this->position); + $this->putLFloat($this->red); + $this->putLFloat($this->green); + $this->putLFloat($this->blue); + $this->putLFloat($this->alpha); + $this->putLLong($this->durationMillis); + break; + default: + throw new \InvalidArgumentException("Unknown type " . $this->type); + } + } + + public function handle(NetworkSession $session) : bool{ + return $session->handleClientboundDebugRenderer($this); + } +} diff --git a/src/pocketmine/network/mcpe/protocol/PacketPool.php b/src/pocketmine/network/mcpe/protocol/PacketPool.php index b0e912a153..d91cf2ae21 100644 --- a/src/pocketmine/network/mcpe/protocol/PacketPool.php +++ b/src/pocketmine/network/mcpe/protocol/PacketPool.php @@ -194,6 +194,7 @@ class PacketPool{ static::registerPacket(new CorrectPlayerMovePredictionPacket()); static::registerPacket(new ItemComponentPacket()); static::registerPacket(new FilterTextPacket()); + static::registerPacket(new ClientboundDebugRendererPacket()); } /** diff --git a/src/pocketmine/network/mcpe/protocol/PlayerActionPacket.php b/src/pocketmine/network/mcpe/protocol/PlayerActionPacket.php index f6fb8d0533..394a7232d6 100644 --- a/src/pocketmine/network/mcpe/protocol/PlayerActionPacket.php +++ b/src/pocketmine/network/mcpe/protocol/PlayerActionPacket.php @@ -48,7 +48,7 @@ class PlayerActionPacket extends DataPacket{ public const ACTION_START_GLIDE = 15; public const ACTION_STOP_GLIDE = 16; public const ACTION_BUILD_DENIED = 17; - public const ACTION_CONTINUE_BREAK = 18; + public const ACTION_CRACK_BREAK = 18; public const ACTION_CHANGE_SKIN = 19; public const ACTION_SET_ENCHANTMENT_SEED = 20; //no longer used public const ACTION_START_SWIMMING = 21; @@ -56,6 +56,8 @@ class PlayerActionPacket extends DataPacket{ public const ACTION_START_SPIN_ATTACK = 23; public const ACTION_STOP_SPIN_ATTACK = 24; public const ACTION_INTERACT_BLOCK = 25; + public const ACTION_PREDICT_DESTROY_BLOCK = 26; + public const ACTION_CONTINUE_DESTROY_BLOCK = 27; /** @var int */ public $entityRuntimeId; diff --git a/src/pocketmine/network/mcpe/protocol/ProtocolInfo.php b/src/pocketmine/network/mcpe/protocol/ProtocolInfo.php index 28f421b041..ec8d667b53 100644 --- a/src/pocketmine/network/mcpe/protocol/ProtocolInfo.php +++ b/src/pocketmine/network/mcpe/protocol/ProtocolInfo.php @@ -37,11 +37,11 @@ interface ProtocolInfo{ */ /** Actual Minecraft: PE protocol version */ - public const CURRENT_PROTOCOL = 422; + public const CURRENT_PROTOCOL = 428; /** Current Minecraft PE version reported by the server. This is usually the earliest currently supported version. */ - public const MINECRAFT_VERSION = 'v1.16.200'; + public const MINECRAFT_VERSION = 'v1.16.210'; /** Version number sent to clients in ping responses. */ - public const MINECRAFT_VERSION_NETWORK = '1.16.200'; + public const MINECRAFT_VERSION_NETWORK = '1.16.210'; public const LOGIN_PACKET = 0x01; public const PLAY_STATUS_PACKET = 0x02; @@ -206,5 +206,6 @@ interface ProtocolInfo{ public const CORRECT_PLAYER_MOVE_PREDICTION_PACKET = 0xa1; public const ITEM_COMPONENT_PACKET = 0xa2; public const FILTER_TEXT_PACKET = 0xa3; + public const CLIENTBOUND_DEBUG_RENDERER_PACKET = 0xa4; } diff --git a/src/pocketmine/network/mcpe/protocol/StartGamePacket.php b/src/pocketmine/network/mcpe/protocol/StartGamePacket.php index bf0d993c62..8c59611021 100644 --- a/src/pocketmine/network/mcpe/protocol/StartGamePacket.php +++ b/src/pocketmine/network/mcpe/protocol/StartGamePacket.php @@ -35,7 +35,7 @@ use pocketmine\network\mcpe\protocol\types\GameRuleType; use pocketmine\network\mcpe\protocol\types\GeneratorType; use pocketmine\network\mcpe\protocol\types\ItemTypeEntry; use pocketmine\network\mcpe\protocol\types\MultiplayerGameVisibility; -use pocketmine\network\mcpe\protocol\types\PlayerMovementType; +use pocketmine\network\mcpe\protocol\types\PlayerMovementSettings; use pocketmine\network\mcpe\protocol\types\PlayerPermissions; use pocketmine\network\mcpe\protocol\types\SpawnSettings; use function count; @@ -154,8 +154,8 @@ class StartGamePacket extends DataPacket{ public $premiumWorldTemplateId = ""; /** @var bool */ public $isTrial = false; - /** @var int */ - public $playerMovementType = PlayerMovementType::LEGACY; + /** @var PlayerMovementSettings */ + public $playerMovementSettings; /** @var int */ public $currentTick = 0; //only used if isTrial is true /** @var int */ @@ -235,7 +235,7 @@ class StartGamePacket extends DataPacket{ $this->worldName = $this->getString(); $this->premiumWorldTemplateId = $this->getString(); $this->isTrial = $this->getBool(); - $this->playerMovementType = $this->getVarInt(); + $this->playerMovementSettings = PlayerMovementSettings::read($this); $this->currentTick = $this->getLLong(); $this->enchantmentSeed = $this->getVarInt(); @@ -317,7 +317,7 @@ class StartGamePacket extends DataPacket{ $this->putString($this->worldName); $this->putString($this->premiumWorldTemplateId); $this->putBool($this->isTrial); - $this->putVarInt($this->playerMovementType); + $this->playerMovementSettings->write($this); $this->putLLong($this->currentTick); $this->putVarInt($this->enchantmentSeed); diff --git a/src/pocketmine/network/mcpe/protocol/types/LegacySkinAdapter.php b/src/pocketmine/network/mcpe/protocol/types/LegacySkinAdapter.php index 3442030301..44900f65c7 100644 --- a/src/pocketmine/network/mcpe/protocol/types/LegacySkinAdapter.php +++ b/src/pocketmine/network/mcpe/protocol/types/LegacySkinAdapter.php @@ -44,6 +44,7 @@ class LegacySkinAdapter implements SkinAdapter{ } return new SkinData( $skin->getSkinId(), + "", //TODO: playfab ID json_encode(["geometry" => ["default" => $geometryName]]), SkinImage::fromLegacy($skin->getSkinData()), [], $capeImage, diff --git a/src/pocketmine/network/mcpe/protocol/types/PlayerMovementSettings.php b/src/pocketmine/network/mcpe/protocol/types/PlayerMovementSettings.php new file mode 100644 index 0000000000..67f2015caf --- /dev/null +++ b/src/pocketmine/network/mcpe/protocol/types/PlayerMovementSettings.php @@ -0,0 +1,61 @@ +movementType = $movementType; + $this->rewindHistorySize = $rewindHistorySize; + //do not ask me what the F this is doing here + $this->serverAuthoritativeBlockBreaking = $serverAuthoritativeBlockBreaking; + } + + public function getMovementType() : int{ return $this->movementType; } + + public function getRewindHistorySize() : int{ return $this->rewindHistorySize; } + + public function isServerAuthoritativeBlockBreaking() : bool{ return $this->serverAuthoritativeBlockBreaking; } + + public static function read(NetworkBinaryStream $in) : self{ + $movementType = $in->getVarInt(); + $rewindHistorySize = $in->getVarInt(); + $serverAuthBlockBreaking = $in->getBool(); + return new self($movementType, $rewindHistorySize, $serverAuthBlockBreaking); + } + + public function write(NetworkBinaryStream $out) : void{ + $out->putVarInt($this->movementType); + $out->putVarInt($this->rewindHistorySize); + $out->putBool($this->serverAuthoritativeBlockBreaking); + } +} diff --git a/src/pocketmine/network/mcpe/protocol/types/SkinData.php b/src/pocketmine/network/mcpe/protocol/types/SkinData.php index c33876f428..1ef9c43f92 100644 --- a/src/pocketmine/network/mcpe/protocol/types/SkinData.php +++ b/src/pocketmine/network/mcpe/protocol/types/SkinData.php @@ -33,6 +33,8 @@ class SkinData{ /** @var string */ private $skinId; /** @var string */ + private $playFabId; + /** @var string */ private $resourcePatch; /** @var SkinImage */ private $skinImage; @@ -70,8 +72,9 @@ class SkinData{ * @param PersonaSkinPiece[] $personaPieces * @param PersonaPieceTintColor[] $pieceTintColors */ - public function __construct(string $skinId, string $resourcePatch, SkinImage $skinImage, array $animations = [], SkinImage $capeImage = null, string $geometryData = "", string $animationData = "", bool $premium = false, bool $persona = false, bool $personaCapeOnClassic = false, string $capeId = "", ?string $fullSkinId = null, string $armSize = self::ARM_SIZE_WIDE, string $skinColor = "", array $personaPieces = [], array $pieceTintColors = [], bool $isVerified = true){ + public function __construct(string $skinId, string $playFabId, string $resourcePatch, SkinImage $skinImage, array $animations = [], SkinImage $capeImage = null, string $geometryData = "", string $animationData = "", bool $premium = false, bool $persona = false, bool $personaCapeOnClassic = false, string $capeId = "", ?string $fullSkinId = null, string $armSize = self::ARM_SIZE_WIDE, string $skinColor = "", array $personaPieces = [], array $pieceTintColors = [], bool $isVerified = true){ $this->skinId = $skinId; + $this->playFabId = $playFabId; $this->resourcePatch = $resourcePatch; $this->skinImage = $skinImage; $this->animations = $animations; @@ -95,6 +98,8 @@ class SkinData{ return $this->skinId; } + public function getPlayFabId() : string{ return $this->playFabId; } + public function getResourcePatch() : string{ return $this->resourcePatch; } diff --git a/src/pocketmine/network/mcpe/protocol/types/inventory/stackrequest/ItemStackRequest.php b/src/pocketmine/network/mcpe/protocol/types/inventory/stackrequest/ItemStackRequest.php index 16e3f779f7..ddd883020b 100644 --- a/src/pocketmine/network/mcpe/protocol/types/inventory/stackrequest/ItemStackRequest.php +++ b/src/pocketmine/network/mcpe/protocol/types/inventory/stackrequest/ItemStackRequest.php @@ -71,6 +71,7 @@ final class ItemStackRequest{ case CraftingMarkSecondaryResultStackRequestAction::getTypeId(): return CraftingMarkSecondaryResultStackRequestAction::read($in); case LabTableCombineStackRequestAction::getTypeId(): return LabTableCombineStackRequestAction::read($in); case BeaconPaymentStackRequestAction::getTypeId(): return BeaconPaymentStackRequestAction::read($in); + case MineBlockStackRequestAction::getTypeId(): return MineBlockStackRequestAction::read($in); case CraftRecipeStackRequestAction::getTypeId(): return CraftRecipeStackRequestAction::read($in); case CraftRecipeAutoStackRequestAction::getTypeId(): return CraftRecipeAutoStackRequestAction::read($in); case CreativeCreateStackRequestAction::getTypeId(): return CreativeCreateStackRequestAction::read($in); diff --git a/src/pocketmine/network/mcpe/protocol/types/inventory/stackrequest/ItemStackRequestActionType.php b/src/pocketmine/network/mcpe/protocol/types/inventory/stackrequest/ItemStackRequestActionType.php index 7dea5c2102..e965e91863 100644 --- a/src/pocketmine/network/mcpe/protocol/types/inventory/stackrequest/ItemStackRequestActionType.php +++ b/src/pocketmine/network/mcpe/protocol/types/inventory/stackrequest/ItemStackRequestActionType.php @@ -38,10 +38,11 @@ final class ItemStackRequestActionType{ public const CRAFTING_MARK_SECONDARY_RESULT_SLOT = 6; public const LAB_TABLE_COMBINE = 7; public const BEACON_PAYMENT = 8; - public const CRAFTING_RECIPE = 9; - public const CRAFTING_RECIPE_AUTO = 10; //recipe book? - public const CREATIVE_CREATE = 11; - public const CRAFTING_RECIPE_OPTIONAL = 12; //anvil/cartography table rename - public const CRAFTING_NON_IMPLEMENTED_DEPRECATED_ASK_TY_LAING = 13; - public const CRAFTING_RESULTS_DEPRECATED_ASK_TY_LAING = 14; //no idea what this is for + public const MINE_BLOCK = 9; + public const CRAFTING_RECIPE = 10; + public const CRAFTING_RECIPE_AUTO = 11; //recipe book? + public const CREATIVE_CREATE = 12; + public const CRAFTING_RECIPE_OPTIONAL = 13; //anvil/cartography table rename + public const CRAFTING_NON_IMPLEMENTED_DEPRECATED_ASK_TY_LAING = 14; + public const CRAFTING_RESULTS_DEPRECATED_ASK_TY_LAING = 15; //no idea what this is for } diff --git a/src/pocketmine/network/mcpe/protocol/types/inventory/stackrequest/MineBlockStackRequestAction.php b/src/pocketmine/network/mcpe/protocol/types/inventory/stackrequest/MineBlockStackRequestAction.php new file mode 100644 index 0000000000..bfa69b5ee8 --- /dev/null +++ b/src/pocketmine/network/mcpe/protocol/types/inventory/stackrequest/MineBlockStackRequestAction.php @@ -0,0 +1,63 @@ +unknown1 = $unknown1; + $this->predictedDurability = $predictedDurability; + $this->stackId = $stackId; + } + + public function getUnknown1() : int{ return $this->unknown1; } + + public function getPredictedDurability() : int{ return $this->predictedDurability; } + + public function getStackId() : int{ return $this->stackId; } + + public static function getTypeId() : int{ return ItemStackRequestActionType::MINE_BLOCK; } + + public static function read(NetworkBinaryStream $in) : self{ + $unknown1 = $in->getVarInt(); + $predictedDurability = $in->getVarInt(); + $stackId = $in->readGenericTypeNetworkId(); + return new self($unknown1, $predictedDurability, $stackId); + } + + public function write(NetworkBinaryStream $out) : void{ + $out->putVarInt($this->unknown1); + $out->putVarInt($this->predictedDurability); + $out->writeGenericTypeNetworkId($this->stackId); + } +} diff --git a/src/pocketmine/network/mcpe/protocol/types/inventory/stackresponse/ItemStackResponseSlotInfo.php b/src/pocketmine/network/mcpe/protocol/types/inventory/stackresponse/ItemStackResponseSlotInfo.php index db290c332c..fb152ecd76 100644 --- a/src/pocketmine/network/mcpe/protocol/types/inventory/stackresponse/ItemStackResponseSlotInfo.php +++ b/src/pocketmine/network/mcpe/protocol/types/inventory/stackresponse/ItemStackResponseSlotInfo.php @@ -37,13 +37,16 @@ final class ItemStackResponseSlotInfo{ private $itemStackId; /** @var string */ private $customName; + /** @var int */ + private $durabilityCorrection; - public function __construct(int $slot, int $hotbarSlot, int $count, int $itemStackId, string $customName){ + public function __construct(int $slot, int $hotbarSlot, int $count, int $itemStackId, string $customName, int $durabilityCorrection){ $this->slot = $slot; $this->hotbarSlot = $hotbarSlot; $this->count = $count; $this->itemStackId = $itemStackId; $this->customName = $customName; + $this->durabilityCorrection = $durabilityCorrection; } public function getSlot() : int{ return $this->slot; } @@ -56,13 +59,16 @@ final class ItemStackResponseSlotInfo{ public function getCustomName() : string{ return $this->customName; } + public function getDurabilityCorrection() : int{ return $this->durabilityCorrection; } + public static function read(NetworkBinaryStream $in) : self{ $slot = $in->getByte(); $hotbarSlot = $in->getByte(); $count = $in->getByte(); $itemStackId = $in->readGenericTypeNetworkId(); $customName = $in->getString(); - return new self($slot, $hotbarSlot, $count, $itemStackId, $customName); + $durabilityCorrection = $in->getVarInt(); + return new self($slot, $hotbarSlot, $count, $itemStackId, $customName, $durabilityCorrection); } public function write(NetworkBinaryStream $out) : void{ @@ -71,5 +77,6 @@ final class ItemStackResponseSlotInfo{ $out->putByte($this->count); $out->writeGenericTypeNetworkId($this->itemStackId); $out->putString($this->customName); + $out->putVarInt($this->durabilityCorrection); } } diff --git a/src/pocketmine/resources/vanilla b/src/pocketmine/resources/vanilla index 4e58a3c67d..989e02a631 160000 --- a/src/pocketmine/resources/vanilla +++ b/src/pocketmine/resources/vanilla @@ -1 +1 @@ -Subproject commit 4e58a3c67dea62600ce5fd014b9fd792a50d246d +Subproject commit 989e02a6318b1278fda8526dd136749b9b7b34b4