Merge branch 'stable' into next-minor

This commit is contained in:
Dylan K. Taylor 2023-02-21 15:37:06 +00:00
commit c4ecb3d128
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
6 changed files with 44 additions and 28 deletions

@ -1 +1 @@
Subproject commit fb297eb511862ef3d4ca0aff5256a8caf5513cb4 Subproject commit b2207cf70d3fc5b81f50a655aba4730fcf40a37c

View File

@ -12,3 +12,11 @@ Released 17th February 2023.
## General ## General
- Added support for Minecraft: Bedrock Edition 1.19.62. - Added support for Minecraft: Bedrock Edition 1.19.62.
- Removed support for older versions. - 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.

View File

@ -56,7 +56,7 @@
"webmozart/path-util": "^2.3" "webmozart/path-util": "^2.3"
}, },
"require-dev": { "require-dev": {
"phpstan/phpstan": "1.9.17", "phpstan/phpstan": "1.9.18",
"phpstan/phpstan-phpunit": "^1.1.0", "phpstan/phpstan-phpunit": "^1.1.0",
"phpstan/phpstan-strict-rules": "^1.2.0", "phpstan/phpstan-strict-rules": "^1.2.0",
"phpunit/phpunit": "^9.2" "phpunit/phpunit": "^9.2"

14
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "7e0991461c05ed03067e19ed52f4579b", "content-hash": "402f78d672d4e0bd8f092272bf7d82d7",
"packages": [ "packages": [
{ {
"name": "adhocore/json-comment", "name": "adhocore/json-comment",
@ -1884,16 +1884,16 @@
}, },
{ {
"name": "phpstan/phpstan", "name": "phpstan/phpstan",
"version": "1.9.17", "version": "1.9.18",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan.git", "url": "https://github.com/phpstan/phpstan.git",
"reference": "204e459e7822f2c586463029f5ecec31bb45a1f2" "reference": "f2d5cf71be91172a57c649770b73c20ebcffb0bf"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/204e459e7822f2c586463029f5ecec31bb45a1f2", "url": "https://api.github.com/repos/phpstan/phpstan/zipball/f2d5cf71be91172a57c649770b73c20ebcffb0bf",
"reference": "204e459e7822f2c586463029f5ecec31bb45a1f2", "reference": "f2d5cf71be91172a57c649770b73c20ebcffb0bf",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1923,7 +1923,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/phpstan/phpstan/issues", "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": [ "funding": [
{ {
@ -1939,7 +1939,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-02-08T12:25:00+00:00" "time": "2023-02-17T15:01:27+00:00"
}, },
{ {
"name": "phpstan/phpstan-phpunit", "name": "phpstan/phpstan-phpunit",

View File

@ -31,7 +31,7 @@ use function str_repeat;
final class VersionInfo{ final class VersionInfo{
public const NAME = "PocketMine-MP"; public const NAME = "PocketMine-MP";
public const BASE_VERSION = "4.15.1"; public const BASE_VERSION = "4.15.2";
public const IS_DEVELOPMENT_BUILD = true; public const IS_DEVELOPMENT_BUILD = true;
public const BUILD_CHANNEL = "stable"; public const BUILD_CHANNEL = "stable";

View File

@ -113,33 +113,42 @@ class ItemEntity extends Entity{
$hasUpdate = parent::entityBaseTick($tickDiff); $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; $this->pickupDelay -= $tickDiff;
if($this->pickupDelay < 0){ if($this->pickupDelay < 0){
$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)){ if($this->hasMovementUpdate() && $this->despawnDelay % self::MERGE_CHECK_PERIOD === 0){
$mergeable[] = $entity; $mergeable = [$this]; //in case the merge target ends up not being this
if($entity->item->getCount() > $mergeTarget->item->getCount()){ $mergeTarget = $this;
$mergeTarget = $entity; 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){ if($entity->isMergeable($this)){
$itemEntity->tryMergeInto($mergeTarget); $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; $this->despawnDelay -= $tickDiff;
if($this->despawnDelay <= 0){ if($this->despawnDelay <= 0){
$ev = new ItemDespawnEvent($this); $ev = new ItemDespawnEvent($this);
@ -148,7 +157,6 @@ class ItemEntity extends Entity{
$this->despawnDelay = self::DEFAULT_DESPAWN_DELAY; $this->despawnDelay = self::DEFAULT_DESPAWN_DELAY;
}else{ }else{
$this->flagForDespawn(); $this->flagForDespawn();
$hasUpdate = true;
} }
} }
} }