mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-06 11:57:10 +00:00
Merge branch 'next-minor'
# Conflicts: # changelogs/3.12.md # resources/vanilla # src/VersionInfo.php
This commit is contained in:
commit
b58c425189
@ -25,3 +25,29 @@ Plugin developers should **only** update their required API to this version if y
|
||||
- Fixed server crash when `network.compression-level` is overridden by a CLI parameter.
|
||||
- Fixed moving entities spawning themselves to players registered on chunks when the players haven't received the chunk yet.
|
||||
- Cocoa pods now drop cocoa beans when broken instead of the block itself.
|
||||
|
||||
# 3.12.3
|
||||
- Core code is now analyzed using PHPStan level 8 (using baselines). While not all the code is level 8 compliant, this does mean that new code will be held to a higher standard, ensuring quality going forwards.
|
||||
- Players no longer burn when melee-attacked by other players. (vanilla parity)
|
||||
- Arrows shot by burning players are no longer on fire. (vanilla parity)
|
||||
- Fixed a crash that could occur with plugins on Unix filesystems that had backslashes in their names.
|
||||
- Cleaned up a whole bunch of unknowns in the protocol layer. Many new constants have been added.
|
||||
- Fixed player walking sounds.
|
||||
- Default generation queue size has been raised to 32 (previously 8). The previous default was selected in a time when PHP was much less performant than it is today, and in today's world it just needlessly slows things down.
|
||||
- Double plants are now burned away by fire.
|
||||
- Snow layers can now be stacked. (vanilla parity)
|
||||
- Resource pack sending chunk size has been reduced to 128 KB (previously 1 MB). This change was made after analyzing the effects that larger pack chunk sizes have on RakNet. Given the technical evidence, a smaller size, while slightly less bandwidth-efficient, should be more manageable for RakNet due to lower split reassembly overhead and reduced memory pressure.
|
||||
- Fixed "switching" (an exploit often complained about by PvP players). Now, the previous damage is subtracted from current damage when an entity is attacked while on cooldown. This means that attacking with a wooden sword and then diamond sword while attack cooldown is active will only deal as much damage as the diamond sword would have, instead of the combined total. This can be controlled using the `EntityDamageEvent::MODIFIER_PREVIOUS_DAMAGE_COOLDOWN` modifier. (vanilla parity)
|
||||
- Fixed projectiles knocking mobs back in unexpected directions on collision.
|
||||
- Fixed inventories not being synchronized on failed inventory transactions.
|
||||
- Vector3s decoded from packets are no longer rounded directly. Instead, the player movement handler takes responsibility for rounding the coordinates to prevent anti cheat doing something it's not supposed to.
|
||||
- `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).
|
||||
|
||||
# 3.12.4
|
||||
- Fixed absorption hearts not being consumed.
|
||||
|
||||
# 3.12.5
|
||||
- Fixed broken attack cooldowns.
|
111
changelogs/3.13.md
Normal file
111
changelogs/3.13.md
Normal file
@ -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()`
|
65
composer.lock
generated
65
composer.lock
generated
@ -1004,20 +1004,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"
|
||||
},
|
||||
{
|
||||
@ -1421,34 +1407,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": {
|
||||
@ -1491,7 +1463,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",
|
||||
@ -1877,16 +1849,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"
|
||||
},
|
||||
{
|
||||
@ -2560,20 +2522,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"
|
||||
},
|
||||
{
|
||||
@ -2706,6 +2654,5 @@
|
||||
"ext-zip": "*",
|
||||
"ext-zlib": ">=1.2.11"
|
||||
},
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "1.1.0"
|
||||
"platform-dev": []
|
||||
}
|
||||
|
@ -356,6 +356,9 @@ abstract class Living extends Entity{
|
||||
*/
|
||||
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()){
|
||||
|
@ -27,6 +27,7 @@ use pocketmine\entity\Entity;
|
||||
use pocketmine\event\Cancellable;
|
||||
use pocketmine\event\CancellableTrait;
|
||||
use function array_sum;
|
||||
use function max;
|
||||
|
||||
/**
|
||||
* Called when an entity takes damage.
|
||||
@ -147,7 +148,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));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -185,8 +186,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;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user