From 7ef27a1a211b604d971d1326e7b88f8c515b28ff Mon Sep 17 00:00:00 2001 From: SOFe Date: Wed, 7 Aug 2019 14:54:01 +0800 Subject: [PATCH 1/8] support.yml Discord link should point to #rules --- .github/support.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/support.yml b/.github/support.yml index 608966cb1..135728ca3 100644 --- a/.github/support.yml +++ b/.github/support.yml @@ -8,7 +8,7 @@ supportComment: > Thanks, but this issue tracker not intended for support requests. Please read the guidelines on [submitting an issue](https://github.com/pmmp/PocketMine-MP/blob/master/CONTRIBUTING.md#creating-an-issue). - [Docs](https://pmmp.rtfd.io) | [Discord](https://discord.gg/bge7dYQ) | [Forums](https://forums.pmmp.io) + [Docs](https://pmmp.rtfd.io) | [Discord](https://discord.gg/bmSAZBG) | [Forums](https://forums.pmmp.io) # Whether to close issues marked as support requests close: true From d75650092882ba0a02b5a1babbe1ceeb4e7c9b50 Mon Sep 17 00:00:00 2001 From: SOFe Date: Thu, 8 Aug 2019 00:03:10 +0800 Subject: [PATCH 2/8] Also updated Discord link in suppor template and README --- .github/ISSUE_TEMPLATE/help---support.md | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/help---support.md b/.github/ISSUE_TEMPLATE/help---support.md index a724460a6..cc34e496b 100644 --- a/.github/ISSUE_TEMPLATE/help---support.md +++ b/.github/ISSUE_TEMPLATE/help---support.md @@ -11,4 +11,4 @@ We don't accept support requests on the issue tracker. Please try the following Documentation: http://pmmp.rtfd.io Forums: https://forums.pmmp.io -Discord: https://discord.gg/bge7dYQ +Discord: https://discord.gg/bmSAZBG diff --git a/README.md b/README.md index 2df12887a..e290302c4 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ ### Discussion - [Forums](https://forums.pmmp.io/) -- [Community Discord](https://discord.gg/bge7dYQ) +- [Community Discord](https://discord.gg/bmSAZBG) ### For developers * [Latest API documentation](https://jenkins.pmmp.io/job/PocketMine-MP-doc/doxygen/) - Doxygen documentation generated from development From 807b860cfe3744963d997e7935af5d5a96ea4268 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 11 Aug 2019 19:00:27 +0100 Subject: [PATCH 3/8] protocol: fixup data type changes, closes #3072 --- src/pocketmine/entity/DataPropertyManager.php | 23 +++++-------------- src/pocketmine/entity/Entity.php | 2 +- .../network/mcpe/NetworkBinaryStream.php | 8 +++---- 3 files changed, 11 insertions(+), 22 deletions(-) diff --git a/src/pocketmine/entity/DataPropertyManager.php b/src/pocketmine/entity/DataPropertyManager.php index c8646132f..890ff3e2f 100644 --- a/src/pocketmine/entity/DataPropertyManager.php +++ b/src/pocketmine/entity/DataPropertyManager.php @@ -23,8 +23,8 @@ declare(strict_types=1); namespace pocketmine\entity; -use pocketmine\item\Item; use pocketmine\math\Vector3; +use pocketmine\nbt\tag\CompoundTag; use function assert; use function is_float; use function is_int; @@ -140,25 +140,14 @@ class DataPropertyManager{ $this->setPropertyValue($key, Entity::DATA_TYPE_STRING, $value, $force); } - /** - * @param int $key - * - * @return null|Item - */ - public function getItem(int $key) : ?Item{ - $value = $this->getPropertyValue($key, Entity::DATA_TYPE_SLOT); - assert($value instanceof Item or $value === null); - + public function getCompoundTag(int $key) : ?CompoundTag{ + $value = $this->getPropertyValue($key, Entity::DATA_TYPE_COMPOUND_TAG); + assert($value instanceof CompoundTag or $value === null); return $value; } - /** - * @param int $key - * @param Item $value - * @param bool $force - */ - public function setItem(int $key, Item $value, bool $force = false) : void{ - $this->setPropertyValue($key, Entity::DATA_TYPE_SLOT, $value, $force); + public function setCompoundTag(int $key, CompoundTag $value, bool $force = false) : void{ + $this->setPropertyValue($key, Entity::DATA_TYPE_COMPOUND_TAG, $value, $force); } /** diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index b464da92c..a2026f4ec 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -102,7 +102,7 @@ abstract class Entity extends Location implements Metadatable, EntityIds{ public const DATA_TYPE_INT = 2; public const DATA_TYPE_FLOAT = 3; public const DATA_TYPE_STRING = 4; - public const DATA_TYPE_SLOT = 5; + public const DATA_TYPE_COMPOUND_TAG = 5; public const DATA_TYPE_POS = 6; public const DATA_TYPE_LONG = 7; public const DATA_TYPE_VECTOR3F = 8; diff --git a/src/pocketmine/network/mcpe/NetworkBinaryStream.php b/src/pocketmine/network/mcpe/NetworkBinaryStream.php index cf71dfaf1..eb2456703 100644 --- a/src/pocketmine/network/mcpe/NetworkBinaryStream.php +++ b/src/pocketmine/network/mcpe/NetworkBinaryStream.php @@ -227,8 +227,8 @@ class NetworkBinaryStream extends BinaryStream{ case Entity::DATA_TYPE_STRING: $value = $this->getString(); break; - case Entity::DATA_TYPE_SLOT: - $value = $this->getSlot(); + case Entity::DATA_TYPE_COMPOUND_TAG: + $value = (new NetworkLittleEndianNBTStream())->read($this->buffer, false, $this->offset, 512); break; case Entity::DATA_TYPE_POS: $value = new Vector3(); @@ -279,8 +279,8 @@ class NetworkBinaryStream extends BinaryStream{ case Entity::DATA_TYPE_STRING: $this->putString($d[1]); break; - case Entity::DATA_TYPE_SLOT: - $this->putSlot($d[1]); + case Entity::DATA_TYPE_COMPOUND_TAG: + $this->put((new NetworkLittleEndianNBTStream())->write($d[1])); break; case Entity::DATA_TYPE_POS: $v = $d[1]; From 53dc6e2050b547fa9b82598dc6a489b949dd57d6 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 11 Aug 2019 19:06:20 +0100 Subject: [PATCH 4/8] fix TallGrass and Tree random/base amounts never being initialized, closes #2996 --- src/pocketmine/level/generator/populator/TallGrass.php | 6 +++--- src/pocketmine/level/generator/populator/Tree.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/pocketmine/level/generator/populator/TallGrass.php b/src/pocketmine/level/generator/populator/TallGrass.php index a60179946..49c8fdb8b 100644 --- a/src/pocketmine/level/generator/populator/TallGrass.php +++ b/src/pocketmine/level/generator/populator/TallGrass.php @@ -30,8 +30,8 @@ use pocketmine\utils\Random; class TallGrass extends Populator{ /** @var ChunkManager */ private $level; - private $randomAmount; - private $baseAmount; + private $randomAmount = 1; + private $baseAmount = 0; public function setRandomAmount($amount){ $this->randomAmount = $amount; @@ -43,7 +43,7 @@ class TallGrass extends Populator{ public function populate(ChunkManager $level, int $chunkX, int $chunkZ, Random $random){ $this->level = $level; - $amount = $random->nextRange(0, $this->randomAmount + 1) + $this->baseAmount; + $amount = $random->nextRange(0, $this->randomAmount) + $this->baseAmount; for($i = 0; $i < $amount; ++$i){ $x = $random->nextRange($chunkX * 16, $chunkX * 16 + 15); $z = $random->nextRange($chunkZ * 16, $chunkZ * 16 + 15); diff --git a/src/pocketmine/level/generator/populator/Tree.php b/src/pocketmine/level/generator/populator/Tree.php index cbe8e6bce..edcd48f2c 100644 --- a/src/pocketmine/level/generator/populator/Tree.php +++ b/src/pocketmine/level/generator/populator/Tree.php @@ -32,8 +32,8 @@ use pocketmine\utils\Random; class Tree extends Populator{ /** @var ChunkManager */ private $level; - private $randomAmount; - private $baseAmount; + private $randomAmount = 1; + private $baseAmount = 0; private $type; @@ -51,7 +51,7 @@ class Tree extends Populator{ public function populate(ChunkManager $level, int $chunkX, int $chunkZ, Random $random){ $this->level = $level; - $amount = $random->nextRange(0, $this->randomAmount + 1) + $this->baseAmount; + $amount = $random->nextRange(0, $this->randomAmount) + $this->baseAmount; for($i = 0; $i < $amount; ++$i){ $x = $random->nextRange($chunkX << 4, ($chunkX << 4) + 15); $z = $random->nextRange($chunkZ << 4, ($chunkZ << 4) + 15); From 4d0e8741fe6310168c7b1c1e344e3015a5a8ad2f Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 11 Aug 2019 19:32:21 +0100 Subject: [PATCH 5/8] Added a deprecation notice to Entity->getBlocksAround() --- src/pocketmine/entity/Entity.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index a2026f4ec..bf016fa54 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -1782,6 +1782,9 @@ abstract class Entity extends Location implements Metadatable, EntityIds{ } /** + * @deprecated WARNING: Despite what its name implies, this function DOES NOT return all the blocks around the entity. + * Instead, it returns blocks which have reactions for an entity intersecting with them. + * * @return Block[] */ public function getBlocksAround() : array{ From dbb669b156b2a6d66d0fb918eceb36572d8ee33a Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 11 Aug 2019 19:34:57 +0100 Subject: [PATCH 6/8] Entity: add some deprecation warnings to despawnFrom() and despawnFromAll() --- src/pocketmine/entity/Entity.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index bf016fa54..fac66b10c 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -2074,6 +2074,9 @@ abstract class Entity extends Location implements Metadatable, EntityIds{ } /** + * @deprecated WARNING: This function DOES NOT permanently hide the entity from the player. As soon as the entity or + * player moves, the player will once again be able to see the entity. + * * @param Player $player * @param bool $send */ @@ -2088,6 +2091,10 @@ abstract class Entity extends Location implements Metadatable, EntityIds{ } } + /** + * @deprecated WARNING: This function DOES NOT permanently hide the entity from viewers. As soon as the entity or + * player moves, viewers will once again be able to see the entity. + */ public function despawnFromAll() : void{ foreach($this->hasSpawned as $player){ $this->despawnFrom($player); From 2f61d42518da7c809a7a5ec9b9e7c9c913ef0530 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 2 Jul 2019 19:54:56 +0100 Subject: [PATCH 7/8] backport d23eeff8324e51ea1a902271603c50551e074c1b: FallingBlock: remove useless check --- src/pocketmine/entity/object/FallingBlock.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pocketmine/entity/object/FallingBlock.php b/src/pocketmine/entity/object/FallingBlock.php index cf67890f5..7d7d6cb1c 100644 --- a/src/pocketmine/entity/object/FallingBlock.php +++ b/src/pocketmine/entity/object/FallingBlock.php @@ -110,7 +110,7 @@ class FallingBlock extends Entity{ $this->flagForDespawn(); $block = $this->level->getBlock($pos); - if($block->getId() > 0 and $block->isTransparent() and !$block->canBeReplaced()){ + if($block->isTransparent() and !$block->canBeReplaced()){ //FIXME: anvils are supposed to destroy torches $this->getLevel()->dropItem($this, ItemFactory::get($this->getBlock(), $this->getDamage())); }else{ From 677d43028a7622c845acb6b35e13e44e06510091 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 14 Aug 2019 18:08:26 +0100 Subject: [PATCH 8/8] add php-build-scripts as a submodule --- .gitmodules | 3 +++ build/php | 1 + 2 files changed, 4 insertions(+) create mode 160000 build/php diff --git a/.gitmodules b/.gitmodules index 74a88d57b..6696eb5bc 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,3 +10,6 @@ [submodule "src/pocketmine/resources/vanilla"] path = src/pocketmine/resources/vanilla url = https://github.com/pmmp/BedrockData.git +[submodule "build/php"] + path = build/php + url = https://github.com/pmmp/php-build-scripts.git diff --git a/build/php b/build/php new file mode 160000 index 000000000..ffc465f4f --- /dev/null +++ b/build/php @@ -0,0 +1 @@ +Subproject commit ffc465f4f806269138fc210832500c51fdecd471