Merge branch 'stable' into minor-next

This commit is contained in:
Dylan K. Taylor 2023-08-09 16:14:05 +01:00
commit 7826e0a11e
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
8 changed files with 54 additions and 11 deletions

View File

@ -49,3 +49,14 @@ Released 1st August 2023.
## Fixes
- Fixed exponentially increasing lag when many hundreds of non-mergeable dropped items occupied the same space. This disproportionately affected SkyBlock servers due to large cactus farms using water to collect items together.
# 4.23.5
Released 9th August 2023.
## General
- Updated translation data to [pmmp/Language 2.19.6](https://github.com/pmmp/Language/releases/tag/2.19.6).
## Fixes
- Fixed `PluginBase->saveResource()` leaking file resources when the data file already exists in the plugin's data folder. This bug existed since 2014 and was only discovered recently.
- Fixed coral blocks becoming dead after calling `getDropsForCompatibleTool()` on them.
- Fixed `BlockDeathEvent->getOldState()` returning a block which is already dead.

View File

@ -81,3 +81,29 @@ Consider using the `mcpe-protocol` directive in `plugin.yml` as a constraint if
- In addition, this change facilitates the use of the newly introduced `Block->getAdjacentSupportType()` API method, reducing boilerplate support-type checking code.
- Bell block code has been simplified and cleaned up.
- `TallGrass` and `DoubleTallGrass` now use a shared `TallGrassTrait` to reduce code duplication.
# 5.4.1
Released 8th August 2023.
## General
- Updated translation data to [pmmp/Language 2.19.6](https://github.com/pmmp/Language/releases/tag/2.19.6).
- [`ext-pmmpthread` 6.0.7](https://github.com/pmmp/ext-pmmpthread/releases/tag/6.0.7) is now required (needed for bug fixes).
## Fixes
- Fixed Podzol not dropping itself when mined with Silk Touch.
- Fixed `World->getSafeSpawn()` not accepting positions below `y=0` (world height limit change).
- Fixed `pocketmine\thread\Thread` and `pocketmine\thread\Worker` instances not logging any information when they crash.
- Fixed `CraftItemEvent` not cloning returned items.
## Internals
- Foreach by-reference is now disallowed via a custom PHPStan rule.
# 5.4.2
Released 9th August 2023.
## Included releases
- [4.23.5](https://github.com/pmmp/PocketMine-MP/blob/4.23.5/changelogs/4.23.md#4235) - Minor bug fixes
## Fixes
- Fixed cake accepting candle placement when slices have already been eaten.
- Fixed fire charges not lighting candles.

View File

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

View File

@ -64,7 +64,7 @@ class Cake extends BaseCake{
}
public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null, array &$returnedItems = []) : bool{
if($item instanceof ItemBlock){
if($this->bites === 0 && $item instanceof ItemBlock){
$block = $item->getBlock();
$resultBlock = null;
if($block->getTypeId() === BlockTypeIds::CANDLE){

View File

@ -61,7 +61,7 @@ final class CoralBlock extends Opaque{
}
public function getDropsForCompatibleTool(Item $item) : array{
return [$this->setDead(true)->asItem()];
return [(clone $this)->setDead(true)->asItem()];
}
public function isAffectedBySilkTouch() : bool{

View File

@ -33,6 +33,7 @@ use pocketmine\item\ItemTypeIds;
use pocketmine\math\RayTraceResult;
use pocketmine\math\Vector3;
use pocketmine\player\Player;
use pocketmine\world\sound\BlazeShootSound;
use pocketmine\world\sound\FireExtinguishSound;
use pocketmine\world\sound\FlintSteelSound;
@ -57,12 +58,16 @@ trait CandleTrait{
/** @see Block::onInteract() */
public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null, array &$returnedItems = []) : bool{
if($item->getTypeId() === ItemTypeIds::FLINT_AND_STEEL || $item->hasEnchantment(VanillaEnchantments::FIRE_ASPECT())){
if($item->getTypeId() === ItemTypeIds::FIRE_CHARGE || $item->getTypeId() === ItemTypeIds::FLINT_AND_STEEL || $item->hasEnchantment(VanillaEnchantments::FIRE_ASPECT())){
if($this->lit){
return true;
}
if($item instanceof Durable){
$item->applyDamage(1);
}elseif($item->getTypeId() === ItemTypeIds::FIRE_CHARGE){
$item->pop();
//TODO: not sure if this is intentional, but it's what Bedrock currently does as of 1.20.10
$this->position->getWorld()->addSound($this->position, new BlazeShootSound());
}
$this->position->getWorld()->addSound($this->position, new FlintSteelSound());
$this->position->getWorld()->setBlock($this->position, $this->setLit(true));

View File

@ -30,6 +30,7 @@ use pocketmine\event\Event;
use pocketmine\inventory\transaction\CraftingTransaction;
use pocketmine\item\Item;
use pocketmine\player\Player;
use pocketmine\utils\Utils;
class CraftItemEvent extends Event implements Cancellable{
use CancellableTrait;
@ -74,7 +75,7 @@ class CraftItemEvent extends Event implements Cancellable{
* @return Item[]
*/
public function getInputs() : array{
return $this->inputs;
return Utils::cloneObjectArray($this->inputs);
}
/**
@ -83,7 +84,7 @@ class CraftItemEvent extends Event implements Cancellable{
* @return Item[]
*/
public function getOutputs() : array{
return $this->outputs;
return Utils::cloneObjectArray($this->outputs);
}
public function getPlayer() : Player{

View File

@ -251,19 +251,19 @@ abstract class PluginBase implements Plugin, CommandExecutor{
return false;
}
$out = Path::join($this->dataFolder, $filename);
if(file_exists($out) && !$replace){
return false;
}
if(($resource = $this->getResource($filename)) === null){
return false;
}
$out = Path::join($this->dataFolder, $filename);
if(!file_exists(dirname($out))){
mkdir(dirname($out), 0755, true);
}
if(file_exists($out) && !$replace){
return false;
}
$fp = fopen($out, "wb");
if($fp === false) throw new AssumptionFailedError("fopen() should not fail with wb flags");