From b56b35b10d643f0b1b98b259daa1b9f888291638 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 17 Feb 2023 20:14:38 +0000 Subject: [PATCH 1/5] ItemEntity: fixed a bunch of suspicious logic in entityBaseTick() closes #5580 --- src/entity/object/ItemEntity.php | 44 +++++++++++++++++++------------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/src/entity/object/ItemEntity.php b/src/entity/object/ItemEntity.php index 4a58620f7..08dea0659 100644 --- a/src/entity/object/ItemEntity.php +++ b/src/entity/object/ItemEntity.php @@ -113,33 +113,42 @@ class ItemEntity extends Entity{ $hasUpdate = parent::entityBaseTick($tickDiff); - if(!$this->isFlaggedForDespawn() && $this->pickupDelay !== self::NEVER_DESPAWN){ //Infinite delay + if($this->isFlaggedForDespawn()){ + return $hasUpdate; + } + + if($this->pickupDelay !== self::NEVER_DESPAWN && $this->pickupDelay > 0){ //Infinite delay + $hasUpdate = true; $this->pickupDelay -= $tickDiff; if($this->pickupDelay < 0){ $this->pickupDelay = 0; } - if($this->hasMovementUpdate() && $this->despawnDelay % self::MERGE_CHECK_PERIOD === 0){ - $mergeable = [$this]; //in case the merge target ends up not being this - $mergeTarget = $this; - foreach($this->getWorld()->getNearbyEntities($this->boundingBox->expandedCopy(0.5, 0.5, 0.5), $this) as $entity){ - if(!$entity instanceof ItemEntity || $entity->isFlaggedForDespawn()){ - continue; - } + } - if($entity->isMergeable($this)){ - $mergeable[] = $entity; - if($entity->item->getCount() > $mergeTarget->item->getCount()){ - $mergeTarget = $entity; - } - } + if($this->hasMovementUpdate() && $this->despawnDelay % self::MERGE_CHECK_PERIOD === 0){ + $mergeable = [$this]; //in case the merge target ends up not being this + $mergeTarget = $this; + foreach($this->getWorld()->getNearbyEntities($this->boundingBox->expandedCopy(0.5, 0.5, 0.5), $this) as $entity){ + if(!$entity instanceof ItemEntity || $entity->isFlaggedForDespawn()){ + continue; } - foreach($mergeable as $itemEntity){ - if($itemEntity !== $mergeTarget){ - $itemEntity->tryMergeInto($mergeTarget); + + if($entity->isMergeable($this)){ + $mergeable[] = $entity; + if($entity->item->getCount() > $mergeTarget->item->getCount()){ + $mergeTarget = $entity; } } } + foreach($mergeable as $itemEntity){ + if($itemEntity !== $mergeTarget){ + $itemEntity->tryMergeInto($mergeTarget); + } + } + } + if(!$this->isFlaggedForDespawn() && $this->despawnDelay !== self::NEVER_DESPAWN){ + $hasUpdate = true; $this->despawnDelay -= $tickDiff; if($this->despawnDelay <= 0){ $ev = new ItemDespawnEvent($this); @@ -148,7 +157,6 @@ class ItemEntity extends Entity{ $this->despawnDelay = self::DEFAULT_DESPAWN_DELAY; }else{ $this->flagForDespawn(); - $hasUpdate = true; } } } From 168af31fd7cd096fe42e606ce904f8f6780eb302 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Feb 2023 18:39:29 +0000 Subject: [PATCH 2/5] Bump phpstan/phpstan from 1.9.17 to 1.9.18 (#5585) Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.9.17 to 1.9.18. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.10.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.9.17...1.9.18) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- composer.json | 2 +- composer.lock | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 159e007be..9da2cb8bf 100644 --- a/composer.json +++ b/composer.json @@ -54,7 +54,7 @@ "webmozart/path-util": "^2.3" }, "require-dev": { - "phpstan/phpstan": "1.9.17", + "phpstan/phpstan": "1.9.18", "phpstan/phpstan-phpunit": "^1.1.0", "phpstan/phpstan-strict-rules": "^1.2.0", "phpunit/phpunit": "^9.2" diff --git a/composer.lock b/composer.lock index 9bd452dca..f82fd893b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "56a1e8facd8fd7d56d6c7d2eb390e842", + "content-hash": "a6622fa16daeb7ba4d9a792579db468f", "packages": [ { "name": "adhocore/json-comment", @@ -1832,16 +1832,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.9.17", + "version": "1.9.18", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "204e459e7822f2c586463029f5ecec31bb45a1f2" + "reference": "f2d5cf71be91172a57c649770b73c20ebcffb0bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/204e459e7822f2c586463029f5ecec31bb45a1f2", - "reference": "204e459e7822f2c586463029f5ecec31bb45a1f2", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/f2d5cf71be91172a57c649770b73c20ebcffb0bf", + "reference": "f2d5cf71be91172a57c649770b73c20ebcffb0bf", "shasum": "" }, "require": { @@ -1871,7 +1871,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.9.17" + "source": "https://github.com/phpstan/phpstan/tree/1.9.18" }, "funding": [ { @@ -1887,7 +1887,7 @@ "type": "tidelift" } ], - "time": "2023-02-08T12:25:00+00:00" + "time": "2023-02-17T15:01:27+00:00" }, { "name": "phpstan/phpstan-phpunit", From 799739fe86194f81caf443eaf8f01887c7d66561 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 21 Feb 2023 15:22:38 +0000 Subject: [PATCH 3/5] Updated build/php submodule to pmmp/PHP-Binaries@b2207cf70d3fc5b81f50a655aba4730fcf40a37c --- build/php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/php b/build/php index fb297eb51..b2207cf70 160000 --- a/build/php +++ b/build/php @@ -1 +1 @@ -Subproject commit fb297eb511862ef3d4ca0aff5256a8caf5513cb4 +Subproject commit b2207cf70d3fc5b81f50a655aba4730fcf40a37c From 47e9ecd2578b8232f8f3f7f9b7a469fed46e8332 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 21 Feb 2023 15:23:25 +0000 Subject: [PATCH 4/5] Release 4.15.1 --- changelogs/4.15.md | 8 ++++++++ src/VersionInfo.php | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/changelogs/4.15.md b/changelogs/4.15.md index b80115e88..c8543a0f1 100644 --- a/changelogs/4.15.md +++ b/changelogs/4.15.md @@ -12,3 +12,11 @@ Released 17th February 2023. ## General - Added support for Minecraft: Bedrock Edition 1.19.62. - Removed support for older versions. + +# 4.15.1 +Released 21st February 2023. + +## Fixes +- Fixed dropped items not despawning when in non-ticking chunks. +- Fixed dropped items not despawning if an infinite pickup delay is set. +- Fixed infinite despawn delay (never despawn) being ignored for dropped items. diff --git a/src/VersionInfo.php b/src/VersionInfo.php index a763bf070..4f3f19490 100644 --- a/src/VersionInfo.php +++ b/src/VersionInfo.php @@ -32,7 +32,7 @@ use function str_repeat; final class VersionInfo{ public const NAME = "PocketMine-MP"; public const BASE_VERSION = "4.15.1"; - public const IS_DEVELOPMENT_BUILD = true; + public const IS_DEVELOPMENT_BUILD = false; public const BUILD_CHANNEL = "stable"; private function __construct(){ From b574d49d361d9f38a33df12bfc0f4812107a91e7 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 21 Feb 2023 15:23:25 +0000 Subject: [PATCH 5/5] 4.15.2 is next --- src/VersionInfo.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/VersionInfo.php b/src/VersionInfo.php index 4f3f19490..8f62b9718 100644 --- a/src/VersionInfo.php +++ b/src/VersionInfo.php @@ -31,8 +31,8 @@ use function str_repeat; final class VersionInfo{ public const NAME = "PocketMine-MP"; - public const BASE_VERSION = "4.15.1"; - public const IS_DEVELOPMENT_BUILD = false; + public const BASE_VERSION = "4.15.2"; + public const IS_DEVELOPMENT_BUILD = true; public const BUILD_CHANNEL = "stable"; private function __construct(){