mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-03 16:49:53 +00:00
Merge branch 'stable' into minor-next
This commit is contained in:
commit
6cad559dbe
@ -35,7 +35,7 @@
|
|||||||
* [Building and running from source](BUILDING.md)
|
* [Building and running from source](BUILDING.md)
|
||||||
* [Developer documentation](https://devdoc.pmmp.io) - General documentation for PocketMine-MP plugin developers
|
* [Developer documentation](https://devdoc.pmmp.io) - General documentation for PocketMine-MP plugin developers
|
||||||
* [Latest release API documentation](https://apidoc.pmmp.io) - Doxygen API documentation generated for each release
|
* [Latest release API documentation](https://apidoc.pmmp.io) - Doxygen API documentation generated for each release
|
||||||
* [Latest bleeding-edge API documentation](https://apidoc-dev.pmmp.io) - Doxygen API documentation generated weekly from `next-major` branch
|
* [Latest bleeding-edge API documentation](https://apidoc-dev.pmmp.io) - Doxygen API documentation generated weekly from `major-next` branch
|
||||||
* [DevTools](https://github.com/pmmp/DevTools/) - Development tools plugin for creating plugins
|
* [DevTools](https://github.com/pmmp/DevTools/) - Development tools plugin for creating plugins
|
||||||
* [ExamplePlugin](https://github.com/pmmp/ExamplePlugin/) - Example plugin demonstrating some basic API features
|
* [ExamplePlugin](https://github.com/pmmp/ExamplePlugin/) - Example plugin demonstrating some basic API features
|
||||||
* [Contributing Guidelines](CONTRIBUTING.md)
|
* [Contributing Guidelines](CONTRIBUTING.md)
|
||||||
|
@ -44,3 +44,10 @@ Released 27th April 2023.
|
|||||||
## Internals
|
## Internals
|
||||||
- `ItemStackContainerIdTranslator::translate()` now requires an additional `int $slotId` parameter and returns `array{int, int}` (translated window ID, translated slot ID) to be used with `InventoryManager->locateWindowAndSlot()`.
|
- `ItemStackContainerIdTranslator::translate()` now requires an additional `int $slotId` parameter and returns `array{int, int}` (translated window ID, translated slot ID) to be used with `InventoryManager->locateWindowAndSlot()`.
|
||||||
- `InventoryManager->locateWindowAndSlot()` now checks if the translated slot actually exists in the requested inventory, and returns `null` if not. Previously, it would return potentially invalid slot IDs without checking them, potentially leading to crashes.
|
- `InventoryManager->locateWindowAndSlot()` now checks if the translated slot actually exists in the requested inventory, and returns `null` if not. Previously, it would return potentially invalid slot IDs without checking them, potentially leading to crashes.
|
||||||
|
|
||||||
|
# 4.20.2
|
||||||
|
Released 4th May 2023.
|
||||||
|
|
||||||
|
## Fixes
|
||||||
|
- Fixed all types of wooden logs appearing as oak in the inventory.
|
||||||
|
- Fixed a performance issue in `BaseInventory->canAddItem()` (missing `continue` causing useless logic to run).
|
||||||
|
12
composer.lock
generated
12
composer.lock
generated
@ -1085,16 +1085,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/filesystem",
|
"name": "symfony/filesystem",
|
||||||
"version": "v5.4.21",
|
"version": "v5.4.23",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/filesystem.git",
|
"url": "https://github.com/symfony/filesystem.git",
|
||||||
"reference": "e75960b1bbfd2b8c9e483e0d74811d555ca3de9f"
|
"reference": "b2f79d86cd9e7de0fff6d03baa80eaed7a5f38b5"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/filesystem/zipball/e75960b1bbfd2b8c9e483e0d74811d555ca3de9f",
|
"url": "https://api.github.com/repos/symfony/filesystem/zipball/b2f79d86cd9e7de0fff6d03baa80eaed7a5f38b5",
|
||||||
"reference": "e75960b1bbfd2b8c9e483e0d74811d555ca3de9f",
|
"reference": "b2f79d86cd9e7de0fff6d03baa80eaed7a5f38b5",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -1129,7 +1129,7 @@
|
|||||||
"description": "Provides basic utilities for the filesystem",
|
"description": "Provides basic utilities for the filesystem",
|
||||||
"homepage": "https://symfony.com",
|
"homepage": "https://symfony.com",
|
||||||
"support": {
|
"support": {
|
||||||
"source": "https://github.com/symfony/filesystem/tree/v5.4.21"
|
"source": "https://github.com/symfony/filesystem/tree/v5.4.23"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@ -1145,7 +1145,7 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2023-02-14T08:03:56+00:00"
|
"time": "2023-03-02T11:38:35+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/polyfill-ctype",
|
"name": "symfony/polyfill-ctype",
|
||||||
|
@ -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.20.2";
|
public const BASE_VERSION = "4.20.3";
|
||||||
public const IS_DEVELOPMENT_BUILD = true;
|
public const IS_DEVELOPMENT_BUILD = true;
|
||||||
public const BUILD_CHANNEL = "stable";
|
public const BUILD_CHANNEL = "stable";
|
||||||
|
|
||||||
|
@ -110,6 +110,12 @@ final class ItemTranslator{
|
|||||||
//new item without a fixed legacy ID - we can't handle this right now
|
//new item without a fixed legacy ID - we can't handle this right now
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if(isset($complexMappings[$newId]) && $complexMappings[$newId][0] === $intId && $complexMappings[$newId][1] <= $meta){
|
||||||
|
//TODO: HACK! Multiple legacy ID/meta pairs can be mapped to the same new ID (see minecraft:log)
|
||||||
|
//Assume that the first one is the most relevant for now
|
||||||
|
//However, this could catch fire in the future if this assumption is broken
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$complexMappings[$newId] = [$intId, (int) $meta];
|
$complexMappings[$newId] = [$intId, (int) $meta];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,12 @@ use pocketmine\block\Block;
|
|||||||
use pocketmine\block\BlockLegacyIds;
|
use pocketmine\block\BlockLegacyIds;
|
||||||
use pocketmine\data\bedrock\BedrockDataFiles;
|
use pocketmine\data\bedrock\BedrockDataFiles;
|
||||||
use pocketmine\data\bedrock\LegacyBlockIdToStringIdMap;
|
use pocketmine\data\bedrock\LegacyBlockIdToStringIdMap;
|
||||||
|
use pocketmine\nbt\LittleEndianNbtSerializer;
|
||||||
|
use pocketmine\nbt\tag\ByteTag;
|
||||||
use pocketmine\nbt\tag\CompoundTag;
|
use pocketmine\nbt\tag\CompoundTag;
|
||||||
|
use pocketmine\nbt\tag\IntTag;
|
||||||
|
use pocketmine\nbt\tag\StringTag;
|
||||||
|
use pocketmine\nbt\TreeRoot;
|
||||||
use pocketmine\network\mcpe\protocol\serializer\NetworkNbtSerializer;
|
use pocketmine\network\mcpe\protocol\serializer\NetworkNbtSerializer;
|
||||||
use pocketmine\utils\BinaryStream;
|
use pocketmine\utils\BinaryStream;
|
||||||
use pocketmine\utils\Filesystem;
|
use pocketmine\utils\Filesystem;
|
||||||
@ -53,15 +58,45 @@ final class RuntimeBlockMapping{
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string[] $keyIndex
|
||||||
|
* @param (ByteTag|StringTag|IntTag)[][] $valueIndex
|
||||||
|
* @phpstan-param array<string, string> $keyIndex
|
||||||
|
* @phpstan-param array<int, array<int|string, ByteTag|IntTag|StringTag>> $valueIndex
|
||||||
|
*/
|
||||||
|
private static function deduplicateCompound(CompoundTag $tag, array &$keyIndex, array &$valueIndex) : CompoundTag{
|
||||||
|
if($tag->count() === 0){
|
||||||
|
return $tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
$newTag = CompoundTag::create();
|
||||||
|
foreach($tag as $key => $value){
|
||||||
|
$key = $keyIndex[$key] ??= $key;
|
||||||
|
|
||||||
|
if($value instanceof CompoundTag){
|
||||||
|
$value = $valueIndex[$value->getType()][(new LittleEndianNbtSerializer())->write(new TreeRoot($value))] ??= self::deduplicateCompound($value, $keyIndex, $valueIndex);
|
||||||
|
}elseif($value instanceof ByteTag || $value instanceof IntTag || $value instanceof StringTag){
|
||||||
|
$value = $valueIndex[$value->getType()][$value->getValue()] ??= $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
$newTag->setTag($key, $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $newTag;
|
||||||
|
}
|
||||||
|
|
||||||
public function __construct(string $canonicalBlockStatesFile, string $r12ToCurrentBlockMapFile){
|
public function __construct(string $canonicalBlockStatesFile, string $r12ToCurrentBlockMapFile){
|
||||||
$stream = new BinaryStream(Filesystem::fileGetContents($canonicalBlockStatesFile));
|
$stream = new BinaryStream(Filesystem::fileGetContents($canonicalBlockStatesFile));
|
||||||
$list = [];
|
$list = [];
|
||||||
$nbtReader = new NetworkNbtSerializer();
|
$nbtReader = new NetworkNbtSerializer();
|
||||||
|
|
||||||
|
$keyIndex = [];
|
||||||
|
$valueIndex = [];
|
||||||
while(!$stream->feof()){
|
while(!$stream->feof()){
|
||||||
$offset = $stream->getOffset();
|
$offset = $stream->getOffset();
|
||||||
$blockState = $nbtReader->read($stream->getBuffer(), $offset)->mustGetCompoundTag();
|
$blockState = $nbtReader->read($stream->getBuffer(), $offset)->mustGetCompoundTag();
|
||||||
$stream->setOffset($offset);
|
$stream->setOffset($offset);
|
||||||
$list[] = $blockState;
|
$list[] = self::deduplicateCompound($blockState, $keyIndex, $valueIndex);
|
||||||
}
|
}
|
||||||
$this->bedrockKnownStates = $list;
|
$this->bedrockKnownStates = $list;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user