From a7ac6070dcd00d87c1a0f773d508a7b1af0c27d0 Mon Sep 17 00:00:00 2001 From: IvanCraft623 <57236932+IvanCraft623@users.noreply.github.com> Date: Mon, 7 Nov 2022 15:05:53 -0500 Subject: [PATCH 1/6] Correct damage calculation for non-arrow projectiles (#5394) --- src/entity/projectile/Arrow.php | 3 ++- src/entity/projectile/Projectile.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/entity/projectile/Arrow.php b/src/entity/projectile/Arrow.php index 2ec412545..df3237d62 100644 --- a/src/entity/projectile/Arrow.php +++ b/src/entity/projectile/Arrow.php @@ -38,6 +38,7 @@ use pocketmine\network\mcpe\protocol\types\entity\EntityMetadataCollection; use pocketmine\network\mcpe\protocol\types\entity\EntityMetadataFlags; use pocketmine\player\Player; use pocketmine\world\sound\ArrowHitSound; +use function ceil; use function mt_rand; use function sqrt; @@ -103,7 +104,7 @@ class Arrow extends Projectile{ } public function getResultDamage() : int{ - $base = parent::getResultDamage(); + $base = (int) ceil($this->motion->length() * parent::getResultDamage()); if($this->isCritical()){ return ($base + mt_rand(0, (int) ($base / 2) + 1)); }else{ diff --git a/src/entity/projectile/Projectile.php b/src/entity/projectile/Projectile.php index 0d6fe2a35..be2082948 100644 --- a/src/entity/projectile/Projectile.php +++ b/src/entity/projectile/Projectile.php @@ -128,7 +128,7 @@ abstract class Projectile extends Entity{ * Returns the amount of damage this projectile will deal to the entity it hits. */ public function getResultDamage() : int{ - return (int) ceil($this->motion->length() * $this->damage); + return (int) ceil($this->damage); } public function saveNBT() : CompoundTag{ From 50efcf74244b1d3d069796039f8bde28e3c7f830 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Nov 2022 13:40:09 +0000 Subject: [PATCH 2/6] Bump ramsey/uuid from 4.5.1 to 4.6.0 (#5400) Bumps [ramsey/uuid](https://github.com/ramsey/uuid) from 4.5.1 to 4.6.0. - [Release notes](https://github.com/ramsey/uuid/releases) - [Changelog](https://github.com/ramsey/uuid/blob/4.x/CHANGELOG.md) - [Commits](https://github.com/ramsey/uuid/compare/4.5.1...4.6.0) --- updated-dependencies: - dependency-name: ramsey/uuid dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- composer.lock | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/composer.lock b/composer.lock index b3cd775be..358751514 100644 --- a/composer.lock +++ b/composer.lock @@ -930,21 +930,20 @@ }, { "name": "ramsey/uuid", - "version": "4.5.1", + "version": "4.6.0", "source": { "type": "git", "url": "https://github.com/ramsey/uuid.git", - "reference": "a161a26d917604dc6d3aa25100fddf2556e9f35d" + "reference": "ad63bc700e7d021039e30ce464eba384c4a1d40f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/a161a26d917604dc6d3aa25100fddf2556e9f35d", - "reference": "a161a26d917604dc6d3aa25100fddf2556e9f35d", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/ad63bc700e7d021039e30ce464eba384c4a1d40f", + "reference": "ad63bc700e7d021039e30ce464eba384c4a1d40f", "shasum": "" }, "require": { "brick/math": "^0.8.8 || ^0.9 || ^0.10", - "ext-ctype": "*", "ext-json": "*", "php": "^8.0", "ramsey/collection": "^1.0" @@ -976,7 +975,6 @@ }, "suggest": { "ext-bcmath": "Enables faster math with arbitrary-precision integers using BCMath.", - "ext-ctype": "Enables faster processing of character classification using ctype functions.", "ext-gmp": "Enables faster math with arbitrary-precision integers using GMP.", "ext-uuid": "Enables the use of PeclUuidTimeGenerator and PeclUuidRandomGenerator.", "paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter", @@ -1008,7 +1006,7 @@ ], "support": { "issues": "https://github.com/ramsey/uuid/issues", - "source": "https://github.com/ramsey/uuid/tree/4.5.1" + "source": "https://github.com/ramsey/uuid/tree/4.6.0" }, "funding": [ { @@ -1020,7 +1018,7 @@ "type": "tidelift" } ], - "time": "2022-09-16T03:22:46+00:00" + "time": "2022-11-05T23:03:38+00:00" }, { "name": "symfony/polyfill-php81", From 93e661aa4e600e8193e4a57f987c6abf04386d87 Mon Sep 17 00:00:00 2001 From: Artem Turov <58974140+Lunarelly@users.noreply.github.com> Date: Wed, 9 Nov 2022 16:40:35 +0300 Subject: [PATCH 3/6] Removed useless @inheritDoc (#5399) --- src/player/Player.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/player/Player.php b/src/player/Player.php index f93ac2dfc..904bf5793 100644 --- a/src/player/Player.php +++ b/src/player/Player.php @@ -2405,9 +2405,6 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{ $this->ySize = 0; } - /** - * {@inheritdoc} - */ public function teleport(Vector3 $pos, ?float $yaw = null, ?float $pitch = null) : bool{ if(parent::teleport($pos, $yaw, $pitch)){ From ef100b248b72dbe0238abd202c4d1ac11ff375ee Mon Sep 17 00:00:00 2001 From: Artem Turov <58974140+Lunarelly@users.noreply.github.com> Date: Sat, 12 Nov 2022 16:52:49 +0300 Subject: [PATCH 4/6] Improved doc comment for Internet::getIP() (#5406) --- src/utils/Internet.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/Internet.php b/src/utils/Internet.php index 7f379d7dc..3c22e460f 100644 --- a/src/utils/Internet.php +++ b/src/utils/Internet.php @@ -70,7 +70,7 @@ class Internet{ public static $online = true; /** - * Gets the External IP using an external service, it is cached + * Lazily gets the External IP using an external service and caches the result * * @param bool $force default false, force IP check even when cached * From d5e3636908648de4ba4599c8a24db26c46ac7772 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 12 Nov 2022 14:40:19 +0000 Subject: [PATCH 5/6] Timezone: Apparently timezone_id returned by timezone_abbreviations_list() may be null... --- src/player/Player.php | 8 -------- src/utils/Timezone.php | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/player/Player.php b/src/player/Player.php index 904bf5793..500e8b800 100644 --- a/src/player/Player.php +++ b/src/player/Player.php @@ -300,14 +300,6 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{ $this->chunkLoader = new PlayerChunkLoader($spawnLocation); - $world = $spawnLocation->getWorld(); - //load the spawn chunk so we can see the terrain - $xSpawnChunk = $spawnLocation->getFloorX() >> Chunk::COORD_BIT_SIZE; - $zSpawnChunk = $spawnLocation->getFloorZ() >> Chunk::COORD_BIT_SIZE; - $world->registerChunkLoader($this->chunkLoader, $xSpawnChunk, $zSpawnChunk, true); - $world->registerChunkListener($this, $xSpawnChunk, $zSpawnChunk); - $this->usedChunks[World::chunkHash($xSpawnChunk, $zSpawnChunk)] = UsedChunkStatus::NEEDED(); - parent::__construct($spawnLocation, $this->playerInfo->getSkin(), $namedtag); } diff --git a/src/utils/Timezone.php b/src/utils/Timezone.php index 02110c0eb..3cf3a19df 100644 --- a/src/utils/Timezone.php +++ b/src/utils/Timezone.php @@ -208,7 +208,7 @@ abstract class Timezone{ //That's been a bug in PHP since 2008! foreach(timezone_abbreviations_list() as $zones){ foreach($zones as $timezone){ - if($timezone['offset'] == $offset){ + if($timezone['timezone_id'] !== null && $timezone['offset'] == $offset){ return $timezone['timezone_id']; } } From 732dac6fc147087c2acf8f60d1a2db5bfc7243a6 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 12 Nov 2022 14:43:22 +0000 Subject: [PATCH 6/6] Player: revert accidental change from ef100b248b72dbe0238abd202c4d1ac11ff375ee --- src/player/Player.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/player/Player.php b/src/player/Player.php index 500e8b800..904bf5793 100644 --- a/src/player/Player.php +++ b/src/player/Player.php @@ -300,6 +300,14 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{ $this->chunkLoader = new PlayerChunkLoader($spawnLocation); + $world = $spawnLocation->getWorld(); + //load the spawn chunk so we can see the terrain + $xSpawnChunk = $spawnLocation->getFloorX() >> Chunk::COORD_BIT_SIZE; + $zSpawnChunk = $spawnLocation->getFloorZ() >> Chunk::COORD_BIT_SIZE; + $world->registerChunkLoader($this->chunkLoader, $xSpawnChunk, $zSpawnChunk, true); + $world->registerChunkListener($this, $xSpawnChunk, $zSpawnChunk); + $this->usedChunks[World::chunkHash($xSpawnChunk, $zSpawnChunk)] = UsedChunkStatus::NEEDED(); + parent::__construct($spawnLocation, $this->playerInfo->getSkin(), $namedtag); }