From 5c63e06b0f5267a6e45e7f912f8acf8621175892 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 1 Jun 2020 14:57:27 +0100 Subject: [PATCH 1/8] piece together a changelog for release --- changelogs/3.13.md | 111 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 changelogs/3.13.md diff --git a/changelogs/3.13.md b/changelogs/3.13.md new file mode 100644 index 000000000..470fdb4fc --- /dev/null +++ b/changelogs/3.13.md @@ -0,0 +1,111 @@ +**For Minecraft: Bedrock Edition 1.14.60** + +This is a feature release, containing various minor API additions, deprecations and a few minor features. + +### Note about API versions +Plugins which don't touch the protocol and compatible with any previous 3.x.y version will also run on these releases and do not need API bumps. +Plugin developers should **only** update their required API to this version if you need the changes in this build. + +**WARNING: If your plugin uses the protocol, you're not shielded by API change constraints.** You should consider using the `mcpe-protocol` directive in `plugin.yml` as a constraint if you do. + +# 3.13.0 +## Core +- PHP 7.3.0 or newer is now required. +- Player movement processing has been revamped. It's now more tolerant of network lag and doesn't have as many problems with falling. + +## User Interface +- `/time` now supports additional aliases `noon`, `sunset`, `midnight` and `sunrise`. +- Removed warnings when a plugin registers a handler for a deprecated event. Since this warning is developer-focused, and too specific to be useful, it just caused annoyance and confusion to users who didn't know what it meant. + +## API +### General +- It's now possible to require a specific operating system using the `os` directive in `plugin.yml`. More information about this directive can be found in the [developer documentation](https://github.com/pmmp/DeveloperDocs). + +### Player +- `Player->resetItemCooldown()` now accepts a second parameter, allowing plugins to provide a custom duration. +- The following methods have been deprecated and have recommended replacements: + - `Player->addTitle()` -> `Player->sendTitle()` + - `Player->addSubTitle()` -> `Player->sendSubTitle()` + - `Player->addActionBarMessage()` -> `Player->sendActionBarMessage()` + +### Event +- The following methods have been deprecated: + - `EntityDespawnEvent->getType()` + - `EntityDespawnEvent->getPosition()` + - `EntityDespawnEvent->isCreature()` + - `EntityDespawnEvent->isHuman()` + - `EntityDespawnEvent->isProjectile()` + - `EntityDespawnEvent->isVehicle()` + - `EntityDespawnEvent->isItem()` + - `EntitySpawnEvent->getType()` + - `EntitySpawnEvent->getPosition()` + - `EntitySpawnEvent->isCreature()` + - `EntitySpawnEvent->isHuman()` + - `EntitySpawnEvent->isProjectile()` + - `EntitySpawnEvent->isVehicle()` + - `EntitySpawnEvent->isItem()` +- Added the following API methods: + - `EntityDeathEvent->getXpDropAmount()` + - `EntityDeathEvent->setXpDropAmount()` +- `PlayerDeathEvent::__construct()` now accepts a fourth (optional) parameter `int $xp`. +- `EntityDeathEvent::__construct()` now accepts a third (optional) parameter `int $xp`. + +### Inventory +- The following classes have been deprecated: + - `Recipe` +- The following methods have been deprecated: + - `CraftingManager->registerRecipe()` + - `Recipe->registerToCraftingManager()` (and all its implementations) + +### Item +- New `Enchantment` type ID constants have been added. +- `ItemFactory::fromStringSingle()` has been added. This works exactly the same as `ItemFactory::fromString()`, but it has a return type of `Item` instead of `Item|Item[]` (more static analysis friendly). + +### Level +- Added the following API methods: + - `Position->getLevelNonNull()`: this is the same as `Position->getLevel()`, but throws an `AssumptionFailedError` if the level is null or invalid (more static analysis friendly). + - `Level->getTimeOfDay()` +- The following constants have been changed: + - `Level::TIME_DAY` now has a value of `1000` + - `Level::TIME_NIGHT` now has a value of `13000` +- Added the following constants: + - `Level::TIME_MIDNIGHT` + - `Level::TIME_NOON` +- The following types of particles now accept optional `Color` parameters in the constructor: + - `EnchantParticle` + - `InstantEnchantParticle` + +### Network +- Added the following API methods: + - `RakLibInterface->setPacketLimit()` + +### Scheduler +AsyncTask thread-local storage has been improved, making it simpler and easier to use. +- `AsyncTask->fetchLocal()` no longer deletes stored thread-local data. Instead, the storage behaves more like properties, and gets deleted when the AsyncTask object goes out of scope. +- `AsyncTask->peekLocal()` has been `@deprecated` (use `fetchLocal()` instead). +- Notices are no longer emitted if an async task doesn't fetch its locally stored data. +- The following methods have been deprecated: + - `AsyncTask->getFromThreadStore()` (use its worker's corresponding method) + - `AsyncTask->saveToThreadStore()` (use its worker's corresponding method) + - `AsyncTask->removeFromThreadStore()` (use its worker's corresponding method) + +### Utils +- The following functions have been deprecated and have recommended replacements: + - `Utils::getMemoryUsage()` -> split into `Process::getMemoryUsage()` and `Process::getAdvancedMemoryUsage()` (not 1:1 replacement!!) + - `Utils::getRealMemoryUsage()` -> `Process::getRealMemoryUsage()` + - `Utils::getThreadCount()` -> `Process::getThreadCount()` + - `Utils::kill()` -> `Process::kill()` + - `Utils::execute()` -> `Process::execute()` +- Added the following constants: + - `Utils::OS_WINDOWS` + - `Utils::OS_IOS` + - `Utils::OS_MACOS` + - `Utils::OS_ANDROID` + - `Utils::OS_LINUX` + - `Utils::OS_BSD` + - `Utils::OS_UNKNOWN` +- Added the following API methods: + - `Config->getPath()` + - `Utils::recursiveUnlink()` + - `Terminal::write()` + - `Terminal::writeLine()` From b48243fd09c50c9486955d59200a0ba2680ea264 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 1 Jun 2020 18:05:51 +0000 Subject: [PATCH 2/8] Bump phpstan/phpstan-phpunit from 0.12.10 to 0.12.11 (#3547) --- composer.lock | 65 +++++---------------------------------------------- 1 file changed, 6 insertions(+), 59 deletions(-) diff --git a/composer.lock b/composer.lock index 793ab7692..afde9285d 100644 --- a/composer.lock +++ b/composer.lock @@ -476,20 +476,6 @@ "constructor", "instantiate" ], - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", - "type": "tidelift" - } - ], "time": "2020-05-29T17:27:14+00:00" }, { @@ -893,34 +879,20 @@ "MIT" ], "description": "PHPStan - PHP Static Analysis Tool", - "funding": [ - { - "url": "https://github.com/ondrejmirtes", - "type": "github" - }, - { - "url": "https://www.patreon.com/phpstan", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", - "type": "tidelift" - } - ], "time": "2020-05-10T20:36:16+00:00" }, { "name": "phpstan/phpstan-phpunit", - "version": "0.12.10", + "version": "0.12.11", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-phpunit.git", - "reference": "74c1c5f00312e23533fdf579aea71a8343dd3e78" + "reference": "ab783a8ea634ea23305a8818c4750603e714489b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/74c1c5f00312e23533fdf579aea71a8343dd3e78", - "reference": "74c1c5f00312e23533fdf579aea71a8343dd3e78", + "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/ab783a8ea634ea23305a8818c4750603e714489b", + "reference": "ab783a8ea634ea23305a8818c4750603e714489b", "shasum": "" }, "require": { @@ -963,7 +935,7 @@ "MIT" ], "description": "PHPUnit extensions and rules for PHPStan", - "time": "2020-05-31T06:33:59+00:00" + "time": "2020-06-01T16:43:31+00:00" }, { "name": "phpstan/phpstan-strict-rules", @@ -1349,16 +1321,6 @@ "testing", "xunit" ], - "funding": [ - { - "url": "https://phpunit.de/donate.html", - "type": "custom" - }, - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], "time": "2020-05-22T13:51:52+00:00" }, { @@ -2032,20 +1994,6 @@ "polyfill", "portable" ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], "time": "2020-05-12T16:14:59+00:00" }, { @@ -2163,6 +2111,5 @@ "ext-zip": "*", "ext-zlib": ">=1.2.11" }, - "platform-dev": [], - "plugin-api-version": "1.1.0" + "platform-dev": [] } From d554d8060b509fad43a8aa353eccd5a72516c301 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 2 Jun 2020 10:05:42 +0100 Subject: [PATCH 3/8] fixed absorption hearts not being consumed, closes #3546 this was caused by a bad fix for switching. we can't consider zero-damage attacks as cancelled because zero-damage might have been the result of things like consuming absorption hearts, so the aftereffects need to be processed even when the net damage is zero. --- src/pocketmine/event/entity/EntityDamageEvent.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/pocketmine/event/entity/EntityDamageEvent.php b/src/pocketmine/event/entity/EntityDamageEvent.php index 065e8c724..ecc651f52 100644 --- a/src/pocketmine/event/entity/EntityDamageEvent.php +++ b/src/pocketmine/event/entity/EntityDamageEvent.php @@ -26,6 +26,7 @@ namespace pocketmine\event\entity; use pocketmine\entity\Entity; use pocketmine\event\Cancellable; use function array_sum; +use function max; /** * Called when an entity takes damage. @@ -144,7 +145,7 @@ class EntityDamageEvent extends EntityEvent implements Cancellable{ } public function getFinalDamage() : float{ - return $this->baseDamage + array_sum($this->modifiers); + return max(0, $this->baseDamage + array_sum($this->modifiers)); } /** @@ -182,8 +183,4 @@ class EntityDamageEvent extends EntityEvent implements Cancellable{ public function setAttackCooldown(int $attackCooldown) : void{ $this->attackCooldown = $attackCooldown; } - - public function isCancelled() : bool{ - return parent::isCancelled() or $this->getFinalDamage() <= 0; - } } From d36b24c5185d2fb7fcd448cbdb9cb8530ca94f29 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 2 Jun 2020 18:40:33 +0100 Subject: [PATCH 4/8] Release 3.12.4 --- changelogs/3.12.md | 5 ++++- src/pocketmine/VersionInfo.php | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/changelogs/3.12.md b/changelogs/3.12.md index c53681d1e..b8babc6b7 100644 --- a/changelogs/3.12.md +++ b/changelogs/3.12.md @@ -44,4 +44,7 @@ Plugin developers should **only** update their required API to this version if y - `mobflame` particle can now be spawned using the `/particle` command. - Fixed several internal errors that could occur while modifying writable books. - Fixed swapping writable book pages not working in some cases. -- `WritableBook->getPageText()` no longer throws an exception when the page doesn't exist, but returns null (as it was originally intended to). \ No newline at end of file +- `WritableBook->getPageText()` no longer throws an exception when the page doesn't exist, but returns null (as it was originally intended to). + +# 3.12.4 +- Fixed absorption hearts not being consumed. diff --git a/src/pocketmine/VersionInfo.php b/src/pocketmine/VersionInfo.php index cab2a15e6..935bc7f62 100644 --- a/src/pocketmine/VersionInfo.php +++ b/src/pocketmine/VersionInfo.php @@ -34,5 +34,5 @@ const _VERSION_INFO_INCLUDED = true; const NAME = "PocketMine-MP"; const BASE_VERSION = "3.12.4"; -const IS_DEVELOPMENT_BUILD = true; +const IS_DEVELOPMENT_BUILD = false; const BUILD_NUMBER = 0; From 734bc6c4a741e964b9310dfdaa0326df951691d3 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 2 Jun 2020 18:40:33 +0100 Subject: [PATCH 5/8] 3.12.5 is next --- src/pocketmine/VersionInfo.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pocketmine/VersionInfo.php b/src/pocketmine/VersionInfo.php index 935bc7f62..3d8774eef 100644 --- a/src/pocketmine/VersionInfo.php +++ b/src/pocketmine/VersionInfo.php @@ -33,6 +33,6 @@ if(defined('pocketmine\_VERSION_INFO_INCLUDED')){ const _VERSION_INFO_INCLUDED = true; const NAME = "PocketMine-MP"; -const BASE_VERSION = "3.12.4"; -const IS_DEVELOPMENT_BUILD = false; +const BASE_VERSION = "3.12.5"; +const IS_DEVELOPMENT_BUILD = true; const BUILD_NUMBER = 0; From 915224c8e55e39aaf049efeedf999fda984a51d3 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 2 Jun 2020 23:18:40 +0100 Subject: [PATCH 6/8] Living: fix being unable to die in the void --- src/pocketmine/entity/Living.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pocketmine/entity/Living.php b/src/pocketmine/entity/Living.php index fdafc66e7..9ffb0b8dd 100644 --- a/src/pocketmine/entity/Living.php +++ b/src/pocketmine/entity/Living.php @@ -437,6 +437,9 @@ abstract class Living extends Entity implements Damageable{ */ public function applyDamageModifiers(EntityDamageEvent $source) : void{ if($this->lastDamageCause !== null and $this->attackTime > 0){ + if($this->lastDamageCause->getBaseDamage() >= $source->getBaseDamage()){ + $source->setCancelled(); + } $source->setModifier(-$this->lastDamageCause->getBaseDamage(), EntityDamageEvent::MODIFIER_PREVIOUS_DAMAGE_COOLDOWN); } if($source->canBeReducedByArmor()){ From c32026333f8b86b99c7b1994a91f63a9687dd56e Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 3 Jun 2020 10:59:33 +0100 Subject: [PATCH 7/8] Release 3.12.5 --- changelogs/3.12.md | 3 +++ src/pocketmine/VersionInfo.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/changelogs/3.12.md b/changelogs/3.12.md index b8babc6b7..cb03ce0ad 100644 --- a/changelogs/3.12.md +++ b/changelogs/3.12.md @@ -48,3 +48,6 @@ Plugin developers should **only** update their required API to this version if y # 3.12.4 - Fixed absorption hearts not being consumed. + +# 3.12.5 +- Fixed broken attack cooldowns. \ No newline at end of file diff --git a/src/pocketmine/VersionInfo.php b/src/pocketmine/VersionInfo.php index 3d8774eef..601481b36 100644 --- a/src/pocketmine/VersionInfo.php +++ b/src/pocketmine/VersionInfo.php @@ -34,5 +34,5 @@ const _VERSION_INFO_INCLUDED = true; const NAME = "PocketMine-MP"; const BASE_VERSION = "3.12.5"; -const IS_DEVELOPMENT_BUILD = true; +const IS_DEVELOPMENT_BUILD = false; const BUILD_NUMBER = 0; From 92ed9e61256a3ba353202e29d05c42acdf9e9528 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 3 Jun 2020 10:59:33 +0100 Subject: [PATCH 8/8] 3.12.6 is next --- src/pocketmine/VersionInfo.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pocketmine/VersionInfo.php b/src/pocketmine/VersionInfo.php index 601481b36..239801b55 100644 --- a/src/pocketmine/VersionInfo.php +++ b/src/pocketmine/VersionInfo.php @@ -33,6 +33,6 @@ if(defined('pocketmine\_VERSION_INFO_INCLUDED')){ const _VERSION_INFO_INCLUDED = true; const NAME = "PocketMine-MP"; -const BASE_VERSION = "3.12.5"; -const IS_DEVELOPMENT_BUILD = false; +const BASE_VERSION = "3.12.6"; +const IS_DEVELOPMENT_BUILD = true; const BUILD_NUMBER = 0;