Skip to content
This repository has been archived by the owner on Feb 23, 2021. It is now read-only.

Commit

Permalink
Merge commit '14a6779e081860548a19fc363747af1b978d76ae' into 3.6
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/pocketmine/PocketMine.php
  • Loading branch information
haniokasai committed Mar 21, 2019
2 parents 95c3f5a + 14a6779 commit a8a4f1f
Show file tree
Hide file tree
Showing 17 changed files with 389 additions and 20 deletions.
2 changes: 2 additions & 0 deletions src/pocketmine/Player.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
use pocketmine\network\mcpe\protocol\AvailableCommandsPacket;
use pocketmine\network\mcpe\protocol\AvailableEntityIdentifiersPacket;
use pocketmine\network\mcpe\protocol\BatchPacket;
use pocketmine\network\mcpe\protocol\BiomeDefinitionListPacket;
use pocketmine\network\mcpe\protocol\BlockEntityDataPacket;
use pocketmine\network\mcpe\protocol\BlockPickRequestPacket;
use pocketmine\network\mcpe\protocol\BookEditPacket;
Expand Down Expand Up @@ -2130,6 +2131,7 @@ protected function completeLoginSequence(){
$this->dataPacket($pk);

$this->sendDataPacket(new AvailableEntityIdentifiersPacket());
$this->sendDataPacket(new BiomeDefinitionListPacket());

$this->level->sendTime($this);

Expand Down
4 changes: 2 additions & 2 deletions src/pocketmine/PocketMine.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
use pocketmine\wizard\SetupWizard;

const NAME = "PocketMine-MP";
const BASE_VERSION = "3.6.6";
const BASE_VERSION = "3.7.0";
const IS_DEVELOPMENT_BUILD = false;
const BUILD_NUMBER = 1;
const BUILD_NUMBER = 0;

const MIN_PHP_VERSION = "7.2.0";

Expand Down
11 changes: 11 additions & 0 deletions src/pocketmine/item/ItemIds.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ interface ItemIds extends BlockIds{
public const DARK_OAK_DOOR = 431;
public const CHORUS_FRUIT = 432;
public const CHORUS_FRUIT_POPPED = 433;
public const BANNER_PATTERN = 434;

public const DRAGON_BREATH = 437;
public const SPLASH_POTION = 438;
Expand Down Expand Up @@ -237,6 +238,14 @@ interface ItemIds extends BlockIds{
public const HEART_OF_THE_SEA = 467;
public const TURTLE_SHELL_PIECE = 468;
public const TURTLE_HELMET = 469;
public const PHANTOM_MEMBRANE = 470;
public const CROSSBOW = 471;
public const SPRUCE_SIGN = 472;
public const BIRCH_SIGN = 473;
public const JUNGLE_SIGN = 474;
public const ACACIA_SIGN = 475;
public const DARKOAK_SIGN = 476;
public const SWEET_BERRIES = 477;

public const COMPOUND = 499;
public const RECORD_13 = 500;
Expand All @@ -252,4 +261,6 @@ interface ItemIds extends BlockIds{
public const RECORD_11 = 510;
public const RECORD_WAIT = 511;

public const SHIELD = 513;

}
9 changes: 9 additions & 0 deletions src/pocketmine/network/mcpe/NetworkBinaryStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use pocketmine\entity\Entity;
use pocketmine\item\Item;
use pocketmine\item\ItemFactory;
use pocketmine\item\ItemIds;
use pocketmine\math\Vector3;
use pocketmine\nbt\NetworkLittleEndianNBTStream;
use pocketmine\nbt\tag\CompoundTag;
Expand Down Expand Up @@ -104,6 +105,10 @@ public function getSlot() : Item{
$this->getString();
}

if($id === ItemIds::SHIELD){
$this->getVarLong(); //"blocking tick" (ffs mojang)
}

return ItemFactory::get($id, $data, $cnt, $nbt);
}

Expand All @@ -129,6 +134,10 @@ public function putSlot(Item $item) : void{

$this->putVarInt(0); //CanPlaceOn entry count (TODO)
$this->putVarInt(0); //CanDestroy entry count (TODO)

if($item->getId() === ItemIds::SHIELD){
$this->putVarLong(0); //"blocking tick" (ffs mojang)
}
}

/**
Expand Down
14 changes: 12 additions & 2 deletions src/pocketmine/network/mcpe/NetworkSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
use pocketmine\network\mcpe\protocol\AddPlayerPacket;
use pocketmine\network\mcpe\protocol\AdventureSettingsPacket;
use pocketmine\network\mcpe\protocol\AnimatePacket;
use pocketmine\network\mcpe\protocol\AutomationClientConnectPacket;
use pocketmine\network\mcpe\protocol\AvailableCommandsPacket;
use pocketmine\network\mcpe\protocol\AvailableEntityIdentifiersPacket;
use pocketmine\network\mcpe\protocol\BiomeDefinitionListPacket;
Expand Down Expand Up @@ -68,6 +69,7 @@
use pocketmine\network\mcpe\protocol\InventoryTransactionPacket;
use pocketmine\network\mcpe\protocol\ItemFrameDropItemPacket;
use pocketmine\network\mcpe\protocol\LabTablePacket;
use pocketmine\network\mcpe\protocol\LecternUpdatePacket;
use pocketmine\network\mcpe\protocol\LevelEventPacket;
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
use pocketmine\network\mcpe\protocol\LevelSoundEventPacketV1;
Expand Down Expand Up @@ -144,7 +146,7 @@
use pocketmine\network\mcpe\protocol\UpdateEquipPacket;
use pocketmine\network\mcpe\protocol\UpdateSoftEnumPacket;
use pocketmine\network\mcpe\protocol\UpdateTradePacket;
use pocketmine\network\mcpe\protocol\WSConnectPacket;
use pocketmine\network\mcpe\protocol\VideoStreamConnectPacket;

abstract class NetworkSession{

Expand Down Expand Up @@ -522,7 +524,7 @@ public function handleSubClientLogin(SubClientLoginPacket $packet) : bool{
return false;
}

public function handleWSConnect(WSConnectPacket $packet) : bool{
public function handleAutomationClientConnect(AutomationClientConnectPacket $packet) : bool{
return false;
}

Expand Down Expand Up @@ -634,4 +636,12 @@ public function handleLevelSoundEvent(LevelSoundEventPacket $packet) : bool{
return false;
}

public function handleLecternUpdate(LecternUpdatePacket $packet) : bool{
return false;
}

public function handleVideoStreamConnect(VideoStreamConnectPacket $packet) : bool{
return false;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@

use pocketmine\network\mcpe\NetworkSession;

class WSConnectPacket extends DataPacket{
public const NETWORK_ID = ProtocolInfo::W_S_CONNECT_PACKET;
class AutomationClientConnectPacket extends DataPacket{
public const NETWORK_ID = ProtocolInfo::AUTOMATION_CLIENT_CONNECT_PACKET;

/** @var string */
public $serverUri;
Expand All @@ -42,6 +42,6 @@ protected function encodePayload(){
}

public function handle(NetworkSession $session) : bool{
return $session->handleWSConnect($this);
return $session->handleAutomationClientConnect($this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -223,21 +223,22 @@ protected function getCommandData() : CommandData{
$parameter->paramName = $this->getString();
$parameter->paramType = $this->getLInt();
$parameter->isOptional = $this->getBool();
$parameter->byte1 = $this->getByte();

if($parameter->paramType & self::ARG_FLAG_ENUM){
$index = ($parameter->paramType & 0xffff);
$parameter->enum = $this->enums[$index] ?? null;
if($parameter->enum === null){
throw new \UnexpectedValueException("expected enum at $index, but got none");
throw new \UnexpectedValueException("deserializing $retval->commandName parameter $parameter->paramName: expected enum at $index, but got none");
}
}elseif($parameter->paramType & self::ARG_FLAG_POSTFIX){
$index = ($parameter->paramType & 0xffff);
$parameter->postfix = $this->postfixes[$index] ?? null;
if($parameter->postfix === null){
throw new \UnexpectedValueException("expected postfix at $index, but got none");
throw new \UnexpectedValueException("deserializing $retval->commandName parameter $parameter->paramName: expected postfix at $index, but got none");
}
}elseif(($parameter->paramType & self::ARG_FLAG_VALID) === 0){
throw new \UnexpectedValueException("Invalid parameter type 0x" . dechex($parameter->paramType));
throw new \UnexpectedValueException("deserializing $retval->commandName parameter $parameter->paramName: Invalid parameter type 0x" . dechex($parameter->paramType));
}

$retval->overloads[$overloadIndex][$paramIndex] = $parameter;
Expand Down Expand Up @@ -280,6 +281,7 @@ protected function putCommandData(CommandData $data){

$this->putLInt($type);
$this->putBool($parameter->isOptional);
$this->putByte($parameter->byte1);
}
}
}
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
class BiomeDefinitionListPacket extends DataPacket{
public const NETWORK_ID = ProtocolInfo::BIOME_DEFINITION_LIST_PACKET;

public const HARDCODED_NBT_BLOB = "CgAKDWJhbWJvb19qdW5nbGUFCGRvd25mYWxsZmZmPwULdGVtcGVyYXR1cmUzM3M/AAoTYmFt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dGVtcGVyYXR1cmUAAIA+AAoLdGFpZ2FfaGlsbHMFCGRvd25mYWxszcxMPwULdGVtcGVyYXR1cmUAAIA+AAoNdGFpZ2FfbXV0YXRlZAUIZG93bmZhbGzNzEw/BQt0ZW1wZXJhdHVyZQAAgD4ACgd0aGVfZW5kBQhkb3duZmFsbAAAAD8FC3RlbXBlcmF0dXJlAAAAPwAKCndhcm1fb2NlYW4FCGRvd25mYWxsAAAAPwULdGVtcGVyYXR1cmUAAAA/AAA=";
/** @var string */
public $namedtag;

Expand All @@ -38,7 +39,7 @@ protected function decodePayload(){
}

protected function encodePayload(){
$this->put($this->namedtag);
$this->put($this->namedtag ?? self::HARDCODED_NBT_BLOB);
}

public function handle(NetworkSession $session) : bool{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ protected function decodePayload(){
$this->trData->itemInHand = $this->getSlot();
$this->trData->playerPos = $this->getVector3();
$this->trData->clickPos = $this->getVector3();
$this->trData->blockRuntimeId = $this->getUnsignedVarInt();
break;
case self::TYPE_USE_ITEM_ON_ENTITY:
$this->trData->entityRuntimeId = $this->getEntityRuntimeId();
Expand Down Expand Up @@ -132,6 +133,7 @@ protected function encodePayload(){
$this->putSlot($this->trData->itemInHand);
$this->putVector3($this->trData->playerPos);
$this->putVector3($this->trData->clickPos);
$this->putUnsignedVarInt($this->trData->blockRuntimeId);
break;
case self::TYPE_USE_ITEM_ON_ENTITY:
$this->putEntityRuntimeId($this->trData->entityRuntimeId);
Expand Down
59 changes: 59 additions & 0 deletions src/pocketmine/network/mcpe/protocol/LecternUpdatePacket.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?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 LecternUpdatePacket extends DataPacket/* implements ServerboundPacket*/{
public const NETWORK_ID = ProtocolInfo::LECTERN_UPDATE_PACKET;

/** @var int */
public $page;
/** @var int */
public $x;
/** @var int */
public $y;
/** @var int */
public $z;
/** @var bool */
public $dropBook;

protected function decodePayload() : void{
$this->page = $this->getByte();
$this->getBlockPosition($this->x, $this->y, $this->z);
$this->dropBook = $this->getBool();
}

protected function encodePayload() : void{
$this->putByte($this->page);
$this->putBlockPosition($this->x, $this->y, $this->z);
$this->putBool($this->dropBook);
}

public function handle(NetworkSession $session) : bool{
return $session->handleLecternUpdate($this);
}
}
4 changes: 3 additions & 1 deletion src/pocketmine/network/mcpe/protocol/PacketPool.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public static function init(){
static::registerPacket(new PurchaseReceiptPacket());
static::registerPacket(new PlayerSkinPacket());
static::registerPacket(new SubClientLoginPacket());
static::registerPacket(new WSConnectPacket());
static::registerPacket(new AutomationClientConnectPacket());
static::registerPacket(new SetLastHurtByPacket());
static::registerPacket(new BookEditPacket());
static::registerPacket(new NpcRequestPacket());
Expand Down Expand Up @@ -154,6 +154,8 @@ public static function init(){
static::registerPacket(new NetworkChunkPublisherUpdatePacket());
static::registerPacket(new BiomeDefinitionListPacket());
static::registerPacket(new LevelSoundEventPacket());
static::registerPacket(new LecternUpdatePacket());
static::registerPacket(new VideoStreamConnectPacket());

static::registerPacket(new BatchPacket());
}
Expand Down
10 changes: 6 additions & 4 deletions src/pocketmine/network/mcpe/protocol/ProtocolInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ interface ProtocolInfo{
/**
* Actual Minecraft: PE protocol version
*/
public const CURRENT_PROTOCOL = 332;
public const CURRENT_PROTOCOL = 340;
/**
* Current Minecraft PE version reported by the server. This is usually the earliest currently supported version.
*/
public const MINECRAFT_VERSION = 'v1.9.0';
public const MINECRAFT_VERSION = 'v1.10.0';
/**
* Version number sent to clients in ping responses.
*/
public const MINECRAFT_VERSION_NETWORK = '1.9.0';
public const MINECRAFT_VERSION_NETWORK = '1.10.0';

public const LOGIN_PACKET = 0x01;
public const PLAY_STATUS_PACKET = 0x02;
Expand Down Expand Up @@ -143,7 +143,7 @@ interface ProtocolInfo{
public const PURCHASE_RECEIPT_PACKET = 0x5c;
public const PLAYER_SKIN_PACKET = 0x5d;
public const SUB_CLIENT_LOGIN_PACKET = 0x5e;
public const W_S_CONNECT_PACKET = 0x5f;
public const AUTOMATION_CLIENT_CONNECT_PACKET = 0x5f;
public const SET_LAST_HURT_BY_PACKET = 0x60;
public const BOOK_EDIT_PACKET = 0x61;
public const NPC_REQUEST_PACKET = 0x62;
Expand Down Expand Up @@ -172,5 +172,7 @@ interface ProtocolInfo{
public const NETWORK_CHUNK_PUBLISHER_UPDATE_PACKET = 0x79;
public const BIOME_DEFINITION_LIST_PACKET = 0x7a;
public const LEVEL_SOUND_EVENT_PACKET = 0x7b;
public const LECTERN_UPDATE_PACKET = 0x7c;
public const VIDEO_STREAM_CONNECT_PACKET = 0x7d;

}
58 changes: 58 additions & 0 deletions src/pocketmine/network/mcpe/protocol/VideoStreamConnectPacket.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?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 VideoStreamConnectPacket extends DataPacket/* implements ClientboundPacket*/{
public const NETWORK_ID = ProtocolInfo::VIDEO_STREAM_CONNECT_PACKET;

public const ACTION_CONNECT = 0;
public const ACTION_DISCONNECT = 1;

/** @var string */
public $serverUri;
/** @var float */
public $frameSendFrequency;
/** @var int */
public $action;

protected function decodePayload() : void{
$this->serverUri = $this->getString();
$this->frameSendFrequency = $this->getLFloat();
$this->action = $this->getByte();
}

protected function encodePayload() : void{
$this->putString($this->serverUri);
$this->putLFloat($this->frameSendFrequency);
$this->putByte($this->action);
}

public function handle(NetworkSession $session) : bool{
return $session->handleVideoStreamConnect($this);
}
}
Loading

0 comments on commit a8a4f1f

Please sign in to comment.