forked from pmmp/PocketMine-MP
-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/stable' into stable
- Loading branch information
Showing
62 changed files
with
858 additions
and
441 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
<?php | ||
|
||
/* | ||
* | ||
* ____ _ _ __ __ _ __ __ ____ | ||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ | ||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | | ||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ | ||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* @author PocketMine Team | ||
* @link http://www.pocketmine.net/ | ||
* | ||
* | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace pocketmine\build\generate_biome_ids; | ||
|
||
use pocketmine\data\bedrock\BedrockDataFiles; | ||
use pocketmine\utils\Filesystem; | ||
use pocketmine\utils\Utils; | ||
use function asort; | ||
use function dirname; | ||
use function fclose; | ||
use function fopen; | ||
use function fwrite; | ||
use function is_array; | ||
use function is_int; | ||
use function is_string; | ||
use function json_decode; | ||
use function str_replace; | ||
use function strtoupper; | ||
use const SORT_NUMERIC; | ||
|
||
require dirname(__DIR__) . '/vendor/autoload.php'; | ||
|
||
const HEADER = <<<'HEADER' | ||
<?php | ||
/* | ||
* | ||
* ____ _ _ __ __ _ __ __ ____ | ||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ | ||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | | ||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ | ||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* @author PocketMine Team | ||
* @link http://www.pocketmine.net/ | ||
* | ||
* | ||
*/ | ||
declare(strict_types=1); | ||
|
||
|
||
HEADER; | ||
|
||
/** @return resource */ | ||
function safe_fopen(string $file, string $flags){ | ||
$result = fopen($file, $flags); | ||
if($result === false){ | ||
throw new \RuntimeException("Failed to open file"); | ||
} | ||
return $result; | ||
} | ||
|
||
function make_const_name(string $name) : string{ | ||
return strtoupper(str_replace(['.', 'minecraft:'], ['_', ''], $name)); | ||
} | ||
|
||
/** | ||
* @param int[] $map | ||
* @phpstan-param array<string, int> $map | ||
*/ | ||
function generate(array $map, string $outputFile) : void{ | ||
$file = safe_fopen($outputFile, 'wb'); | ||
fwrite($file, HEADER); | ||
fwrite($file, <<<'CLASSHEADER' | ||
namespace pocketmine\data\bedrock; | ||
final class BiomeIds{ | ||
private function __construct(){ | ||
//NOOP | ||
} | ||
|
||
|
||
CLASSHEADER | ||
); | ||
$list = $map; | ||
asort($list, SORT_NUMERIC); | ||
$lastId = -1; | ||
foreach(Utils::stringifyKeys($list) as $name => $id){ | ||
if($name === ""){ | ||
continue; | ||
} | ||
if($id !== $lastId + 1){ | ||
fwrite($file, "\n"); | ||
} | ||
$lastId = $id; | ||
fwrite($file, "\tpublic const " . make_const_name($name) . ' = ' . $id . ';' . "\n"); | ||
} | ||
fwrite($file, "}\n"); | ||
fclose($file); | ||
} | ||
|
||
$ids = json_decode(Filesystem::fileGetContents(BedrockDataFiles::BIOME_ID_MAP_JSON), true); | ||
if(!is_array($ids)){ | ||
throw new \RuntimeException("Invalid biome ID map, expected array for root JSON object"); | ||
} | ||
$cleanedIds = []; | ||
foreach($ids as $name => $id){ | ||
if(!is_string($name) || !is_int($id)){ | ||
throw new \RuntimeException("Invalid biome ID map, expected string => int map"); | ||
} | ||
$cleanedIds[$name] = $id; | ||
} | ||
generate($cleanedIds, dirname(__DIR__) . '/src/data/bedrock/BiomeIds.php'); | ||
|
||
echo "Done. Don't forget to run CS fixup after generating code.\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# 5.12.0 | ||
Released 28th February 2024 | ||
|
||
**For Minecraft: Bedrock Edition 1.20.60** | ||
|
||
This is a minor feature release, with a few new features and improvements. | ||
|
||
**Plugin compatibility:** Plugins for previous 5.x versions will run unchanged on this release, unless they use internal APIs, reflection, or packages like the `pocketmine\network\mcpe` or `pocketmine\data` namespace. | ||
Do not update plugin minimum API versions unless you need new features added in this release. | ||
|
||
**WARNING: If your plugin uses the `pocketmine\network\mcpe` namespace, you're not shielded by API change constraints.** | ||
Consider using the `mcpe-protocol` directive in `plugin.yml` as a constraint if you're using packets directly. | ||
|
||
## General | ||
- Added a `--version` command-line option to display the server version and exit. | ||
|
||
## Tools | ||
- Added `tools/generate-biome-ids.php` to generate `pocketmine\data\bedrock\BiomeIds`. | ||
- Fixed ordering of property values generated by `tools/generate-block-palette-spec.php`. | ||
|
||
## API | ||
### `pocketmine\block` | ||
- The following new classes have been added: | ||
- `utils\LightableTrait` - used by blocks with `getLit()` and `setLit()` methods | ||
- The following methods have been deprecated: | ||
- `Block->isSolid()` - this method returns confusing results which don't match expectations and no one really knows what it actually means | ||
- `CocoaBlock` now extends `Flowable` to match vanilla Minecraft behaviour. | ||
|
||
### `pocketmine\plugin` | ||
- `PluginManager->registerEvent()` now throws an exception when given a generator function for the event handler. | ||
- `PluginManager->registerEvents()` now throws an exception if any of the detected event handlers are generator functions. Use `@notHandler` to have the function ignored if intended. | ||
|
||
### `pocketmine\promise` | ||
- The following methods have been added: | ||
- `public static Promise::all(list<Promise> $promises) : Promise` - returns a promise that is resolved once all given promises are resolved, or is rejected if any of the promises are rejected. | ||
|
||
### `pocketmine\scheduler` | ||
- The following methods have been deprecated: | ||
- `AsyncWorker->getFromThreadStore()` - use class static properties for thread-local storage | ||
- `AsyncWorker->removeFromThreadStore()` | ||
- `AsyncWorker->saveToThreadStore()` | ||
|
||
## Documentation | ||
- Improved documentation of various methods in `Block`. | ||
|
||
## Gameplay | ||
- The following new items have been added: | ||
- Name Tag | ||
|
||
## Internals | ||
- Removed specialization of shutdown logic for `Thread` vs `Worker` (no specialization is required). | ||
- Authentication system no longer accepts logins signed with the old Mojang root public key. | ||
- ID to enum mappings in `pocketmine\data` now use a new `match` convention to allow static analysis to ensure that all enum cases are handled. | ||
- Updated version of `pocketmine/bedrock-protocol` allows avoiding decoding of some itemstack data from the client in most cases, improving performance. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.