Merge branch 'stable'

This commit is contained in:
Dylan K. Taylor
2021-02-02 13:46:29 +00:00
8 changed files with 52 additions and 25 deletions

View File

@@ -51,7 +51,7 @@ class BlockBreakEvent extends BlockEvent implements Cancellable{
/**
* @param Item[] $drops
*/
public function __construct(Player $player, Block $block, Item $item, bool $instaBreak = false, array $drops, int $xpDrops = 0){
public function __construct(Player $player, Block $block, Item $item, bool $instaBreak = false, array $drops = [], int $xpDrops = 0){
parent::__construct($block);
$this->item = $item;
$this->player = $player;

View File

@@ -30,6 +30,7 @@ use pocketmine\inventory\transaction\action\SlotChangeAction;
use pocketmine\item\Item;
use pocketmine\player\Player;
use function array_keys;
use function array_values;
use function assert;
use function count;
use function get_class;
@@ -171,6 +172,8 @@ class InventoryTransaction{
}
}
}
$needItems = array_values($needItems);
$haveItems = array_values($haveItems);
}
/**

View File

@@ -32,6 +32,7 @@ use pocketmine\world\format\io\exception\CorruptedChunkException;
use function assert;
use function ceil;
use function chr;
use function clearstatcache;
use function fclose;
use function feof;
use function file_exists;
@@ -91,6 +92,7 @@ class RegionLoader{
* @throws CorruptedRegionException
*/
public function open() : void{
clearstatcache(false, $this->filePath);
$exists = file_exists($this->filePath);
if(!$exists){
touch($this->filePath);
@@ -370,6 +372,7 @@ class RegionLoader{
fwrite($this->filePointer, Binary::writeInt($entry !== null ? ($entry->getFirstSector() << 8) | $entry->getSectorCount() : 0), 4);
fseek($this->filePointer, 4096 + ($index << 2));
fwrite($this->filePointer, Binary::writeInt($entry !== null ? $entry->getTimestamp() : 0), 4);
clearstatcache(false, $this->filePath);
}
protected function createBlank() : void{