Merge branch 'stable'

This commit is contained in:
Dylan K. Taylor 2019-08-14 18:20:55 +01:00
commit 200bcb485e
12 changed files with 48 additions and 29 deletions

View File

@ -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

2
.github/support.yml vendored
View File

@ -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

3
.gitmodules vendored
View File

@ -10,3 +10,6 @@
[submodule "resources/vanilla"]
path = resources/vanilla
url = https://github.com/pmmp/BedrockData.git
[submodule "build/php"]
path = build/php
url = https://github.com/pmmp/php-build-scripts.git

View File

@ -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

1
build/php Submodule

@ -0,0 +1 @@
Subproject commit ffc465f4f806269138fc210832500c51fdecd471

View File

@ -1352,6 +1352,9 @@ abstract class Entity extends Location{
}
/**
* @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{
@ -1646,6 +1649,9 @@ abstract class Entity extends Location{
}
/**
* @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
*/
@ -1659,6 +1665,10 @@ abstract class Entity extends Location{
}
}
/**
* @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);

View File

@ -23,40 +23,45 @@ declare(strict_types=1);
namespace pocketmine\network\mcpe\protocol\types\entity;
use pocketmine\item\Item;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\TreeRoot;
use pocketmine\network\mcpe\serializer\NetworkBinaryStream;
use pocketmine\network\mcpe\serializer\NetworkNbtSerializer;
final class ItemStackMetadataProperty implements MetadataProperty{
/** @var Item */
final class CompoundTagMetadataProperty implements MetadataProperty{
/** @var CompoundTag */
private $value;
/**
* @param Item $value
* @param CompoundTag $value
*/
public function __construct(Item $value){
public function __construct(CompoundTag $value){
$this->value = clone $value;
}
/**
* @return Item
* @return CompoundTag
*/
public function getValue() : Item{
public function getValue() : CompoundTag{
return clone $this->value;
}
public static function id() : int{
return EntityMetadataTypes::SLOT;
return EntityMetadataTypes::COMPOUND_TAG;
}
public function equals(MetadataProperty $other) : bool{
return $other instanceof $this and $other->value->equalsExact($this->value);
return $other instanceof $this and $other->value->equals($this->value);
}
public static function read(NetworkBinaryStream $in) : self{
return new self($in->getSlot());
$offset = $in->getOffset();
$result = new self((new NetworkNbtSerializer())->read($in->getBuffer(), $offset, 512)->getTag());
$in->setOffset($offset);
return $result;
}
public function write(NetworkBinaryStream $out) : void{
$out->putSlot($this->value);
$out->put((new NetworkNbtSerializer())->write(new TreeRoot($this->value)));
}
}

View File

@ -23,8 +23,8 @@ declare(strict_types=1);
namespace pocketmine\network\mcpe\protocol\types\entity;
use pocketmine\item\Item;
use pocketmine\math\Vector3;
use pocketmine\nbt\tag\CompoundTag;
use function get_class;
class EntityMetadataCollection{
@ -85,12 +85,12 @@ class EntityMetadataCollection{
}
/**
* @param int $key
* @param Item $value
* @param bool $force
* @param int $key
* @param CompoundTag $value
* @param bool $force
*/
public function setItem(int $key, Item $value, bool $force = false) : void{
$this->set($key, new ItemStackMetadataProperty($value), $force);
public function setCompoundTag(int $key, CompoundTag $value, bool $force = false) : void{
$this->set($key, new CompoundTagMetadataProperty($value), $force);
}
/**

View File

@ -34,7 +34,7 @@ final class EntityMetadataTypes{
public const INT = 2;
public const FLOAT = 3;
public const STRING = 4;
public const SLOT = 5;
public const COMPOUND_TAG = 5;
public const POS = 6;
public const LONG = 7;
public const VECTOR3F = 8;

View File

@ -42,7 +42,7 @@ use pocketmine\network\mcpe\protocol\types\entity\ByteMetadataProperty;
use pocketmine\network\mcpe\protocol\types\entity\EntityLink;
use pocketmine\network\mcpe\protocol\types\entity\FloatMetadataProperty;
use pocketmine\network\mcpe\protocol\types\entity\IntMetadataProperty;
use pocketmine\network\mcpe\protocol\types\entity\ItemStackMetadataProperty;
use pocketmine\network\mcpe\protocol\types\entity\CompoundTagMetadataProperty;
use pocketmine\network\mcpe\protocol\types\entity\LongMetadataProperty;
use pocketmine\network\mcpe\protocol\types\entity\MetadataProperty;
use pocketmine\network\mcpe\protocol\types\entity\ShortMetadataProperty;
@ -258,7 +258,7 @@ class NetworkBinaryStream extends BinaryStream{
case IntMetadataProperty::id(): return IntMetadataProperty::read($this);
case FloatMetadataProperty::id(): return FloatMetadataProperty::read($this);
case StringMetadataProperty::id(): return StringMetadataProperty::read($this);
case ItemStackMetadataProperty::id(): return ItemStackMetadataProperty::read($this);
case CompoundTagMetadataProperty::id(): return CompoundTagMetadataProperty::read($this);
case BlockPosMetadataProperty::id(): return BlockPosMetadataProperty::read($this);
case LongMetadataProperty::id(): return LongMetadataProperty::read($this);
case Vec3MetadataProperty::id(): return Vec3MetadataProperty::read($this);

View File

@ -31,8 +31,8 @@ use pocketmine\world\ChunkManager;
class TallGrass extends Populator{
/** @var ChunkManager */
private $world;
private $randomAmount;
private $baseAmount;
private $randomAmount = 1;
private $baseAmount = 0;
public function setRandomAmount(int $amount) : void{
$this->randomAmount = $amount;
@ -44,7 +44,7 @@ class TallGrass extends Populator{
public function populate(ChunkManager $world, int $chunkX, int $chunkZ, Random $random) : void{
$this->world = $world;
$amount = $random->nextRange(0, $this->randomAmount + 1) + $this->baseAmount;
$amount = $random->nextRange(0, $this->randomAmount) + $this->baseAmount;
$block = VanillaBlocks::TALL_GRASS();
for($i = 0; $i < $amount; ++$i){

View File

@ -32,8 +32,8 @@ use pocketmine\world\generator\object\Tree as ObjectTree;
class Tree extends Populator{
/** @var ChunkManager */
private $world;
private $randomAmount;
private $baseAmount;
private $randomAmount = 1;
private $baseAmount = 0;
/** @var TreeType */
private $type;
@ -55,7 +55,7 @@ class Tree extends Populator{
public function populate(ChunkManager $world, int $chunkX, int $chunkZ, Random $random) : void{
$this->world = $world;
$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);