mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-21 02:44:03 +00:00
Merge branch 'minor-next' into major-next
This commit is contained in:
commit
644693ffee
4
.github/dependabot.yml
vendored
4
.github/dependabot.yml
vendored
@ -3,7 +3,7 @@ updates:
|
|||||||
- package-ecosystem: composer
|
- package-ecosystem: composer
|
||||||
directory: "/"
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: daily
|
interval: weekly
|
||||||
time: "10:00"
|
time: "10:00"
|
||||||
open-pull-requests-limit: 10
|
open-pull-requests-limit: 10
|
||||||
ignore:
|
ignore:
|
||||||
@ -21,4 +21,4 @@ updates:
|
|||||||
- package-ecosystem: github-actions
|
- package-ecosystem: github-actions
|
||||||
directory: "/"
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: daily
|
interval: weekly
|
||||||
|
4
.github/workflows/discord-release-notify.yml
vendored
4
.github/workflows/discord-release-notify.yml
vendored
@ -13,12 +13,12 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup PHP and tools
|
- name: Setup PHP and tools
|
||||||
uses: shivammathur/setup-php@2.28.0
|
uses: shivammathur/setup-php@2.29.0
|
||||||
with:
|
with:
|
||||||
php-version: 8.2
|
php-version: 8.2
|
||||||
|
|
||||||
- name: Restore Composer package cache
|
- name: Restore Composer package cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/.cache/composer/files
|
~/.cache/composer/files
|
||||||
|
4
.github/workflows/draft-release.yml
vendored
4
.github/workflows/draft-release.yml
vendored
@ -20,12 +20,12 @@ jobs:
|
|||||||
submodules: true
|
submodules: true
|
||||||
|
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@2.28.0
|
uses: shivammathur/setup-php@2.29.0
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-version }}
|
php-version: ${{ matrix.php-version }}
|
||||||
|
|
||||||
- name: Restore Composer package cache
|
- name: Restore Composer package cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/.cache/composer/files
|
~/.cache/composer/files
|
||||||
|
165
.github/workflows/main-php-matrix.yml
vendored
Normal file
165
.github/workflows/main-php-matrix.yml
vendored
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
name: CI (all supported PHP versions)
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
php:
|
||||||
|
description: 'PHP version in X.Y format'
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
|
#these are parameterized to ease updating
|
||||||
|
pm-version-major:
|
||||||
|
description: 'PocketMine-MP major version'
|
||||||
|
default: 5
|
||||||
|
type: number
|
||||||
|
image:
|
||||||
|
description: 'Runner image to use'
|
||||||
|
default: 'ubuntu-20.04'
|
||||||
|
type: string
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
phpstan:
|
||||||
|
name: PHPStan analysis
|
||||||
|
runs-on: ${{ inputs.image }}
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: pmmp/setup-php-action@2.0.0
|
||||||
|
with:
|
||||||
|
php-version: ${{ inputs.php }}
|
||||||
|
install-path: "./bin"
|
||||||
|
pm-version-major: ${{ inputs.pm-version-major }}
|
||||||
|
|
||||||
|
- name: Restore Composer package cache
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cache/composer/files
|
||||||
|
~/.cache/composer/vcs
|
||||||
|
key: "composer-v2-cache-${{ inputs.php }}-${{ hashFiles('./composer.lock') }}"
|
||||||
|
restore-keys: |
|
||||||
|
composer-v2-cache-
|
||||||
|
|
||||||
|
- name: Install Composer dependencies
|
||||||
|
run: composer install --prefer-dist --no-interaction
|
||||||
|
|
||||||
|
- name: Run PHPStan
|
||||||
|
run: ./vendor/bin/phpstan analyze --no-progress --memory-limit=2G
|
||||||
|
|
||||||
|
phpunit:
|
||||||
|
name: PHPUnit tests
|
||||||
|
runs-on: ${{ inputs.image }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: pmmp/setup-php-action@2.0.0
|
||||||
|
with:
|
||||||
|
php-version: ${{ inputs.php }}
|
||||||
|
install-path: "./bin"
|
||||||
|
pm-version-major: ${{ inputs.pm-version-major }}
|
||||||
|
|
||||||
|
- name: Restore Composer package cache
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cache/composer/files
|
||||||
|
~/.cache/composer/vcs
|
||||||
|
key: "composer-v2-cache-${{ inputs.php }}-${{ hashFiles('./composer.lock') }}"
|
||||||
|
restore-keys: |
|
||||||
|
composer-v2-cache-
|
||||||
|
|
||||||
|
- name: Install Composer dependencies
|
||||||
|
run: composer install --prefer-dist --no-interaction
|
||||||
|
|
||||||
|
- name: Run PHPUnit tests
|
||||||
|
run: ./vendor/bin/phpunit --bootstrap vendor/autoload.php --fail-on-warning tests/phpunit
|
||||||
|
|
||||||
|
integration:
|
||||||
|
name: Integration tests
|
||||||
|
runs-on: ${{ inputs.image }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: true
|
||||||
|
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: pmmp/setup-php-action@2.0.0
|
||||||
|
with:
|
||||||
|
php-version: ${{ inputs.php }}
|
||||||
|
install-path: "./bin"
|
||||||
|
pm-version-major: ${{ inputs.pm-version-major }}
|
||||||
|
|
||||||
|
- name: Restore Composer package cache
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cache/composer/files
|
||||||
|
~/.cache/composer/vcs
|
||||||
|
key: "composer-v2-cache-${{ inputs.php }}-${{ hashFiles('./composer.lock') }}"
|
||||||
|
restore-keys: |
|
||||||
|
composer-v2-cache-
|
||||||
|
|
||||||
|
- name: Install Composer dependencies
|
||||||
|
run: composer install --no-dev --prefer-dist --no-interaction
|
||||||
|
|
||||||
|
- name: Run integration tests
|
||||||
|
run: ./tests/travis.sh -t4
|
||||||
|
|
||||||
|
codegen:
|
||||||
|
name: Generated Code consistency checks
|
||||||
|
runs-on: ${{ inputs.image }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: pmmp/setup-php-action@2.0.0
|
||||||
|
with:
|
||||||
|
php-version: ${{ inputs.php }}
|
||||||
|
install-path: "./bin"
|
||||||
|
pm-version-major: ${{ inputs.pm-version-major }}
|
||||||
|
|
||||||
|
- name: Restore Composer package cache
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cache/composer/files
|
||||||
|
~/.cache/composer/vcs
|
||||||
|
key: "composer-v2-cache-${{ inputs.php }}-${{ hashFiles('./composer.lock') }}"
|
||||||
|
restore-keys: |
|
||||||
|
composer-v2-cache-
|
||||||
|
|
||||||
|
- name: Install Composer dependencies
|
||||||
|
run: composer install --no-dev --prefer-dist --no-interaction
|
||||||
|
|
||||||
|
- name: Regenerate registry annotations
|
||||||
|
run: php build/generate-registry-annotations.php src
|
||||||
|
|
||||||
|
- name: Regenerate KnownTranslation APIs
|
||||||
|
run: php build/generate-known-translation-apis.php
|
||||||
|
|
||||||
|
- name: Regenerate BedrockData available files constants
|
||||||
|
run: php build/generate-bedrockdata-path-consts.php
|
||||||
|
|
||||||
|
- name: Regenerate YmlServerProperties constants
|
||||||
|
run: php build/generate-pocketmine-yml-property-consts.php
|
||||||
|
|
||||||
|
- name: Verify code is unchanged
|
||||||
|
run: |
|
||||||
|
git diff
|
||||||
|
git diff --quiet
|
161
.github/workflows/main.yml
vendored
161
.github/workflows/main.yml
vendored
@ -6,162 +6,17 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
phpstan:
|
all-php-versions:
|
||||||
name: PHPStan analysis
|
name: PHP ${{ matrix.php }}
|
||||||
runs-on: ${{ matrix.image }}
|
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
image: [ubuntu-20.04]
|
|
||||||
php: ["8.1", "8.2", "8.3"]
|
php: ["8.1", "8.2", "8.3"]
|
||||||
|
|
||||||
steps:
|
uses: ./.github/workflows/main-php-matrix.yml
|
||||||
- uses: actions/checkout@v4
|
with:
|
||||||
|
php: ${{ matrix.php }}
|
||||||
- name: Setup PHP
|
secrets: inherit
|
||||||
uses: pmmp/setup-php-action@2.0.0
|
|
||||||
with:
|
|
||||||
php-version: ${{ matrix.php }}
|
|
||||||
install-path: "./bin"
|
|
||||||
pm-version-major: "5"
|
|
||||||
|
|
||||||
- name: Restore Composer package cache
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
~/.cache/composer/files
|
|
||||||
~/.cache/composer/vcs
|
|
||||||
key: "composer-v2-cache-${{ matrix.php }}-${{ hashFiles('./composer.lock') }}"
|
|
||||||
restore-keys: |
|
|
||||||
composer-v2-cache-
|
|
||||||
|
|
||||||
- name: Install Composer dependencies
|
|
||||||
run: composer install --prefer-dist --no-interaction
|
|
||||||
|
|
||||||
- name: Run PHPStan
|
|
||||||
run: ./vendor/bin/phpstan analyze --no-progress --memory-limit=2G
|
|
||||||
|
|
||||||
phpunit:
|
|
||||||
name: PHPUnit tests
|
|
||||||
runs-on: ${{ matrix.image }}
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
image: [ubuntu-20.04]
|
|
||||||
php: ["8.1", "8.2", "8.3"]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup PHP
|
|
||||||
uses: pmmp/setup-php-action@2.0.0
|
|
||||||
with:
|
|
||||||
php-version: ${{ matrix.php }}
|
|
||||||
install-path: "./bin"
|
|
||||||
pm-version-major: "5"
|
|
||||||
|
|
||||||
- name: Restore Composer package cache
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
~/.cache/composer/files
|
|
||||||
~/.cache/composer/vcs
|
|
||||||
key: "composer-v2-cache-${{ matrix.php }}-${{ hashFiles('./composer.lock') }}"
|
|
||||||
restore-keys: |
|
|
||||||
composer-v2-cache-
|
|
||||||
|
|
||||||
- name: Install Composer dependencies
|
|
||||||
run: composer install --prefer-dist --no-interaction
|
|
||||||
|
|
||||||
- name: Run PHPUnit tests
|
|
||||||
run: ./vendor/bin/phpunit --bootstrap vendor/autoload.php --fail-on-warning tests/phpunit
|
|
||||||
|
|
||||||
integration:
|
|
||||||
name: Integration tests
|
|
||||||
runs-on: ${{ matrix.image }}
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
image: [ubuntu-20.04]
|
|
||||||
php: ["8.1", "8.2", "8.3"]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
submodules: true
|
|
||||||
|
|
||||||
- name: Setup PHP
|
|
||||||
uses: pmmp/setup-php-action@2.0.0
|
|
||||||
with:
|
|
||||||
php-version: ${{ matrix.php }}
|
|
||||||
install-path: "./bin"
|
|
||||||
pm-version-major: "5"
|
|
||||||
|
|
||||||
- name: Restore Composer package cache
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
~/.cache/composer/files
|
|
||||||
~/.cache/composer/vcs
|
|
||||||
key: "composer-v2-cache-${{ matrix.php }}-${{ hashFiles('./composer.lock') }}"
|
|
||||||
restore-keys: |
|
|
||||||
composer-v2-cache-
|
|
||||||
|
|
||||||
- name: Install Composer dependencies
|
|
||||||
run: composer install --no-dev --prefer-dist --no-interaction
|
|
||||||
|
|
||||||
- name: Run integration tests
|
|
||||||
run: ./tests/travis.sh -t4
|
|
||||||
|
|
||||||
codegen:
|
|
||||||
name: Generated Code consistency checks
|
|
||||||
runs-on: ${{ matrix.image }}
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
image: [ubuntu-20.04]
|
|
||||||
php: ["8.1", "8.2", "8.3"]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup PHP
|
|
||||||
uses: pmmp/setup-php-action@2.0.0
|
|
||||||
with:
|
|
||||||
php-version: ${{ matrix.php }}
|
|
||||||
install-path: "./bin"
|
|
||||||
pm-version-major: "5"
|
|
||||||
|
|
||||||
- name: Restore Composer package cache
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
~/.cache/composer/files
|
|
||||||
~/.cache/composer/vcs
|
|
||||||
key: "composer-v2-cache-${{ matrix.php }}-${{ hashFiles('./composer.lock') }}"
|
|
||||||
restore-keys: |
|
|
||||||
composer-v2-cache-
|
|
||||||
|
|
||||||
- name: Install Composer dependencies
|
|
||||||
run: composer install --no-dev --prefer-dist --no-interaction
|
|
||||||
|
|
||||||
- name: Regenerate registry annotations
|
|
||||||
run: php build/generate-registry-annotations.php src
|
|
||||||
|
|
||||||
- name: Regenerate KnownTranslation APIs
|
|
||||||
run: php build/generate-known-translation-apis.php
|
|
||||||
|
|
||||||
- name: Regenerate BedrockData available files constants
|
|
||||||
run: php build/generate-bedrockdata-path-consts.php
|
|
||||||
|
|
||||||
- name: Regenerate YmlServerProperties constants
|
|
||||||
run: php build/generate-pocketmine-yml-property-consts.php
|
|
||||||
|
|
||||||
- name: Verify code is unchanged
|
|
||||||
run: |
|
|
||||||
git diff
|
|
||||||
git diff --quiet
|
|
||||||
|
|
||||||
codestyle:
|
codestyle:
|
||||||
name: Code Style checks
|
name: Code Style checks
|
||||||
@ -173,10 +28,10 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup PHP and tools
|
- name: Setup PHP and tools
|
||||||
uses: shivammathur/setup-php@2.28.0
|
uses: shivammathur/setup-php@2.29.0
|
||||||
with:
|
with:
|
||||||
php-version: 8.2
|
php-version: 8.2
|
||||||
tools: php-cs-fixer:3.38
|
tools: php-cs-fixer:3.49
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
@ -21,6 +21,9 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use pocketmine\network\mcpe\protocol\ProtocolInfo;
|
||||||
|
use pocketmine\VersionInfo;
|
||||||
|
|
||||||
require dirname(__DIR__) . '/vendor/autoload.php';
|
require dirname(__DIR__) . '/vendor/autoload.php';
|
||||||
|
|
||||||
if(count($argv) !== 7){
|
if(count($argv) !== 7){
|
||||||
@ -30,12 +33,12 @@ if(count($argv) !== 7){
|
|||||||
|
|
||||||
echo json_encode([
|
echo json_encode([
|
||||||
"php_version" => sprintf("%d.%d", PHP_MAJOR_VERSION, PHP_MINOR_VERSION), //deprecated
|
"php_version" => sprintf("%d.%d", PHP_MAJOR_VERSION, PHP_MINOR_VERSION), //deprecated
|
||||||
"base_version" => \pocketmine\VersionInfo::BASE_VERSION,
|
"base_version" => VersionInfo::BASE_VERSION,
|
||||||
"build" => (int) $argv[4],
|
"build" => (int) $argv[4],
|
||||||
"is_dev" => \pocketmine\VersionInfo::IS_DEVELOPMENT_BUILD,
|
"is_dev" => VersionInfo::IS_DEVELOPMENT_BUILD,
|
||||||
"channel" => \pocketmine\VersionInfo::BUILD_CHANNEL,
|
"channel" => VersionInfo::BUILD_CHANNEL,
|
||||||
"git_commit" => $argv[1],
|
"git_commit" => $argv[1],
|
||||||
"mcpe_version" => \pocketmine\network\mcpe\protocol\ProtocolInfo::MINECRAFT_VERSION_NETWORK,
|
"mcpe_version" => ProtocolInfo::MINECRAFT_VERSION_NETWORK,
|
||||||
"date" => time(), //TODO: maybe we should embed this in VersionInfo?
|
"date" => time(), //TODO: maybe we should embed this in VersionInfo?
|
||||||
"details_url" => "https://github.com/$argv[3]/releases/tag/$argv[2]",
|
"details_url" => "https://github.com/$argv[3]/releases/tag/$argv[2]",
|
||||||
"download_url" => "https://github.com/$argv[3]/releases/download/$argv[2]/PocketMine-MP.phar",
|
"download_url" => "https://github.com/$argv[3]/releases/download/$argv[2]/PocketMine-MP.phar",
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 73e5950eb90033a8de589044b92aa5e95de9c494
|
Subproject commit 6f619bf7a0b00e72a7c90915eec6e5a28866aa55
|
@ -32,6 +32,7 @@ use function getcwd;
|
|||||||
use function getopt;
|
use function getopt;
|
||||||
use function implode;
|
use function implode;
|
||||||
use function ini_get;
|
use function ini_get;
|
||||||
|
use function is_string;
|
||||||
use function microtime;
|
use function microtime;
|
||||||
use function preg_quote;
|
use function preg_quote;
|
||||||
use function realpath;
|
use function realpath;
|
||||||
@ -147,8 +148,17 @@ function main() : void{
|
|||||||
}else{
|
}else{
|
||||||
$build = 0;
|
$build = 0;
|
||||||
}
|
}
|
||||||
|
if(isset($opts["out"])){
|
||||||
|
if(!is_string($opts["out"])){
|
||||||
|
echo "--out cannot be specified multiple times" . PHP_EOL;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
$pharPath = $opts["out"];
|
||||||
|
}else{
|
||||||
|
$pharPath = getcwd() . DIRECTORY_SEPARATOR . "PocketMine-MP.phar";
|
||||||
|
}
|
||||||
foreach(buildPhar(
|
foreach(buildPhar(
|
||||||
$opts["out"] ?? getcwd() . DIRECTORY_SEPARATOR . "PocketMine-MP.phar",
|
$pharPath,
|
||||||
dirname(__DIR__) . DIRECTORY_SEPARATOR,
|
dirname(__DIR__) . DIRECTORY_SEPARATOR,
|
||||||
[
|
[
|
||||||
'resources',
|
'resources',
|
||||||
|
26
changelogs/5.11.md
Normal file
26
changelogs/5.11.md
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# 5.11.0
|
||||||
|
Released 7th February 2024.
|
||||||
|
|
||||||
|
**For Minecraft: Bedrock Edition 1.20.60**
|
||||||
|
|
||||||
|
This is a support release for Minecraft: Bedrock Edition 1.20.60.
|
||||||
|
|
||||||
|
**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 support for Minecraft: Bedrock Edition 1.20.60.
|
||||||
|
- Removed support for earlier versions.
|
||||||
|
|
||||||
|
## Fixes
|
||||||
|
- Fixed `tools/generate-item-upgrade-schema.php` not correctly handling items whose IDs were changed multiple times.
|
||||||
|
- Fixed `ServerKiller` not working correctly in some cases (incorrectly handled wake-up conditions).
|
||||||
|
- `ItemBlock`s of `Air` blocks are now always considered as "null" items regardless of count, and don't occupy inventory slots.
|
||||||
|
|
||||||
|
## Internals
|
||||||
|
- Restructured GitHub Actions CI workflows to make them easier to maintain (no need to update PHP versions in multiple places anymore).
|
||||||
|
- GitHub Actions CodeStyle workflow now uses php-cs-fixer 3.49.x.
|
||||||
|
- Dependabot updates are now processed weekly instead of daily.
|
@ -33,10 +33,10 @@
|
|||||||
"composer-runtime-api": "^2.0",
|
"composer-runtime-api": "^2.0",
|
||||||
"adhocore/json-comment": "~1.2.0",
|
"adhocore/json-comment": "~1.2.0",
|
||||||
"pocketmine/netresearch-jsonmapper": "~v4.2.1000",
|
"pocketmine/netresearch-jsonmapper": "~v4.2.1000",
|
||||||
"pocketmine/bedrock-block-upgrade-schema": "~3.4.0+bedrock-1.20.50",
|
"pocketmine/bedrock-block-upgrade-schema": "~3.5.0+bedrock-1.20.60",
|
||||||
"pocketmine/bedrock-data": "~2.7.0+bedrock-1.20.50",
|
"pocketmine/bedrock-data": "~2.8.0+bedrock-1.20.60",
|
||||||
"pocketmine/bedrock-item-upgrade-schema": "~1.6.0+bedrock-1.20.50",
|
"pocketmine/bedrock-item-upgrade-schema": "~1.7.0+bedrock-1.20.60",
|
||||||
"pocketmine/bedrock-protocol": "~26.0.0+bedrock-1.20.50",
|
"pocketmine/bedrock-protocol": "~27.0.0+bedrock-1.20.60",
|
||||||
"pocketmine/binaryutils": "^0.2.1",
|
"pocketmine/binaryutils": "^0.2.1",
|
||||||
"pocketmine/callback-validator": "^1.0.2",
|
"pocketmine/callback-validator": "^1.0.2",
|
||||||
"pocketmine/color": "^0.3.0",
|
"pocketmine/color": "^0.3.0",
|
||||||
@ -52,7 +52,7 @@
|
|||||||
"symfony/filesystem": "~6.4.0"
|
"symfony/filesystem": "~6.4.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpstan/phpstan": "1.10.50",
|
"phpstan/phpstan": "1.10.57",
|
||||||
"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": "~10.3.0 || ~10.2.0 || ~10.1.0"
|
"phpunit/phpunit": "~10.3.0 || ~10.2.0 || ~10.1.0"
|
||||||
|
138
composer.lock
generated
138
composer.lock
generated
@ -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": "894648a63ed7cd84303937208d1684af",
|
"content-hash": "d923f5fd75f0d33eb5198268a74a58b4",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "adhocore/json-comment",
|
"name": "adhocore/json-comment",
|
||||||
@ -122,16 +122,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "pocketmine/bedrock-block-upgrade-schema",
|
"name": "pocketmine/bedrock-block-upgrade-schema",
|
||||||
"version": "3.4.0",
|
"version": "3.5.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/pmmp/BedrockBlockUpgradeSchema.git",
|
"url": "https://github.com/pmmp/BedrockBlockUpgradeSchema.git",
|
||||||
"reference": "9872eb37f15080b19c2b7861085e549c48dda92d"
|
"reference": "1ed4ba738333c4b4afe4fef8e9326a45c89f12e3"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/pmmp/BedrockBlockUpgradeSchema/zipball/9872eb37f15080b19c2b7861085e549c48dda92d",
|
"url": "https://api.github.com/repos/pmmp/BedrockBlockUpgradeSchema/zipball/1ed4ba738333c4b4afe4fef8e9326a45c89f12e3",
|
||||||
"reference": "9872eb37f15080b19c2b7861085e549c48dda92d",
|
"reference": "1ed4ba738333c4b4afe4fef8e9326a45c89f12e3",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"type": "library",
|
"type": "library",
|
||||||
@ -142,22 +142,22 @@
|
|||||||
"description": "Schemas describing how to upgrade saved block data in older Minecraft: Bedrock Edition world saves",
|
"description": "Schemas describing how to upgrade saved block data in older Minecraft: Bedrock Edition world saves",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/pmmp/BedrockBlockUpgradeSchema/issues",
|
"issues": "https://github.com/pmmp/BedrockBlockUpgradeSchema/issues",
|
||||||
"source": "https://github.com/pmmp/BedrockBlockUpgradeSchema/tree/3.4.0"
|
"source": "https://github.com/pmmp/BedrockBlockUpgradeSchema/tree/3.5.0"
|
||||||
},
|
},
|
||||||
"time": "2023-11-08T15:22:06+00:00"
|
"time": "2024-02-07T11:46:50+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "pocketmine/bedrock-data",
|
"name": "pocketmine/bedrock-data",
|
||||||
"version": "2.7.0+bedrock-1.20.50",
|
"version": "2.8.0+bedrock-1.20.60",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/pmmp/BedrockData.git",
|
"url": "https://github.com/pmmp/BedrockData.git",
|
||||||
"reference": "36f975dfca7520b7d36b0b39429f274464c9bc13"
|
"reference": "d8ea0355b7c835564af9fe6e273e650ac62c84a2"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/pmmp/BedrockData/zipball/36f975dfca7520b7d36b0b39429f274464c9bc13",
|
"url": "https://api.github.com/repos/pmmp/BedrockData/zipball/d8ea0355b7c835564af9fe6e273e650ac62c84a2",
|
||||||
"reference": "36f975dfca7520b7d36b0b39429f274464c9bc13",
|
"reference": "d8ea0355b7c835564af9fe6e273e650ac62c84a2",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"type": "library",
|
"type": "library",
|
||||||
@ -168,22 +168,22 @@
|
|||||||
"description": "Blobs of data generated from Minecraft: Bedrock Edition, used by PocketMine-MP",
|
"description": "Blobs of data generated from Minecraft: Bedrock Edition, used by PocketMine-MP",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/pmmp/BedrockData/issues",
|
"issues": "https://github.com/pmmp/BedrockData/issues",
|
||||||
"source": "https://github.com/pmmp/BedrockData/tree/bedrock-1.20.50"
|
"source": "https://github.com/pmmp/BedrockData/tree/bedrock-1.20.60"
|
||||||
},
|
},
|
||||||
"time": "2023-12-06T13:59:08+00:00"
|
"time": "2024-02-07T11:23:46+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "pocketmine/bedrock-item-upgrade-schema",
|
"name": "pocketmine/bedrock-item-upgrade-schema",
|
||||||
"version": "1.6.0",
|
"version": "1.7.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/pmmp/BedrockItemUpgradeSchema.git",
|
"url": "https://github.com/pmmp/BedrockItemUpgradeSchema.git",
|
||||||
"reference": "d374e5fd8302977675dcd2a42733abd3ee476ca1"
|
"reference": "69772dd58e2b2c7b7513fa2bcdc46e782228641c"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/pmmp/BedrockItemUpgradeSchema/zipball/d374e5fd8302977675dcd2a42733abd3ee476ca1",
|
"url": "https://api.github.com/repos/pmmp/BedrockItemUpgradeSchema/zipball/69772dd58e2b2c7b7513fa2bcdc46e782228641c",
|
||||||
"reference": "d374e5fd8302977675dcd2a42733abd3ee476ca1",
|
"reference": "69772dd58e2b2c7b7513fa2bcdc46e782228641c",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"type": "library",
|
"type": "library",
|
||||||
@ -194,22 +194,22 @@
|
|||||||
"description": "JSON schemas for upgrading items found in older Minecraft: Bedrock world saves",
|
"description": "JSON schemas for upgrading items found in older Minecraft: Bedrock world saves",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/pmmp/BedrockItemUpgradeSchema/issues",
|
"issues": "https://github.com/pmmp/BedrockItemUpgradeSchema/issues",
|
||||||
"source": "https://github.com/pmmp/BedrockItemUpgradeSchema/tree/1.6.0"
|
"source": "https://github.com/pmmp/BedrockItemUpgradeSchema/tree/1.7.0"
|
||||||
},
|
},
|
||||||
"time": "2023-11-08T18:12:14+00:00"
|
"time": "2024-02-07T11:58:05+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "pocketmine/bedrock-protocol",
|
"name": "pocketmine/bedrock-protocol",
|
||||||
"version": "26.0.0+bedrock-1.20.50",
|
"version": "27.0.1+bedrock-1.20.60",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/pmmp/BedrockProtocol.git",
|
"url": "https://github.com/pmmp/BedrockProtocol.git",
|
||||||
"reference": "f278a0b6d4fa1e2e0408a125f323a3118b1968df"
|
"reference": "0cebb55f6e904f722b14d420f6b2c84c7fa69f10"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/pmmp/BedrockProtocol/zipball/f278a0b6d4fa1e2e0408a125f323a3118b1968df",
|
"url": "https://api.github.com/repos/pmmp/BedrockProtocol/zipball/0cebb55f6e904f722b14d420f6b2c84c7fa69f10",
|
||||||
"reference": "f278a0b6d4fa1e2e0408a125f323a3118b1968df",
|
"reference": "0cebb55f6e904f722b14d420f6b2c84c7fa69f10",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -241,9 +241,9 @@
|
|||||||
"description": "An implementation of the Minecraft: Bedrock Edition protocol in PHP",
|
"description": "An implementation of the Minecraft: Bedrock Edition protocol in PHP",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/pmmp/BedrockProtocol/issues",
|
"issues": "https://github.com/pmmp/BedrockProtocol/issues",
|
||||||
"source": "https://github.com/pmmp/BedrockProtocol/tree/26.0.0+bedrock-1.20.50"
|
"source": "https://github.com/pmmp/BedrockProtocol/tree/27.0.1+bedrock-1.20.60"
|
||||||
},
|
},
|
||||||
"time": "2023-12-06T14:08:37+00:00"
|
"time": "2024-02-07T11:53:50+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "pocketmine/binaryutils",
|
"name": "pocketmine/binaryutils",
|
||||||
@ -1211,25 +1211,27 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "nikic/php-parser",
|
"name": "nikic/php-parser",
|
||||||
"version": "v4.18.0",
|
"version": "v5.0.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/nikic/PHP-Parser.git",
|
"url": "https://github.com/nikic/PHP-Parser.git",
|
||||||
"reference": "1bcbb2179f97633e98bbbc87044ee2611c7d7999"
|
"reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/1bcbb2179f97633e98bbbc87044ee2611c7d7999",
|
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4a21235f7e56e713259a6f76bf4b5ea08502b9dc",
|
||||||
"reference": "1bcbb2179f97633e98bbbc87044ee2611c7d7999",
|
"reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
"ext-ctype": "*",
|
||||||
|
"ext-json": "*",
|
||||||
"ext-tokenizer": "*",
|
"ext-tokenizer": "*",
|
||||||
"php": ">=7.0"
|
"php": ">=7.4"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"ircmaxell/php-yacc": "^0.0.7",
|
"ircmaxell/php-yacc": "^0.0.7",
|
||||||
"phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0"
|
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0"
|
||||||
},
|
},
|
||||||
"bin": [
|
"bin": [
|
||||||
"bin/php-parse"
|
"bin/php-parse"
|
||||||
@ -1237,7 +1239,7 @@
|
|||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "4.9-dev"
|
"dev-master": "5.0-dev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
@ -1261,9 +1263,9 @@
|
|||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/nikic/PHP-Parser/issues",
|
"issues": "https://github.com/nikic/PHP-Parser/issues",
|
||||||
"source": "https://github.com/nikic/PHP-Parser/tree/v4.18.0"
|
"source": "https://github.com/nikic/PHP-Parser/tree/v5.0.0"
|
||||||
},
|
},
|
||||||
"time": "2023-12-10T21:03:43+00:00"
|
"time": "2024-01-07T17:17:35+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phar-io/manifest",
|
"name": "phar-io/manifest",
|
||||||
@ -1378,16 +1380,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpstan/phpstan",
|
"name": "phpstan/phpstan",
|
||||||
"version": "1.10.50",
|
"version": "1.10.57",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/phpstan/phpstan.git",
|
"url": "https://github.com/phpstan/phpstan.git",
|
||||||
"reference": "06a98513ac72c03e8366b5a0cb00750b487032e4"
|
"reference": "1627b1d03446904aaa77593f370c5201d2ecc34e"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/06a98513ac72c03e8366b5a0cb00750b487032e4",
|
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/1627b1d03446904aaa77593f370c5201d2ecc34e",
|
||||||
"reference": "06a98513ac72c03e8366b5a0cb00750b487032e4",
|
"reference": "1627b1d03446904aaa77593f370c5201d2ecc34e",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -1436,7 +1438,7 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2023-12-13T10:59:42+00:00"
|
"time": "2024-01-24T11:51:34+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpstan/phpstan-phpunit",
|
"name": "phpstan/phpstan-phpunit",
|
||||||
@ -1541,23 +1543,23 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/php-code-coverage",
|
"name": "phpunit/php-code-coverage",
|
||||||
"version": "10.1.10",
|
"version": "10.1.11",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
|
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
|
||||||
"reference": "599109c8ca6bae97b23482d557d2874c25a65e59"
|
"reference": "78c3b7625965c2513ee96569a4dbb62601784145"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/599109c8ca6bae97b23482d557d2874c25a65e59",
|
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/78c3b7625965c2513ee96569a4dbb62601784145",
|
||||||
"reference": "599109c8ca6bae97b23482d557d2874c25a65e59",
|
"reference": "78c3b7625965c2513ee96569a4dbb62601784145",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"ext-dom": "*",
|
"ext-dom": "*",
|
||||||
"ext-libxml": "*",
|
"ext-libxml": "*",
|
||||||
"ext-xmlwriter": "*",
|
"ext-xmlwriter": "*",
|
||||||
"nikic/php-parser": "^4.15",
|
"nikic/php-parser": "^4.18 || ^5.0",
|
||||||
"php": ">=8.1",
|
"php": ">=8.1",
|
||||||
"phpunit/php-file-iterator": "^4.0",
|
"phpunit/php-file-iterator": "^4.0",
|
||||||
"phpunit/php-text-template": "^3.0",
|
"phpunit/php-text-template": "^3.0",
|
||||||
@ -1607,7 +1609,7 @@
|
|||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
|
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
|
||||||
"security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy",
|
"security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy",
|
||||||
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.10"
|
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.11"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@ -1615,7 +1617,7 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2023-12-11T06:28:43+00:00"
|
"time": "2023-12-21T15:38:30+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/php-file-iterator",
|
"name": "phpunit/php-file-iterator",
|
||||||
@ -2207,20 +2209,20 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "sebastian/complexity",
|
"name": "sebastian/complexity",
|
||||||
"version": "3.1.0",
|
"version": "3.2.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/complexity.git",
|
"url": "https://github.com/sebastianbergmann/complexity.git",
|
||||||
"reference": "68cfb347a44871f01e33ab0ef8215966432f6957"
|
"reference": "68ff824baeae169ec9f2137158ee529584553799"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/68cfb347a44871f01e33ab0ef8215966432f6957",
|
"url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/68ff824baeae169ec9f2137158ee529584553799",
|
||||||
"reference": "68cfb347a44871f01e33ab0ef8215966432f6957",
|
"reference": "68ff824baeae169ec9f2137158ee529584553799",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"nikic/php-parser": "^4.10",
|
"nikic/php-parser": "^4.18 || ^5.0",
|
||||||
"php": ">=8.1"
|
"php": ">=8.1"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
@ -2229,7 +2231,7 @@
|
|||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-main": "3.1-dev"
|
"dev-main": "3.2-dev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
@ -2253,7 +2255,7 @@
|
|||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/sebastianbergmann/complexity/issues",
|
"issues": "https://github.com/sebastianbergmann/complexity/issues",
|
||||||
"security": "https://github.com/sebastianbergmann/complexity/security/policy",
|
"security": "https://github.com/sebastianbergmann/complexity/security/policy",
|
||||||
"source": "https://github.com/sebastianbergmann/complexity/tree/3.1.0"
|
"source": "https://github.com/sebastianbergmann/complexity/tree/3.2.0"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@ -2261,20 +2263,20 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2023-09-28T11:50:59+00:00"
|
"time": "2023-12-21T08:37:17+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "sebastian/diff",
|
"name": "sebastian/diff",
|
||||||
"version": "5.0.3",
|
"version": "5.1.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/diff.git",
|
"url": "https://github.com/sebastianbergmann/diff.git",
|
||||||
"reference": "912dc2fbe3e3c1e7873313cc801b100b6c68c87b"
|
"reference": "fbf413a49e54f6b9b17e12d900ac7f6101591b7f"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/912dc2fbe3e3c1e7873313cc801b100b6c68c87b",
|
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/fbf413a49e54f6b9b17e12d900ac7f6101591b7f",
|
||||||
"reference": "912dc2fbe3e3c1e7873313cc801b100b6c68c87b",
|
"reference": "fbf413a49e54f6b9b17e12d900ac7f6101591b7f",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -2287,7 +2289,7 @@
|
|||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-main": "5.0-dev"
|
"dev-main": "5.1-dev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
@ -2320,7 +2322,7 @@
|
|||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/sebastianbergmann/diff/issues",
|
"issues": "https://github.com/sebastianbergmann/diff/issues",
|
||||||
"security": "https://github.com/sebastianbergmann/diff/security/policy",
|
"security": "https://github.com/sebastianbergmann/diff/security/policy",
|
||||||
"source": "https://github.com/sebastianbergmann/diff/tree/5.0.3"
|
"source": "https://github.com/sebastianbergmann/diff/tree/5.1.0"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@ -2328,7 +2330,7 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2023-05-01T07:48:21+00:00"
|
"time": "2023-12-22T10:55:06+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "sebastian/environment",
|
"name": "sebastian/environment",
|
||||||
@ -2536,20 +2538,20 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "sebastian/lines-of-code",
|
"name": "sebastian/lines-of-code",
|
||||||
"version": "2.0.1",
|
"version": "2.0.2",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/lines-of-code.git",
|
"url": "https://github.com/sebastianbergmann/lines-of-code.git",
|
||||||
"reference": "649e40d279e243d985aa8fb6e74dd5bb28dc185d"
|
"reference": "856e7f6a75a84e339195d48c556f23be2ebf75d0"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/649e40d279e243d985aa8fb6e74dd5bb28dc185d",
|
"url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/856e7f6a75a84e339195d48c556f23be2ebf75d0",
|
||||||
"reference": "649e40d279e243d985aa8fb6e74dd5bb28dc185d",
|
"reference": "856e7f6a75a84e339195d48c556f23be2ebf75d0",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"nikic/php-parser": "^4.10",
|
"nikic/php-parser": "^4.18 || ^5.0",
|
||||||
"php": ">=8.1"
|
"php": ">=8.1"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
@ -2582,7 +2584,7 @@
|
|||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/sebastianbergmann/lines-of-code/issues",
|
"issues": "https://github.com/sebastianbergmann/lines-of-code/issues",
|
||||||
"security": "https://github.com/sebastianbergmann/lines-of-code/security/policy",
|
"security": "https://github.com/sebastianbergmann/lines-of-code/security/policy",
|
||||||
"source": "https://github.com/sebastianbergmann/lines-of-code/tree/2.0.1"
|
"source": "https://github.com/sebastianbergmann/lines-of-code/tree/2.0.2"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@ -2590,7 +2592,7 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2023-08-31T09:25:50+00:00"
|
"time": "2023-12-21T08:38:20+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "sebastian/object-enumerator",
|
"name": "sebastian/object-enumerator",
|
||||||
|
@ -45,4 +45,6 @@ final class BootstrapOptions{
|
|||||||
public const PLUGINS = "plugins";
|
public const PLUGINS = "plugins";
|
||||||
/** Path to store and load server data */
|
/** Path to store and load server data */
|
||||||
public const DATA = "data";
|
public const DATA = "data";
|
||||||
|
/** Shows basic server version information and exits */
|
||||||
|
public const VERSION = "version";
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ namespace pocketmine {
|
|||||||
|
|
||||||
use Composer\InstalledVersions;
|
use Composer\InstalledVersions;
|
||||||
use pocketmine\errorhandler\ErrorToExceptionHandler;
|
use pocketmine\errorhandler\ErrorToExceptionHandler;
|
||||||
|
use pocketmine\network\mcpe\protocol\ProtocolInfo;
|
||||||
use pocketmine\thread\ThreadManager;
|
use pocketmine\thread\ThreadManager;
|
||||||
use pocketmine\thread\ThreadSafeClassLoader;
|
use pocketmine\thread\ThreadSafeClassLoader;
|
||||||
use pocketmine\utils\Filesystem;
|
use pocketmine\utils\Filesystem;
|
||||||
@ -40,14 +41,17 @@ namespace pocketmine {
|
|||||||
use function extension_loaded;
|
use function extension_loaded;
|
||||||
use function function_exists;
|
use function function_exists;
|
||||||
use function getcwd;
|
use function getcwd;
|
||||||
|
use function getopt;
|
||||||
use function is_dir;
|
use function is_dir;
|
||||||
use function mkdir;
|
use function mkdir;
|
||||||
use function phpversion;
|
use function phpversion;
|
||||||
use function preg_match;
|
use function preg_match;
|
||||||
use function preg_quote;
|
use function preg_quote;
|
||||||
|
use function printf;
|
||||||
use function realpath;
|
use function realpath;
|
||||||
use function version_compare;
|
use function version_compare;
|
||||||
use const DIRECTORY_SEPARATOR;
|
use const DIRECTORY_SEPARATOR;
|
||||||
|
use const PHP_EOL;
|
||||||
|
|
||||||
require_once __DIR__ . '/VersionInfo.php';
|
require_once __DIR__ . '/VersionInfo.php';
|
||||||
|
|
||||||
@ -166,7 +170,7 @@ namespace pocketmine {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function emit_performance_warnings(\Logger $logger){
|
function emit_performance_warnings(\Logger $logger){
|
||||||
if(PHP_DEBUG !== 0){
|
if(ZEND_DEBUG_BUILD){
|
||||||
$logger->warning("This PHP binary was compiled in debug mode. This has a major impact on performance.");
|
$logger->warning("This PHP binary was compiled in debug mode. This has a major impact on performance.");
|
||||||
}
|
}
|
||||||
if(extension_loaded("xdebug") && (!function_exists('xdebug_info') || count(xdebug_info('mode')) !== 0)){
|
if(extension_loaded("xdebug") && (!function_exists('xdebug_info') || count(xdebug_info('mode')) !== 0)){
|
||||||
@ -273,6 +277,11 @@ JIT_WARNING
|
|||||||
|
|
||||||
ErrorToExceptionHandler::set();
|
ErrorToExceptionHandler::set();
|
||||||
|
|
||||||
|
if(count(getopt("", [BootstrapOptions::VERSION])) > 0){
|
||||||
|
printf("%s %s (git hash %s) for Minecraft: Bedrock Edition %s\n", VersionInfo::NAME, VersionInfo::VERSION()->getFullVersion(true), VersionInfo::GIT_HASH(), ProtocolInfo::MINECRAFT_VERSION);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
$cwd = Utils::assumeNotFalse(realpath(Utils::assumeNotFalse(getcwd())));
|
$cwd = Utils::assumeNotFalse(realpath(Utils::assumeNotFalse(getcwd())));
|
||||||
$dataPath = getopt_string(BootstrapOptions::DATA) ?? $cwd;
|
$dataPath = getopt_string(BootstrapOptions::DATA) ?? $cwd;
|
||||||
$pluginPath = getopt_string(BootstrapOptions::PLUGINS) ?? $cwd . DIRECTORY_SEPARATOR . "plugins";
|
$pluginPath = getopt_string(BootstrapOptions::PLUGINS) ?? $cwd . DIRECTORY_SEPARATOR . "plugins";
|
||||||
|
@ -60,6 +60,7 @@ use pocketmine\network\mcpe\NetworkSession;
|
|||||||
use pocketmine\network\mcpe\PacketBroadcaster;
|
use pocketmine\network\mcpe\PacketBroadcaster;
|
||||||
use pocketmine\network\mcpe\protocol\ProtocolInfo;
|
use pocketmine\network\mcpe\protocol\ProtocolInfo;
|
||||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializerContext;
|
use pocketmine\network\mcpe\protocol\serializer\PacketSerializerContext;
|
||||||
|
use pocketmine\network\mcpe\protocol\types\CompressionAlgorithm;
|
||||||
use pocketmine\network\mcpe\raklib\RakLibInterface;
|
use pocketmine\network\mcpe\raklib\RakLibInterface;
|
||||||
use pocketmine\network\mcpe\StandardEntityEventBroadcaster;
|
use pocketmine\network\mcpe\StandardEntityEventBroadcaster;
|
||||||
use pocketmine\network\mcpe\StandardPacketBroadcaster;
|
use pocketmine\network\mcpe\StandardPacketBroadcaster;
|
||||||
@ -126,6 +127,7 @@ use Symfony\Component\Filesystem\Path;
|
|||||||
use function array_fill;
|
use function array_fill;
|
||||||
use function array_sum;
|
use function array_sum;
|
||||||
use function base64_encode;
|
use function base64_encode;
|
||||||
|
use function chr;
|
||||||
use function cli_set_process_title;
|
use function cli_set_process_title;
|
||||||
use function copy;
|
use function copy;
|
||||||
use function count;
|
use function count;
|
||||||
@ -738,7 +740,7 @@ class Server{
|
|||||||
* @return string[][]
|
* @return string[][]
|
||||||
*/
|
*/
|
||||||
public function getCommandAliases() : array{
|
public function getCommandAliases() : array{
|
||||||
$section = $this->configGroup->getProperty(YmlServerProperties::ALIASES);
|
$section = $this->configGroup->getProperty(Yml::ALIASES);
|
||||||
$result = [];
|
$result = [];
|
||||||
if(is_array($section)){
|
if(is_array($section)){
|
||||||
foreach($section as $key => $value){
|
foreach($section as $key => $value){
|
||||||
@ -862,7 +864,7 @@ class Server{
|
|||||||
$this->logger->emergency($this->language->translate(KnownTranslationFactory::pocketmine_server_devBuild_error1(VersionInfo::NAME)));
|
$this->logger->emergency($this->language->translate(KnownTranslationFactory::pocketmine_server_devBuild_error1(VersionInfo::NAME)));
|
||||||
$this->logger->emergency($this->language->translate(KnownTranslationFactory::pocketmine_server_devBuild_error2()));
|
$this->logger->emergency($this->language->translate(KnownTranslationFactory::pocketmine_server_devBuild_error2()));
|
||||||
$this->logger->emergency($this->language->translate(KnownTranslationFactory::pocketmine_server_devBuild_error3()));
|
$this->logger->emergency($this->language->translate(KnownTranslationFactory::pocketmine_server_devBuild_error3()));
|
||||||
$this->logger->emergency($this->language->translate(KnownTranslationFactory::pocketmine_server_devBuild_error4(YmlServerProperties::SETTINGS_ENABLE_DEV_BUILDS)));
|
$this->logger->emergency($this->language->translate(KnownTranslationFactory::pocketmine_server_devBuild_error4(Yml::SETTINGS_ENABLE_DEV_BUILDS)));
|
||||||
$this->logger->emergency($this->language->translate(KnownTranslationFactory::pocketmine_server_devBuild_error5("https://github.com/pmmp/PocketMine-MP/releases")));
|
$this->logger->emergency($this->language->translate(KnownTranslationFactory::pocketmine_server_devBuild_error5("https://github.com/pmmp/PocketMine-MP/releases")));
|
||||||
$this->forceShutdownExit();
|
$this->forceShutdownExit();
|
||||||
|
|
||||||
@ -1375,19 +1377,26 @@ class Server{
|
|||||||
try{
|
try{
|
||||||
$timings->startTiming();
|
$timings->startTiming();
|
||||||
|
|
||||||
if($sync === null){
|
$threshold = $compressor->getCompressionThreshold();
|
||||||
$threshold = $compressor->getCompressionThreshold();
|
if($threshold === null || strlen($buffer) < $compressor->getCompressionThreshold()){
|
||||||
$sync = !$this->networkCompressionAsync || $threshold === null || strlen($buffer) < $threshold;
|
$compressionType = CompressionAlgorithm::NONE;
|
||||||
|
$compressed = $buffer;
|
||||||
|
|
||||||
|
}else{
|
||||||
|
$sync ??= !$this->networkCompressionAsync;
|
||||||
|
|
||||||
|
if(!$sync && strlen($buffer) >= $this->networkCompressionAsyncThreshold){
|
||||||
|
$promise = new CompressBatchPromise();
|
||||||
|
$task = new CompressBatchTask($buffer, $promise, $compressor);
|
||||||
|
$this->asyncPool->submitTask($task);
|
||||||
|
return $promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
$compressionType = $compressor->getNetworkId();
|
||||||
|
$compressed = $compressor->compress($buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$sync && strlen($buffer) >= $this->networkCompressionAsyncThreshold){
|
return chr($compressionType) . $compressed;
|
||||||
$promise = new CompressBatchPromise();
|
|
||||||
$task = new CompressBatchTask($buffer, $promise, $compressor);
|
|
||||||
$this->asyncPool->submitTask($task);
|
|
||||||
return $promise;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $compressor->compress($buffer);
|
|
||||||
}finally{
|
}finally{
|
||||||
$timings->stopTiming();
|
$timings->stopTiming();
|
||||||
}
|
}
|
||||||
@ -1469,7 +1478,7 @@ class Server{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(isset($this->network)){
|
if(isset($this->network)){
|
||||||
$this->network->getSessionManager()->close($this->configGroup->getPropertyString(YmlServerProperties::SETTINGS_SHUTDOWN_MESSAGE, "Server closed"));
|
$this->network->getSessionManager()->close($this->configGroup->getPropertyString(Yml::SETTINGS_SHUTDOWN_MESSAGE, "Server closed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($this->worldManager)){
|
if(isset($this->worldManager)){
|
||||||
|
@ -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 = "5.10.1";
|
public const BASE_VERSION = "5.11.1";
|
||||||
public const IS_DEVELOPMENT_BUILD = true;
|
public const IS_DEVELOPMENT_BUILD = true;
|
||||||
public const BUILD_CHANNEL = "stable";
|
public const BUILD_CHANNEL = "stable";
|
||||||
|
|
||||||
|
@ -402,7 +402,7 @@ class Block{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AKA: Block->isPlaceable
|
* Returns whether this block can be placed when obtained as an item.
|
||||||
*/
|
*/
|
||||||
public function canBePlaced() : bool{
|
public function canBePlaced() : bool{
|
||||||
return true;
|
return true;
|
||||||
@ -572,16 +572,28 @@ class Block{
|
|||||||
return $this->getLightFilter() > 0;
|
return $this->getLightFilter() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether this block allows any light to pass through it.
|
||||||
|
*/
|
||||||
public function isTransparent() : bool{
|
public function isTransparent() : bool{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated TL;DR: Don't use this function. Its results are confusing and inconsistent.
|
||||||
|
*
|
||||||
|
* No one is sure what the meaning of this property actually is. It's borrowed from Minecraft Java Edition, and is
|
||||||
|
* used by various blocks for support checks.
|
||||||
|
*
|
||||||
|
* Things like signs and banners are considered "solid" despite having no collision box, and things like skulls and
|
||||||
|
* flower pots are considered non-solid despite obviously being "solid" in the conventional, real-world sense.
|
||||||
|
*/
|
||||||
public function isSolid() : bool{
|
public function isSolid() : bool{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AKA: Block->isFlowable
|
* Returns whether this block can be destroyed by liquid flowing into its cell.
|
||||||
*/
|
*/
|
||||||
public function canBeFlowedInto() : bool{
|
public function canBeFlowedInto() : bool{
|
||||||
return false;
|
return false;
|
||||||
|
@ -26,7 +26,6 @@ namespace pocketmine\block;
|
|||||||
use pocketmine\block\utils\AgeableTrait;
|
use pocketmine\block\utils\AgeableTrait;
|
||||||
use pocketmine\block\utils\BlockEventHelper;
|
use pocketmine\block\utils\BlockEventHelper;
|
||||||
use pocketmine\block\utils\HorizontalFacingTrait;
|
use pocketmine\block\utils\HorizontalFacingTrait;
|
||||||
use pocketmine\block\utils\SupportType;
|
|
||||||
use pocketmine\block\utils\WoodType;
|
use pocketmine\block\utils\WoodType;
|
||||||
use pocketmine\data\runtime\RuntimeDataDescriber;
|
use pocketmine\data\runtime\RuntimeDataDescriber;
|
||||||
use pocketmine\item\Fertilizer;
|
use pocketmine\item\Fertilizer;
|
||||||
@ -40,7 +39,7 @@ use pocketmine\player\Player;
|
|||||||
use pocketmine\world\BlockTransaction;
|
use pocketmine\world\BlockTransaction;
|
||||||
use function mt_rand;
|
use function mt_rand;
|
||||||
|
|
||||||
class CocoaBlock extends Transparent{
|
class CocoaBlock extends Flowable{
|
||||||
use HorizontalFacingTrait;
|
use HorizontalFacingTrait;
|
||||||
use AgeableTrait;
|
use AgeableTrait;
|
||||||
|
|
||||||
@ -65,10 +64,6 @@ class CocoaBlock extends Transparent{
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSupportType(int $facing) : SupportType{
|
|
||||||
return SupportType::NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function canAttachTo(Block $block) : bool{
|
private function canAttachTo(Block $block) : bool{
|
||||||
return $block instanceof Wood && $block->getWoodType() === WoodType::JUNGLE;
|
return $block instanceof Wood && $block->getWoodType() === WoodType::JUNGLE;
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ namespace pocketmine\block;
|
|||||||
|
|
||||||
use pocketmine\block\tile\Furnace as TileFurnace;
|
use pocketmine\block\tile\Furnace as TileFurnace;
|
||||||
use pocketmine\block\utils\FacesOppositePlacingPlayerTrait;
|
use pocketmine\block\utils\FacesOppositePlacingPlayerTrait;
|
||||||
|
use pocketmine\block\utils\LightableTrait;
|
||||||
use pocketmine\crafting\FurnaceType;
|
use pocketmine\crafting\FurnaceType;
|
||||||
use pocketmine\data\runtime\RuntimeDataDescriber;
|
use pocketmine\data\runtime\RuntimeDataDescriber;
|
||||||
use pocketmine\item\Item;
|
use pocketmine\item\Item;
|
||||||
@ -34,11 +35,10 @@ use function mt_rand;
|
|||||||
|
|
||||||
class Furnace extends Opaque{
|
class Furnace extends Opaque{
|
||||||
use FacesOppositePlacingPlayerTrait;
|
use FacesOppositePlacingPlayerTrait;
|
||||||
|
use LightableTrait;
|
||||||
|
|
||||||
protected FurnaceType $furnaceType;
|
protected FurnaceType $furnaceType;
|
||||||
|
|
||||||
protected bool $lit = false;
|
|
||||||
|
|
||||||
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo, FurnaceType $furnaceType){
|
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo, FurnaceType $furnaceType){
|
||||||
$this->furnaceType = $furnaceType;
|
$this->furnaceType = $furnaceType;
|
||||||
parent::__construct($idInfo, $name, $typeInfo);
|
parent::__construct($idInfo, $name, $typeInfo);
|
||||||
@ -57,18 +57,6 @@ class Furnace extends Opaque{
|
|||||||
return $this->lit ? 13 : 0;
|
return $this->lit ? 13 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isLit() : bool{
|
|
||||||
return $this->lit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return $this
|
|
||||||
*/
|
|
||||||
public function setLit(bool $lit = true) : self{
|
|
||||||
$this->lit = $lit;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null, array &$returnedItems = []) : bool{
|
public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null, array &$returnedItems = []) : bool{
|
||||||
if($player instanceof Player){
|
if($player instanceof Player){
|
||||||
$furnace = $this->position->getWorld()->getTile($this->position);
|
$furnace = $this->position->getWorld()->getTile($this->position);
|
||||||
|
@ -24,7 +24,7 @@ declare(strict_types=1);
|
|||||||
namespace pocketmine\block;
|
namespace pocketmine\block;
|
||||||
|
|
||||||
use pocketmine\block\utils\FortuneDropHelper;
|
use pocketmine\block\utils\FortuneDropHelper;
|
||||||
use pocketmine\data\runtime\RuntimeDataDescriber;
|
use pocketmine\block\utils\LightableTrait;
|
||||||
use pocketmine\item\Item;
|
use pocketmine\item\Item;
|
||||||
use pocketmine\item\VanillaItems;
|
use pocketmine\item\VanillaItems;
|
||||||
use pocketmine\math\Vector3;
|
use pocketmine\math\Vector3;
|
||||||
@ -32,23 +32,7 @@ use pocketmine\player\Player;
|
|||||||
use function mt_rand;
|
use function mt_rand;
|
||||||
|
|
||||||
class RedstoneOre extends Opaque{
|
class RedstoneOre extends Opaque{
|
||||||
protected bool $lit = false;
|
use LightableTrait;
|
||||||
|
|
||||||
protected function describeBlockOnlyState(RuntimeDataDescriber $w) : void{
|
|
||||||
$w->bool($this->lit);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function isLit() : bool{
|
|
||||||
return $this->lit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return $this
|
|
||||||
*/
|
|
||||||
public function setLit(bool $lit = true) : self{
|
|
||||||
$this->lit = $lit;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getLightLevel() : int{
|
public function getLightLevel() : int{
|
||||||
return $this->lit ? 9 : 0;
|
return $this->lit ? 9 : 0;
|
||||||
|
@ -23,28 +23,22 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace pocketmine\block;
|
namespace pocketmine\block;
|
||||||
|
|
||||||
|
use pocketmine\block\utils\LightableTrait;
|
||||||
use pocketmine\data\runtime\RuntimeDataDescriber;
|
use pocketmine\data\runtime\RuntimeDataDescriber;
|
||||||
|
|
||||||
class RedstoneTorch extends Torch{
|
class RedstoneTorch extends Torch{
|
||||||
protected bool $lit = true;
|
use LightableTrait;
|
||||||
|
|
||||||
|
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
|
||||||
|
$this->lit = true;
|
||||||
|
parent::__construct($idInfo, $name, $typeInfo);
|
||||||
|
}
|
||||||
|
|
||||||
protected function describeBlockOnlyState(RuntimeDataDescriber $w) : void{
|
protected function describeBlockOnlyState(RuntimeDataDescriber $w) : void{
|
||||||
parent::describeBlockOnlyState($w);
|
parent::describeBlockOnlyState($w);
|
||||||
$w->bool($this->lit);
|
$w->bool($this->lit);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isLit() : bool{
|
|
||||||
return $this->lit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return $this
|
|
||||||
*/
|
|
||||||
public function setLit(bool $lit = true) : self{
|
|
||||||
$this->lit = $lit;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getLightLevel() : int{
|
public function getLightLevel() : int{
|
||||||
return $this->lit ? 7 : 0;
|
return $this->lit ? 7 : 0;
|
||||||
}
|
}
|
||||||
|
@ -788,7 +788,7 @@ final class VanillaBlocks{
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected static function setup() : void{
|
protected static function setup() : void{
|
||||||
$railBreakInfo = new Info(new BlockBreakInfo(0.7));
|
$railBreakInfo = new Info(new BreakInfo(0.7));
|
||||||
self::register("activator_rail", new ActivatorRail(new BID(Ids::ACTIVATOR_RAIL), "Activator Rail", $railBreakInfo));
|
self::register("activator_rail", new ActivatorRail(new BID(Ids::ACTIVATOR_RAIL), "Activator Rail", $railBreakInfo));
|
||||||
self::register("air", new Air(new BID(Ids::AIR), "Air", new Info(BreakInfo::indestructible(-1.0))));
|
self::register("air", new Air(new BID(Ids::AIR), "Air", new Info(BreakInfo::indestructible(-1.0))));
|
||||||
self::register("anvil", new Anvil(new BID(Ids::ANVIL), "Anvil", new Info(BreakInfo::pickaxe(5.0, ToolTier::WOOD, 6000.0))));
|
self::register("anvil", new Anvil(new BID(Ids::ANVIL), "Anvil", new Info(BreakInfo::pickaxe(5.0, ToolTier::WOOD, 6000.0))));
|
||||||
@ -1638,7 +1638,7 @@ final class VanillaBlocks{
|
|||||||
|
|
||||||
self::register("cave_vines", new CaveVines(new BID(Ids::CAVE_VINES), "Cave Vines", new Info(BreakInfo::instant())));
|
self::register("cave_vines", new CaveVines(new BID(Ids::CAVE_VINES), "Cave Vines", new Info(BreakInfo::instant())));
|
||||||
|
|
||||||
self::register("small_dripleaf", new SmallDripleaf(new BID(Ids::SMALL_DRIPLEAF), "Small Dripleaf", new Info(BreakInfo::instant(BlockToolType::SHEARS, toolHarvestLevel: 1))));
|
self::register("small_dripleaf", new SmallDripleaf(new BID(Ids::SMALL_DRIPLEAF), "Small Dripleaf", new Info(BreakInfo::instant(ToolType::SHEARS, toolHarvestLevel: 1))));
|
||||||
self::register("big_dripleaf_head", new BigDripleafHead(new BID(Ids::BIG_DRIPLEAF_HEAD), "Big Dripleaf", new Info(BreakInfo::instant())));
|
self::register("big_dripleaf_head", new BigDripleafHead(new BID(Ids::BIG_DRIPLEAF_HEAD), "Big Dripleaf", new Info(BreakInfo::instant())));
|
||||||
self::register("big_dripleaf_stem", new BigDripleafStem(new BID(Ids::BIG_DRIPLEAF_STEM), "Big Dripleaf Stem", new Info(BreakInfo::instant())));
|
self::register("big_dripleaf_stem", new BigDripleafStem(new BID(Ids::BIG_DRIPLEAF_STEM), "Big Dripleaf Stem", new Info(BreakInfo::instant())));
|
||||||
}
|
}
|
||||||
|
@ -171,7 +171,7 @@ final class WoodLikeBlockIdHelper{
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getTrapdoorIdentifier(WoodType $treeType) : BlockIdentifier{
|
public static function getTrapdoorIdentifier(WoodType $treeType) : BID{
|
||||||
return new BID(match($treeType){
|
return new BID(match($treeType){
|
||||||
WoodType::OAK => Ids::OAK_TRAPDOOR,
|
WoodType::OAK => Ids::OAK_TRAPDOOR,
|
||||||
WoodType::SPRUCE => Ids::SPRUCE_TRAPDOOR,
|
WoodType::SPRUCE => Ids::SPRUCE_TRAPDOOR,
|
||||||
@ -186,7 +186,7 @@ final class WoodLikeBlockIdHelper{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getButtonIdentifier(WoodType $treeType) : BlockIdentifier{
|
public static function getButtonIdentifier(WoodType $treeType) : BID{
|
||||||
return new BID(match($treeType){
|
return new BID(match($treeType){
|
||||||
WoodType::OAK => Ids::OAK_BUTTON,
|
WoodType::OAK => Ids::OAK_BUTTON,
|
||||||
WoodType::SPRUCE => Ids::SPRUCE_BUTTON,
|
WoodType::SPRUCE => Ids::SPRUCE_BUTTON,
|
||||||
@ -201,7 +201,7 @@ final class WoodLikeBlockIdHelper{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getPressurePlateIdentifier(WoodType $treeType) : BlockIdentifier{
|
public static function getPressurePlateIdentifier(WoodType $treeType) : BID{
|
||||||
return new BID(match($treeType){
|
return new BID(match($treeType){
|
||||||
WoodType::OAK => Ids::OAK_PRESSURE_PLATE,
|
WoodType::OAK => Ids::OAK_PRESSURE_PLATE,
|
||||||
WoodType::SPRUCE => Ids::SPRUCE_PRESSURE_PLATE,
|
WoodType::SPRUCE => Ids::SPRUCE_PRESSURE_PLATE,
|
||||||
@ -216,7 +216,7 @@ final class WoodLikeBlockIdHelper{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getDoorIdentifier(WoodType $treeType) : BlockIdentifier{
|
public static function getDoorIdentifier(WoodType $treeType) : BID{
|
||||||
return new BID(match($treeType){
|
return new BID(match($treeType){
|
||||||
WoodType::OAK => Ids::OAK_DOOR,
|
WoodType::OAK => Ids::OAK_DOOR,
|
||||||
WoodType::SPRUCE => Ids::SPRUCE_DOOR,
|
WoodType::SPRUCE => Ids::SPRUCE_DOOR,
|
||||||
@ -231,7 +231,7 @@ final class WoodLikeBlockIdHelper{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getFenceGateIdentifier(WoodType $treeType) : BlockIdentifier{
|
public static function getFenceGateIdentifier(WoodType $treeType) : BID{
|
||||||
return new BID(match($treeType){
|
return new BID(match($treeType){
|
||||||
WoodType::OAK => Ids::OAK_FENCE_GATE,
|
WoodType::OAK => Ids::OAK_FENCE_GATE,
|
||||||
WoodType::SPRUCE => Ids::SPRUCE_FENCE_GATE,
|
WoodType::SPRUCE => Ids::SPRUCE_FENCE_GATE,
|
||||||
@ -246,7 +246,7 @@ final class WoodLikeBlockIdHelper{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getStairsIdentifier(WoodType $treeType) : BlockIdentifier{
|
public static function getStairsIdentifier(WoodType $treeType) : BID{
|
||||||
return new BID(match($treeType){
|
return new BID(match($treeType){
|
||||||
WoodType::OAK => Ids::OAK_STAIRS,
|
WoodType::OAK => Ids::OAK_STAIRS,
|
||||||
WoodType::SPRUCE => Ids::SPRUCE_STAIRS,
|
WoodType::SPRUCE => Ids::SPRUCE_STAIRS,
|
||||||
|
@ -24,7 +24,6 @@ declare(strict_types=1);
|
|||||||
namespace pocketmine\block\utils;
|
namespace pocketmine\block\utils;
|
||||||
|
|
||||||
use pocketmine\block\Block;
|
use pocketmine\block\Block;
|
||||||
use pocketmine\data\runtime\RuntimeDataDescriber;
|
|
||||||
use pocketmine\entity\projectile\Projectile;
|
use pocketmine\entity\projectile\Projectile;
|
||||||
use pocketmine\item\Durable;
|
use pocketmine\item\Durable;
|
||||||
use pocketmine\item\enchantment\VanillaEnchantments;
|
use pocketmine\item\enchantment\VanillaEnchantments;
|
||||||
@ -38,24 +37,12 @@ use pocketmine\world\sound\FireExtinguishSound;
|
|||||||
use pocketmine\world\sound\FlintSteelSound;
|
use pocketmine\world\sound\FlintSteelSound;
|
||||||
|
|
||||||
trait CandleTrait{
|
trait CandleTrait{
|
||||||
private bool $lit = false;
|
use LightableTrait;
|
||||||
|
|
||||||
protected function describeBlockOnlyState(RuntimeDataDescriber $w) : void{
|
|
||||||
$w->bool($this->lit);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getLightLevel() : int{
|
public function getLightLevel() : int{
|
||||||
return $this->lit ? 3 : 0;
|
return $this->lit ? 3 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isLit() : bool{ return $this->lit; }
|
|
||||||
|
|
||||||
/** @return $this */
|
|
||||||
public function setLit(bool $lit) : self{
|
|
||||||
$this->lit = $lit;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @see Block::onInteract() */
|
/** @see Block::onInteract() */
|
||||||
public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null, array &$returnedItems = []) : bool{
|
public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null, array &$returnedItems = []) : bool{
|
||||||
if($item->getTypeId() === ItemTypeIds::FIRE_CHARGE || $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())){
|
||||||
|
@ -21,18 +21,26 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace pocketmine\data\bedrock;
|
namespace pocketmine\block\utils;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use pocketmine\data\runtime\RuntimeDataDescriber;
|
||||||
use pocketmine\block\utils\DyeColor;
|
|
||||||
|
|
||||||
class DyeColorIdMapTest extends TestCase{
|
trait LightableTrait{
|
||||||
|
protected bool $lit = false;
|
||||||
|
|
||||||
public function testAllColorsMapped() : void{
|
protected function describeBlockOnlyState(RuntimeDataDescriber $w) : void{
|
||||||
foreach(DyeColor::cases() as $color){
|
$w->bool($this->lit);
|
||||||
$id = DyeColorIdMap::getInstance()->toId($color);
|
}
|
||||||
$color2 = DyeColorIdMap::getInstance()->fromId($id);
|
|
||||||
self::assertTrue($color === $color2);
|
public function isLit() : bool{
|
||||||
}
|
return $this->lit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function setLit(bool $lit = true) : self{
|
||||||
|
$this->lit = $lit;
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -43,44 +43,48 @@ final class BannerPatternTypeIdMap{
|
|||||||
private array $enumToId = [];
|
private array $enumToId = [];
|
||||||
|
|
||||||
public function __construct(){
|
public function __construct(){
|
||||||
$this->register("bo", BannerPatternType::BORDER);
|
foreach(BannerPatternType::cases() as $case){
|
||||||
$this->register("bri", BannerPatternType::BRICKS);
|
$this->register(match($case){
|
||||||
$this->register("mc", BannerPatternType::CIRCLE);
|
BannerPatternType::BORDER => "bo",
|
||||||
$this->register("cre", BannerPatternType::CREEPER);
|
BannerPatternType::BRICKS => "bri",
|
||||||
$this->register("cr", BannerPatternType::CROSS);
|
BannerPatternType::CIRCLE => "mc",
|
||||||
$this->register("cbo", BannerPatternType::CURLY_BORDER);
|
BannerPatternType::CREEPER => "cre",
|
||||||
$this->register("lud", BannerPatternType::DIAGONAL_LEFT);
|
BannerPatternType::CROSS => "cr",
|
||||||
$this->register("rd", BannerPatternType::DIAGONAL_RIGHT);
|
BannerPatternType::CURLY_BORDER => "cbo",
|
||||||
$this->register("ld", BannerPatternType::DIAGONAL_UP_LEFT);
|
BannerPatternType::DIAGONAL_LEFT => "lud",
|
||||||
$this->register("rud", BannerPatternType::DIAGONAL_UP_RIGHT);
|
BannerPatternType::DIAGONAL_RIGHT => "rd",
|
||||||
$this->register("flo", BannerPatternType::FLOWER);
|
BannerPatternType::DIAGONAL_UP_LEFT => "ld",
|
||||||
$this->register("gra", BannerPatternType::GRADIENT);
|
BannerPatternType::DIAGONAL_UP_RIGHT => "rud",
|
||||||
$this->register("gru", BannerPatternType::GRADIENT_UP);
|
BannerPatternType::FLOWER => "flo",
|
||||||
$this->register("hh", BannerPatternType::HALF_HORIZONTAL);
|
BannerPatternType::GRADIENT => "gra",
|
||||||
$this->register("hhb", BannerPatternType::HALF_HORIZONTAL_BOTTOM);
|
BannerPatternType::GRADIENT_UP => "gru",
|
||||||
$this->register("vh", BannerPatternType::HALF_VERTICAL);
|
BannerPatternType::HALF_HORIZONTAL => "hh",
|
||||||
$this->register("vhr", BannerPatternType::HALF_VERTICAL_RIGHT);
|
BannerPatternType::HALF_HORIZONTAL_BOTTOM => "hhb",
|
||||||
$this->register("moj", BannerPatternType::MOJANG);
|
BannerPatternType::HALF_VERTICAL => "vh",
|
||||||
$this->register("mr", BannerPatternType::RHOMBUS);
|
BannerPatternType::HALF_VERTICAL_RIGHT => "vhr",
|
||||||
$this->register("sku", BannerPatternType::SKULL);
|
BannerPatternType::MOJANG => "moj",
|
||||||
$this->register("ss", BannerPatternType::SMALL_STRIPES);
|
BannerPatternType::RHOMBUS => "mr",
|
||||||
$this->register("bl", BannerPatternType::SQUARE_BOTTOM_LEFT);
|
BannerPatternType::SKULL => "sku",
|
||||||
$this->register("br", BannerPatternType::SQUARE_BOTTOM_RIGHT);
|
BannerPatternType::SMALL_STRIPES => "ss",
|
||||||
$this->register("tl", BannerPatternType::SQUARE_TOP_LEFT);
|
BannerPatternType::SQUARE_BOTTOM_LEFT => "bl",
|
||||||
$this->register("tr", BannerPatternType::SQUARE_TOP_RIGHT);
|
BannerPatternType::SQUARE_BOTTOM_RIGHT => "br",
|
||||||
$this->register("sc", BannerPatternType::STRAIGHT_CROSS);
|
BannerPatternType::SQUARE_TOP_LEFT => "tl",
|
||||||
$this->register("bs", BannerPatternType::STRIPE_BOTTOM);
|
BannerPatternType::SQUARE_TOP_RIGHT => "tr",
|
||||||
$this->register("cs", BannerPatternType::STRIPE_CENTER);
|
BannerPatternType::STRAIGHT_CROSS => "sc",
|
||||||
$this->register("dls", BannerPatternType::STRIPE_DOWNLEFT);
|
BannerPatternType::STRIPE_BOTTOM => "bs",
|
||||||
$this->register("drs", BannerPatternType::STRIPE_DOWNRIGHT);
|
BannerPatternType::STRIPE_CENTER => "cs",
|
||||||
$this->register("ls", BannerPatternType::STRIPE_LEFT);
|
BannerPatternType::STRIPE_DOWNLEFT => "dls",
|
||||||
$this->register("ms", BannerPatternType::STRIPE_MIDDLE);
|
BannerPatternType::STRIPE_DOWNRIGHT => "drs",
|
||||||
$this->register("rs", BannerPatternType::STRIPE_RIGHT);
|
BannerPatternType::STRIPE_LEFT => "ls",
|
||||||
$this->register("ts", BannerPatternType::STRIPE_TOP);
|
BannerPatternType::STRIPE_MIDDLE => "ms",
|
||||||
$this->register("bt", BannerPatternType::TRIANGLE_BOTTOM);
|
BannerPatternType::STRIPE_RIGHT => "rs",
|
||||||
$this->register("tt", BannerPatternType::TRIANGLE_TOP);
|
BannerPatternType::STRIPE_TOP => "ts",
|
||||||
$this->register("bts", BannerPatternType::TRIANGLES_BOTTOM);
|
BannerPatternType::TRIANGLE_BOTTOM => "bt",
|
||||||
$this->register("tts", BannerPatternType::TRIANGLES_TOP);
|
BannerPatternType::TRIANGLE_TOP => "tt",
|
||||||
|
BannerPatternType::TRIANGLES_BOTTOM => "bts",
|
||||||
|
BannerPatternType::TRIANGLES_TOP => "tts",
|
||||||
|
}, $case);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function register(string $stringId, BannerPatternType $type) : void{
|
public function register(string $stringId, BannerPatternType $type) : void{
|
||||||
|
@ -48,22 +48,28 @@ final class DyeColorIdMap{
|
|||||||
private array $enumToItemId = [];
|
private array $enumToItemId = [];
|
||||||
|
|
||||||
private function __construct(){
|
private function __construct(){
|
||||||
$this->register(0, ItemTypeNames::WHITE_DYE, DyeColor::WHITE);
|
foreach(DyeColor::cases() as $case){
|
||||||
$this->register(1, ItemTypeNames::ORANGE_DYE, DyeColor::ORANGE);
|
[$colorId, $dyeItemId] = match($case){
|
||||||
$this->register(2, ItemTypeNames::MAGENTA_DYE, DyeColor::MAGENTA);
|
DyeColor::WHITE => [0, ItemTypeNames::WHITE_DYE],
|
||||||
$this->register(3, ItemTypeNames::LIGHT_BLUE_DYE, DyeColor::LIGHT_BLUE);
|
DyeColor::ORANGE => [1, ItemTypeNames::ORANGE_DYE],
|
||||||
$this->register(4, ItemTypeNames::YELLOW_DYE, DyeColor::YELLOW);
|
DyeColor::MAGENTA => [2, ItemTypeNames::MAGENTA_DYE],
|
||||||
$this->register(5, ItemTypeNames::LIME_DYE, DyeColor::LIME);
|
DyeColor::LIGHT_BLUE => [3, ItemTypeNames::LIGHT_BLUE_DYE],
|
||||||
$this->register(6, ItemTypeNames::PINK_DYE, DyeColor::PINK);
|
DyeColor::YELLOW => [4, ItemTypeNames::YELLOW_DYE],
|
||||||
$this->register(7, ItemTypeNames::GRAY_DYE, DyeColor::GRAY);
|
DyeColor::LIME => [5, ItemTypeNames::LIME_DYE],
|
||||||
$this->register(8, ItemTypeNames::LIGHT_GRAY_DYE, DyeColor::LIGHT_GRAY);
|
DyeColor::PINK => [6, ItemTypeNames::PINK_DYE],
|
||||||
$this->register(9, ItemTypeNames::CYAN_DYE, DyeColor::CYAN);
|
DyeColor::GRAY => [7, ItemTypeNames::GRAY_DYE],
|
||||||
$this->register(10, ItemTypeNames::PURPLE_DYE, DyeColor::PURPLE);
|
DyeColor::LIGHT_GRAY => [8, ItemTypeNames::LIGHT_GRAY_DYE],
|
||||||
$this->register(11, ItemTypeNames::BLUE_DYE, DyeColor::BLUE);
|
DyeColor::CYAN => [9, ItemTypeNames::CYAN_DYE],
|
||||||
$this->register(12, ItemTypeNames::BROWN_DYE, DyeColor::BROWN);
|
DyeColor::PURPLE => [10, ItemTypeNames::PURPLE_DYE],
|
||||||
$this->register(13, ItemTypeNames::GREEN_DYE, DyeColor::GREEN);
|
DyeColor::BLUE => [11, ItemTypeNames::BLUE_DYE],
|
||||||
$this->register(14, ItemTypeNames::RED_DYE, DyeColor::RED);
|
DyeColor::BROWN => [12, ItemTypeNames::BROWN_DYE],
|
||||||
$this->register(15, ItemTypeNames::BLACK_DYE, DyeColor::BLACK);
|
DyeColor::GREEN => [13, ItemTypeNames::GREEN_DYE],
|
||||||
|
DyeColor::RED => [14, ItemTypeNames::RED_DYE],
|
||||||
|
DyeColor::BLACK => [15, ItemTypeNames::BLACK_DYE],
|
||||||
|
};
|
||||||
|
|
||||||
|
$this->register($colorId, $dyeItemId, $case);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function register(int $id, string $itemId, DyeColor $color) : void{
|
private function register(int $id, string $itemId, DyeColor $color) : void{
|
||||||
|
@ -32,9 +32,13 @@ final class MedicineTypeIdMap{
|
|||||||
use IntSaveIdMapTrait;
|
use IntSaveIdMapTrait;
|
||||||
|
|
||||||
private function __construct(){
|
private function __construct(){
|
||||||
$this->register(MedicineTypeIds::ANTIDOTE, MedicineType::ANTIDOTE);
|
foreach(MedicineType::cases() as $case){
|
||||||
$this->register(MedicineTypeIds::ELIXIR, MedicineType::ELIXIR);
|
$this->register(match($case){
|
||||||
$this->register(MedicineTypeIds::EYE_DROPS, MedicineType::EYE_DROPS);
|
MedicineType::ANTIDOTE => MedicineTypeIds::ANTIDOTE,
|
||||||
$this->register(MedicineTypeIds::TONIC, MedicineType::TONIC);
|
MedicineType::ELIXIR => MedicineTypeIds::ELIXIR,
|
||||||
|
MedicineType::EYE_DROPS => MedicineTypeIds::EYE_DROPS,
|
||||||
|
MedicineType::TONIC => MedicineTypeIds::TONIC,
|
||||||
|
}, $case);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,12 +32,16 @@ final class MobHeadTypeIdMap{
|
|||||||
use IntSaveIdMapTrait;
|
use IntSaveIdMapTrait;
|
||||||
|
|
||||||
private function __construct(){
|
private function __construct(){
|
||||||
$this->register(0, MobHeadType::SKELETON);
|
foreach(MobHeadType::cases() as $case){
|
||||||
$this->register(1, MobHeadType::WITHER_SKELETON);
|
$this->register(match($case){
|
||||||
$this->register(2, MobHeadType::ZOMBIE);
|
MobHeadType::SKELETON => 0,
|
||||||
$this->register(3, MobHeadType::PLAYER);
|
MobHeadType::WITHER_SKELETON => 1,
|
||||||
$this->register(4, MobHeadType::CREEPER);
|
MobHeadType::ZOMBIE => 2,
|
||||||
$this->register(5, MobHeadType::DRAGON);
|
MobHeadType::PLAYER => 3,
|
||||||
$this->register(6, MobHeadType::PIGLIN);
|
MobHeadType::CREEPER => 4,
|
||||||
|
MobHeadType::DRAGON => 5,
|
||||||
|
MobHeadType::PIGLIN => 6,
|
||||||
|
}, $case);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,16 +33,20 @@ final class MushroomBlockTypeIdMap{
|
|||||||
use IntSaveIdMapTrait;
|
use IntSaveIdMapTrait;
|
||||||
|
|
||||||
public function __construct(){
|
public function __construct(){
|
||||||
$this->register(LegacyMeta::MUSHROOM_BLOCK_ALL_PORES, MushroomBlockType::PORES);
|
foreach(MushroomBlockType::cases() as $case){
|
||||||
$this->register(LegacyMeta::MUSHROOM_BLOCK_CAP_NORTHWEST_CORNER, MushroomBlockType::CAP_NORTHWEST);
|
$this->register(match($case){
|
||||||
$this->register(LegacyMeta::MUSHROOM_BLOCK_CAP_NORTH_SIDE, MushroomBlockType::CAP_NORTH);
|
MushroomBlockType::PORES => LegacyMeta::MUSHROOM_BLOCK_ALL_PORES,
|
||||||
$this->register(LegacyMeta::MUSHROOM_BLOCK_CAP_NORTHEAST_CORNER, MushroomBlockType::CAP_NORTHEAST);
|
MushroomBlockType::CAP_NORTHWEST => LegacyMeta::MUSHROOM_BLOCK_CAP_NORTHWEST_CORNER,
|
||||||
$this->register(LegacyMeta::MUSHROOM_BLOCK_CAP_WEST_SIDE, MushroomBlockType::CAP_WEST);
|
MushroomBlockType::CAP_NORTH => LegacyMeta::MUSHROOM_BLOCK_CAP_NORTH_SIDE,
|
||||||
$this->register(LegacyMeta::MUSHROOM_BLOCK_CAP_TOP_ONLY, MushroomBlockType::CAP_MIDDLE);
|
MushroomBlockType::CAP_NORTHEAST => LegacyMeta::MUSHROOM_BLOCK_CAP_NORTHEAST_CORNER,
|
||||||
$this->register(LegacyMeta::MUSHROOM_BLOCK_CAP_EAST_SIDE, MushroomBlockType::CAP_EAST);
|
MushroomBlockType::CAP_WEST => LegacyMeta::MUSHROOM_BLOCK_CAP_WEST_SIDE,
|
||||||
$this->register(LegacyMeta::MUSHROOM_BLOCK_CAP_SOUTHWEST_CORNER, MushroomBlockType::CAP_SOUTHWEST);
|
MushroomBlockType::CAP_MIDDLE => LegacyMeta::MUSHROOM_BLOCK_CAP_TOP_ONLY,
|
||||||
$this->register(LegacyMeta::MUSHROOM_BLOCK_CAP_SOUTH_SIDE, MushroomBlockType::CAP_SOUTH);
|
MushroomBlockType::CAP_EAST => LegacyMeta::MUSHROOM_BLOCK_CAP_EAST_SIDE,
|
||||||
$this->register(LegacyMeta::MUSHROOM_BLOCK_CAP_SOUTHEAST_CORNER, MushroomBlockType::CAP_SOUTHEAST);
|
MushroomBlockType::CAP_SOUTHWEST => LegacyMeta::MUSHROOM_BLOCK_CAP_SOUTHWEST_CORNER,
|
||||||
$this->register(LegacyMeta::MUSHROOM_BLOCK_ALL_CAP, MushroomBlockType::ALL_CAP);
|
MushroomBlockType::CAP_SOUTH => LegacyMeta::MUSHROOM_BLOCK_CAP_SOUTH_SIDE,
|
||||||
|
MushroomBlockType::CAP_SOUTHEAST => LegacyMeta::MUSHROOM_BLOCK_CAP_SOUTHEAST_CORNER,
|
||||||
|
MushroomBlockType::ALL_CAP => LegacyMeta::MUSHROOM_BLOCK_ALL_CAP,
|
||||||
|
}, $case);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,21 +32,25 @@ final class NoteInstrumentIdMap{
|
|||||||
use IntSaveIdMapTrait;
|
use IntSaveIdMapTrait;
|
||||||
|
|
||||||
private function __construct(){
|
private function __construct(){
|
||||||
$this->register(0, NoteInstrument::PIANO);
|
foreach(NoteInstrument::cases() as $case){
|
||||||
$this->register(1, NoteInstrument::BASS_DRUM);
|
$this->register(match($case){
|
||||||
$this->register(2, NoteInstrument::SNARE);
|
NoteInstrument::PIANO => 0,
|
||||||
$this->register(3, NoteInstrument::CLICKS_AND_STICKS);
|
NoteInstrument::BASS_DRUM => 1,
|
||||||
$this->register(4, NoteInstrument::DOUBLE_BASS);
|
NoteInstrument::SNARE => 2,
|
||||||
$this->register(5, NoteInstrument::BELL);
|
NoteInstrument::CLICKS_AND_STICKS => 3,
|
||||||
$this->register(6, NoteInstrument::FLUTE);
|
NoteInstrument::DOUBLE_BASS => 4,
|
||||||
$this->register(7, NoteInstrument::CHIME);
|
NoteInstrument::BELL => 5,
|
||||||
$this->register(8, NoteInstrument::GUITAR);
|
NoteInstrument::FLUTE => 6,
|
||||||
$this->register(9, NoteInstrument::XYLOPHONE);
|
NoteInstrument::CHIME => 7,
|
||||||
$this->register(10, NoteInstrument::IRON_XYLOPHONE);
|
NoteInstrument::GUITAR => 8,
|
||||||
$this->register(11, NoteInstrument::COW_BELL);
|
NoteInstrument::XYLOPHONE => 9,
|
||||||
$this->register(12, NoteInstrument::DIDGERIDOO);
|
NoteInstrument::IRON_XYLOPHONE => 10,
|
||||||
$this->register(13, NoteInstrument::BIT);
|
NoteInstrument::COW_BELL => 11,
|
||||||
$this->register(14, NoteInstrument::BANJO);
|
NoteInstrument::DIDGERIDOO => 12,
|
||||||
$this->register(15, NoteInstrument::PLING);
|
NoteInstrument::BIT => 13,
|
||||||
|
NoteInstrument::BANJO => 14,
|
||||||
|
NoteInstrument::PLING => 15,
|
||||||
|
}, $case);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,48 +32,52 @@ final class PotionTypeIdMap{
|
|||||||
use IntSaveIdMapTrait;
|
use IntSaveIdMapTrait;
|
||||||
|
|
||||||
private function __construct(){
|
private function __construct(){
|
||||||
$this->register(PotionTypeIds::WATER, PotionType::WATER);
|
foreach(PotionType::cases() as $case){
|
||||||
$this->register(PotionTypeIds::MUNDANE, PotionType::MUNDANE);
|
$this->register(match($case){
|
||||||
$this->register(PotionTypeIds::LONG_MUNDANE, PotionType::LONG_MUNDANE);
|
PotionType::WATER => PotionTypeIds::WATER,
|
||||||
$this->register(PotionTypeIds::THICK, PotionType::THICK);
|
PotionType::MUNDANE => PotionTypeIds::MUNDANE,
|
||||||
$this->register(PotionTypeIds::AWKWARD, PotionType::AWKWARD);
|
PotionType::LONG_MUNDANE => PotionTypeIds::LONG_MUNDANE,
|
||||||
$this->register(PotionTypeIds::NIGHT_VISION, PotionType::NIGHT_VISION);
|
PotionType::THICK => PotionTypeIds::THICK,
|
||||||
$this->register(PotionTypeIds::LONG_NIGHT_VISION, PotionType::LONG_NIGHT_VISION);
|
PotionType::AWKWARD => PotionTypeIds::AWKWARD,
|
||||||
$this->register(PotionTypeIds::INVISIBILITY, PotionType::INVISIBILITY);
|
PotionType::NIGHT_VISION => PotionTypeIds::NIGHT_VISION,
|
||||||
$this->register(PotionTypeIds::LONG_INVISIBILITY, PotionType::LONG_INVISIBILITY);
|
PotionType::LONG_NIGHT_VISION => PotionTypeIds::LONG_NIGHT_VISION,
|
||||||
$this->register(PotionTypeIds::LEAPING, PotionType::LEAPING);
|
PotionType::INVISIBILITY => PotionTypeIds::INVISIBILITY,
|
||||||
$this->register(PotionTypeIds::LONG_LEAPING, PotionType::LONG_LEAPING);
|
PotionType::LONG_INVISIBILITY => PotionTypeIds::LONG_INVISIBILITY,
|
||||||
$this->register(PotionTypeIds::STRONG_LEAPING, PotionType::STRONG_LEAPING);
|
PotionType::LEAPING => PotionTypeIds::LEAPING,
|
||||||
$this->register(PotionTypeIds::FIRE_RESISTANCE, PotionType::FIRE_RESISTANCE);
|
PotionType::LONG_LEAPING => PotionTypeIds::LONG_LEAPING,
|
||||||
$this->register(PotionTypeIds::LONG_FIRE_RESISTANCE, PotionType::LONG_FIRE_RESISTANCE);
|
PotionType::STRONG_LEAPING => PotionTypeIds::STRONG_LEAPING,
|
||||||
$this->register(PotionTypeIds::SWIFTNESS, PotionType::SWIFTNESS);
|
PotionType::FIRE_RESISTANCE => PotionTypeIds::FIRE_RESISTANCE,
|
||||||
$this->register(PotionTypeIds::LONG_SWIFTNESS, PotionType::LONG_SWIFTNESS);
|
PotionType::LONG_FIRE_RESISTANCE => PotionTypeIds::LONG_FIRE_RESISTANCE,
|
||||||
$this->register(PotionTypeIds::STRONG_SWIFTNESS, PotionType::STRONG_SWIFTNESS);
|
PotionType::SWIFTNESS => PotionTypeIds::SWIFTNESS,
|
||||||
$this->register(PotionTypeIds::SLOWNESS, PotionType::SLOWNESS);
|
PotionType::LONG_SWIFTNESS => PotionTypeIds::LONG_SWIFTNESS,
|
||||||
$this->register(PotionTypeIds::LONG_SLOWNESS, PotionType::LONG_SLOWNESS);
|
PotionType::STRONG_SWIFTNESS => PotionTypeIds::STRONG_SWIFTNESS,
|
||||||
$this->register(PotionTypeIds::WATER_BREATHING, PotionType::WATER_BREATHING);
|
PotionType::SLOWNESS => PotionTypeIds::SLOWNESS,
|
||||||
$this->register(PotionTypeIds::LONG_WATER_BREATHING, PotionType::LONG_WATER_BREATHING);
|
PotionType::LONG_SLOWNESS => PotionTypeIds::LONG_SLOWNESS,
|
||||||
$this->register(PotionTypeIds::HEALING, PotionType::HEALING);
|
PotionType::WATER_BREATHING => PotionTypeIds::WATER_BREATHING,
|
||||||
$this->register(PotionTypeIds::STRONG_HEALING, PotionType::STRONG_HEALING);
|
PotionType::LONG_WATER_BREATHING => PotionTypeIds::LONG_WATER_BREATHING,
|
||||||
$this->register(PotionTypeIds::HARMING, PotionType::HARMING);
|
PotionType::HEALING => PotionTypeIds::HEALING,
|
||||||
$this->register(PotionTypeIds::STRONG_HARMING, PotionType::STRONG_HARMING);
|
PotionType::STRONG_HEALING => PotionTypeIds::STRONG_HEALING,
|
||||||
$this->register(PotionTypeIds::POISON, PotionType::POISON);
|
PotionType::HARMING => PotionTypeIds::HARMING,
|
||||||
$this->register(PotionTypeIds::LONG_POISON, PotionType::LONG_POISON);
|
PotionType::STRONG_HARMING => PotionTypeIds::STRONG_HARMING,
|
||||||
$this->register(PotionTypeIds::STRONG_POISON, PotionType::STRONG_POISON);
|
PotionType::POISON => PotionTypeIds::POISON,
|
||||||
$this->register(PotionTypeIds::REGENERATION, PotionType::REGENERATION);
|
PotionType::LONG_POISON => PotionTypeIds::LONG_POISON,
|
||||||
$this->register(PotionTypeIds::LONG_REGENERATION, PotionType::LONG_REGENERATION);
|
PotionType::STRONG_POISON => PotionTypeIds::STRONG_POISON,
|
||||||
$this->register(PotionTypeIds::STRONG_REGENERATION, PotionType::STRONG_REGENERATION);
|
PotionType::REGENERATION => PotionTypeIds::REGENERATION,
|
||||||
$this->register(PotionTypeIds::STRENGTH, PotionType::STRENGTH);
|
PotionType::LONG_REGENERATION => PotionTypeIds::LONG_REGENERATION,
|
||||||
$this->register(PotionTypeIds::LONG_STRENGTH, PotionType::LONG_STRENGTH);
|
PotionType::STRONG_REGENERATION => PotionTypeIds::STRONG_REGENERATION,
|
||||||
$this->register(PotionTypeIds::STRONG_STRENGTH, PotionType::STRONG_STRENGTH);
|
PotionType::STRENGTH => PotionTypeIds::STRENGTH,
|
||||||
$this->register(PotionTypeIds::WEAKNESS, PotionType::WEAKNESS);
|
PotionType::LONG_STRENGTH => PotionTypeIds::LONG_STRENGTH,
|
||||||
$this->register(PotionTypeIds::LONG_WEAKNESS, PotionType::LONG_WEAKNESS);
|
PotionType::STRONG_STRENGTH => PotionTypeIds::STRONG_STRENGTH,
|
||||||
$this->register(PotionTypeIds::WITHER, PotionType::WITHER);
|
PotionType::WEAKNESS => PotionTypeIds::WEAKNESS,
|
||||||
$this->register(PotionTypeIds::TURTLE_MASTER, PotionType::TURTLE_MASTER);
|
PotionType::LONG_WEAKNESS => PotionTypeIds::LONG_WEAKNESS,
|
||||||
$this->register(PotionTypeIds::LONG_TURTLE_MASTER, PotionType::LONG_TURTLE_MASTER);
|
PotionType::WITHER => PotionTypeIds::WITHER,
|
||||||
$this->register(PotionTypeIds::STRONG_TURTLE_MASTER, PotionType::STRONG_TURTLE_MASTER);
|
PotionType::TURTLE_MASTER => PotionTypeIds::TURTLE_MASTER,
|
||||||
$this->register(PotionTypeIds::SLOW_FALLING, PotionType::SLOW_FALLING);
|
PotionType::LONG_TURTLE_MASTER => PotionTypeIds::LONG_TURTLE_MASTER,
|
||||||
$this->register(PotionTypeIds::LONG_SLOW_FALLING, PotionType::LONG_SLOW_FALLING);
|
PotionType::STRONG_TURTLE_MASTER => PotionTypeIds::STRONG_TURTLE_MASTER,
|
||||||
$this->register(PotionTypeIds::STRONG_SLOWNESS, PotionType::STRONG_SLOWNESS);
|
PotionType::SLOW_FALLING => PotionTypeIds::SLOW_FALLING,
|
||||||
|
PotionType::LONG_SLOW_FALLING => PotionTypeIds::LONG_SLOW_FALLING,
|
||||||
|
PotionType::STRONG_SLOWNESS => PotionTypeIds::STRONG_SLOWNESS,
|
||||||
|
}, $case);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,15 +32,20 @@ final class SuspiciousStewTypeIdMap{
|
|||||||
use IntSaveIdMapTrait;
|
use IntSaveIdMapTrait;
|
||||||
|
|
||||||
private function __construct(){
|
private function __construct(){
|
||||||
$this->register(SuspiciousStewTypeIds::POPPY, SuspiciousStewType::POPPY);
|
foreach(SuspiciousStewType::cases() as $case){
|
||||||
$this->register(SuspiciousStewTypeIds::CORNFLOWER, SuspiciousStewType::CORNFLOWER);
|
$this->register(match($case){
|
||||||
$this->register(SuspiciousStewTypeIds::TULIP, SuspiciousStewType::TULIP);
|
SuspiciousStewType::POPPY => SuspiciousStewTypeIds::POPPY,
|
||||||
$this->register(SuspiciousStewTypeIds::AZURE_BLUET, SuspiciousStewType::AZURE_BLUET);
|
SuspiciousStewType::CORNFLOWER => SuspiciousStewTypeIds::CORNFLOWER,
|
||||||
$this->register(SuspiciousStewTypeIds::LILY_OF_THE_VALLEY, SuspiciousStewType::LILY_OF_THE_VALLEY);
|
SuspiciousStewType::TULIP => SuspiciousStewTypeIds::TULIP,
|
||||||
$this->register(SuspiciousStewTypeIds::DANDELION, SuspiciousStewType::DANDELION);
|
SuspiciousStewType::AZURE_BLUET => SuspiciousStewTypeIds::AZURE_BLUET,
|
||||||
$this->register(SuspiciousStewTypeIds::BLUE_ORCHID, SuspiciousStewType::BLUE_ORCHID);
|
SuspiciousStewType::LILY_OF_THE_VALLEY => SuspiciousStewTypeIds::LILY_OF_THE_VALLEY,
|
||||||
$this->register(SuspiciousStewTypeIds::ALLIUM, SuspiciousStewType::ALLIUM);
|
SuspiciousStewType::DANDELION => SuspiciousStewTypeIds::DANDELION,
|
||||||
$this->register(SuspiciousStewTypeIds::OXEYE_DAISY, SuspiciousStewType::OXEYE_DAISY);
|
SuspiciousStewType::BLUE_ORCHID => SuspiciousStewTypeIds::BLUE_ORCHID,
|
||||||
$this->register(SuspiciousStewTypeIds::WITHER_ROSE, SuspiciousStewType::WITHER_ROSE);
|
SuspiciousStewType::ALLIUM => SuspiciousStewTypeIds::ALLIUM,
|
||||||
|
SuspiciousStewType::OXEYE_DAISY => SuspiciousStewTypeIds::OXEYE_DAISY,
|
||||||
|
SuspiciousStewType::WITHER_ROSE => SuspiciousStewTypeIds::WITHER_ROSE,
|
||||||
|
}, $case);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ final class BlockStateData{
|
|||||||
public const CURRENT_VERSION =
|
public const CURRENT_VERSION =
|
||||||
(1 << 24) | //major
|
(1 << 24) | //major
|
||||||
(20 << 16) | //minor
|
(20 << 16) | //minor
|
||||||
(50 << 8) | //patch
|
(60 << 8) | //patch
|
||||||
(1); //revision
|
(1); //revision
|
||||||
|
|
||||||
public const TAG_NAME = "name";
|
public const TAG_NAME = "name";
|
||||||
|
@ -56,7 +56,6 @@ final class BlockStateNames{
|
|||||||
public const CHEMISTRY_TABLE_TYPE = "chemistry_table_type";
|
public const CHEMISTRY_TABLE_TYPE = "chemistry_table_type";
|
||||||
public const CHISEL_TYPE = "chisel_type";
|
public const CHISEL_TYPE = "chisel_type";
|
||||||
public const CLUSTER_COUNT = "cluster_count";
|
public const CLUSTER_COUNT = "cluster_count";
|
||||||
public const COLOR = "color";
|
|
||||||
public const COLOR_BIT = "color_bit";
|
public const COLOR_BIT = "color_bit";
|
||||||
public const COMPOSTER_FILL_LEVEL = "composter_fill_level";
|
public const COMPOSTER_FILL_LEVEL = "composter_fill_level";
|
||||||
public const CONDITIONAL_BIT = "conditional_bit";
|
public const CONDITIONAL_BIT = "conditional_bit";
|
||||||
@ -145,6 +144,7 @@ final class BlockStateNames{
|
|||||||
public const TALL_GRASS_TYPE = "tall_grass_type";
|
public const TALL_GRASS_TYPE = "tall_grass_type";
|
||||||
public const TOGGLE_BIT = "toggle_bit";
|
public const TOGGLE_BIT = "toggle_bit";
|
||||||
public const TORCH_FACING_DIRECTION = "torch_facing_direction";
|
public const TORCH_FACING_DIRECTION = "torch_facing_direction";
|
||||||
|
public const TRIAL_SPAWNER_STATE = "trial_spawner_state";
|
||||||
public const TRIGGERED_BIT = "triggered_bit";
|
public const TRIGGERED_BIT = "triggered_bit";
|
||||||
public const TURTLE_EGG_COUNT = "turtle_egg_count";
|
public const TURTLE_EGG_COUNT = "turtle_egg_count";
|
||||||
public const TWISTING_VINES_AGE = "twisting_vines_age";
|
public const TWISTING_VINES_AGE = "twisting_vines_age";
|
||||||
|
@ -62,23 +62,6 @@ final class BlockStateStringValues{
|
|||||||
public const CHISEL_TYPE_LINES = "lines";
|
public const CHISEL_TYPE_LINES = "lines";
|
||||||
public const CHISEL_TYPE_SMOOTH = "smooth";
|
public const CHISEL_TYPE_SMOOTH = "smooth";
|
||||||
|
|
||||||
public const COLOR_BLACK = "black";
|
|
||||||
public const COLOR_BLUE = "blue";
|
|
||||||
public const COLOR_BROWN = "brown";
|
|
||||||
public const COLOR_CYAN = "cyan";
|
|
||||||
public const COLOR_GRAY = "gray";
|
|
||||||
public const COLOR_GREEN = "green";
|
|
||||||
public const COLOR_LIGHT_BLUE = "light_blue";
|
|
||||||
public const COLOR_LIME = "lime";
|
|
||||||
public const COLOR_MAGENTA = "magenta";
|
|
||||||
public const COLOR_ORANGE = "orange";
|
|
||||||
public const COLOR_PINK = "pink";
|
|
||||||
public const COLOR_PURPLE = "purple";
|
|
||||||
public const COLOR_RED = "red";
|
|
||||||
public const COLOR_SILVER = "silver";
|
|
||||||
public const COLOR_WHITE = "white";
|
|
||||||
public const COLOR_YELLOW = "yellow";
|
|
||||||
|
|
||||||
public const CORAL_COLOR_BLUE = "blue";
|
public const CORAL_COLOR_BLUE = "blue";
|
||||||
public const CORAL_COLOR_PINK = "pink";
|
public const CORAL_COLOR_PINK = "pink";
|
||||||
public const CORAL_COLOR_PURPLE = "purple";
|
public const CORAL_COLOR_PURPLE = "purple";
|
||||||
|
@ -517,10 +517,40 @@ final class BlockTypeNames{
|
|||||||
public const GREEN_WOOL = "minecraft:green_wool";
|
public const GREEN_WOOL = "minecraft:green_wool";
|
||||||
public const GRINDSTONE = "minecraft:grindstone";
|
public const GRINDSTONE = "minecraft:grindstone";
|
||||||
public const HANGING_ROOTS = "minecraft:hanging_roots";
|
public const HANGING_ROOTS = "minecraft:hanging_roots";
|
||||||
|
public const HARD_BLACK_STAINED_GLASS = "minecraft:hard_black_stained_glass";
|
||||||
|
public const HARD_BLACK_STAINED_GLASS_PANE = "minecraft:hard_black_stained_glass_pane";
|
||||||
|
public const HARD_BLUE_STAINED_GLASS = "minecraft:hard_blue_stained_glass";
|
||||||
|
public const HARD_BLUE_STAINED_GLASS_PANE = "minecraft:hard_blue_stained_glass_pane";
|
||||||
|
public const HARD_BROWN_STAINED_GLASS = "minecraft:hard_brown_stained_glass";
|
||||||
|
public const HARD_BROWN_STAINED_GLASS_PANE = "minecraft:hard_brown_stained_glass_pane";
|
||||||
|
public const HARD_CYAN_STAINED_GLASS = "minecraft:hard_cyan_stained_glass";
|
||||||
|
public const HARD_CYAN_STAINED_GLASS_PANE = "minecraft:hard_cyan_stained_glass_pane";
|
||||||
public const HARD_GLASS = "minecraft:hard_glass";
|
public const HARD_GLASS = "minecraft:hard_glass";
|
||||||
public const HARD_GLASS_PANE = "minecraft:hard_glass_pane";
|
public const HARD_GLASS_PANE = "minecraft:hard_glass_pane";
|
||||||
public const HARD_STAINED_GLASS = "minecraft:hard_stained_glass";
|
public const HARD_GRAY_STAINED_GLASS = "minecraft:hard_gray_stained_glass";
|
||||||
public const HARD_STAINED_GLASS_PANE = "minecraft:hard_stained_glass_pane";
|
public const HARD_GRAY_STAINED_GLASS_PANE = "minecraft:hard_gray_stained_glass_pane";
|
||||||
|
public const HARD_GREEN_STAINED_GLASS = "minecraft:hard_green_stained_glass";
|
||||||
|
public const HARD_GREEN_STAINED_GLASS_PANE = "minecraft:hard_green_stained_glass_pane";
|
||||||
|
public const HARD_LIGHT_BLUE_STAINED_GLASS = "minecraft:hard_light_blue_stained_glass";
|
||||||
|
public const HARD_LIGHT_BLUE_STAINED_GLASS_PANE = "minecraft:hard_light_blue_stained_glass_pane";
|
||||||
|
public const HARD_LIGHT_GRAY_STAINED_GLASS = "minecraft:hard_light_gray_stained_glass";
|
||||||
|
public const HARD_LIGHT_GRAY_STAINED_GLASS_PANE = "minecraft:hard_light_gray_stained_glass_pane";
|
||||||
|
public const HARD_LIME_STAINED_GLASS = "minecraft:hard_lime_stained_glass";
|
||||||
|
public const HARD_LIME_STAINED_GLASS_PANE = "minecraft:hard_lime_stained_glass_pane";
|
||||||
|
public const HARD_MAGENTA_STAINED_GLASS = "minecraft:hard_magenta_stained_glass";
|
||||||
|
public const HARD_MAGENTA_STAINED_GLASS_PANE = "minecraft:hard_magenta_stained_glass_pane";
|
||||||
|
public const HARD_ORANGE_STAINED_GLASS = "minecraft:hard_orange_stained_glass";
|
||||||
|
public const HARD_ORANGE_STAINED_GLASS_PANE = "minecraft:hard_orange_stained_glass_pane";
|
||||||
|
public const HARD_PINK_STAINED_GLASS = "minecraft:hard_pink_stained_glass";
|
||||||
|
public const HARD_PINK_STAINED_GLASS_PANE = "minecraft:hard_pink_stained_glass_pane";
|
||||||
|
public const HARD_PURPLE_STAINED_GLASS = "minecraft:hard_purple_stained_glass";
|
||||||
|
public const HARD_PURPLE_STAINED_GLASS_PANE = "minecraft:hard_purple_stained_glass_pane";
|
||||||
|
public const HARD_RED_STAINED_GLASS = "minecraft:hard_red_stained_glass";
|
||||||
|
public const HARD_RED_STAINED_GLASS_PANE = "minecraft:hard_red_stained_glass_pane";
|
||||||
|
public const HARD_WHITE_STAINED_GLASS = "minecraft:hard_white_stained_glass";
|
||||||
|
public const HARD_WHITE_STAINED_GLASS_PANE = "minecraft:hard_white_stained_glass_pane";
|
||||||
|
public const HARD_YELLOW_STAINED_GLASS = "minecraft:hard_yellow_stained_glass";
|
||||||
|
public const HARD_YELLOW_STAINED_GLASS_PANE = "minecraft:hard_yellow_stained_glass_pane";
|
||||||
public const HARDENED_CLAY = "minecraft:hardened_clay";
|
public const HARDENED_CLAY = "minecraft:hardened_clay";
|
||||||
public const HAY_BLOCK = "minecraft:hay_block";
|
public const HAY_BLOCK = "minecraft:hay_block";
|
||||||
public const HEAVY_WEIGHTED_PRESSURE_PLATE = "minecraft:heavy_weighted_pressure_plate";
|
public const HEAVY_WEIGHTED_PRESSURE_PLATE = "minecraft:heavy_weighted_pressure_plate";
|
||||||
@ -900,6 +930,7 @@ final class BlockTypeNames{
|
|||||||
public const TORCHFLOWER_CROP = "minecraft:torchflower_crop";
|
public const TORCHFLOWER_CROP = "minecraft:torchflower_crop";
|
||||||
public const TRAPDOOR = "minecraft:trapdoor";
|
public const TRAPDOOR = "minecraft:trapdoor";
|
||||||
public const TRAPPED_CHEST = "minecraft:trapped_chest";
|
public const TRAPPED_CHEST = "minecraft:trapped_chest";
|
||||||
|
public const TRIAL_SPAWNER = "minecraft:trial_spawner";
|
||||||
public const TRIP_WIRE = "minecraft:trip_wire";
|
public const TRIP_WIRE = "minecraft:trip_wire";
|
||||||
public const TRIPWIRE_HOOK = "minecraft:tripwire_hook";
|
public const TRIPWIRE_HOOK = "minecraft:tripwire_hook";
|
||||||
public const TUBE_CORAL = "minecraft:tube_coral";
|
public const TUBE_CORAL = "minecraft:tube_coral";
|
||||||
|
@ -314,6 +314,44 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function registerFlatColorBlockSerializers() : void{
|
public function registerFlatColorBlockSerializers() : void{
|
||||||
|
$this->map(Blocks::STAINED_HARDENED_GLASS(), fn(StainedHardenedGlass $block) => Writer::create(match($block->getColor()){
|
||||||
|
DyeColor::BLACK => Ids::HARD_BLACK_STAINED_GLASS,
|
||||||
|
DyeColor::BLUE => Ids::HARD_BLUE_STAINED_GLASS,
|
||||||
|
DyeColor::BROWN => Ids::HARD_BROWN_STAINED_GLASS,
|
||||||
|
DyeColor::CYAN => Ids::HARD_CYAN_STAINED_GLASS,
|
||||||
|
DyeColor::GRAY => Ids::HARD_GRAY_STAINED_GLASS,
|
||||||
|
DyeColor::GREEN => Ids::HARD_GREEN_STAINED_GLASS,
|
||||||
|
DyeColor::LIGHT_BLUE => Ids::HARD_LIGHT_BLUE_STAINED_GLASS,
|
||||||
|
DyeColor::LIGHT_GRAY => Ids::HARD_LIGHT_GRAY_STAINED_GLASS,
|
||||||
|
DyeColor::LIME => Ids::HARD_LIME_STAINED_GLASS,
|
||||||
|
DyeColor::MAGENTA => Ids::HARD_MAGENTA_STAINED_GLASS,
|
||||||
|
DyeColor::ORANGE => Ids::HARD_ORANGE_STAINED_GLASS,
|
||||||
|
DyeColor::PINK => Ids::HARD_PINK_STAINED_GLASS,
|
||||||
|
DyeColor::PURPLE => Ids::HARD_PURPLE_STAINED_GLASS,
|
||||||
|
DyeColor::RED => Ids::HARD_RED_STAINED_GLASS,
|
||||||
|
DyeColor::WHITE => Ids::HARD_WHITE_STAINED_GLASS,
|
||||||
|
DyeColor::YELLOW => Ids::HARD_YELLOW_STAINED_GLASS,
|
||||||
|
}));
|
||||||
|
|
||||||
|
$this->map(Blocks::STAINED_HARDENED_GLASS_PANE(), fn(StainedHardenedGlassPane $block) => Writer::create(match($block->getColor()){
|
||||||
|
DyeColor::BLACK => Ids::HARD_BLACK_STAINED_GLASS_PANE,
|
||||||
|
DyeColor::BLUE => Ids::HARD_BLUE_STAINED_GLASS_PANE,
|
||||||
|
DyeColor::BROWN => Ids::HARD_BROWN_STAINED_GLASS_PANE,
|
||||||
|
DyeColor::CYAN => Ids::HARD_CYAN_STAINED_GLASS_PANE,
|
||||||
|
DyeColor::GRAY => Ids::HARD_GRAY_STAINED_GLASS_PANE,
|
||||||
|
DyeColor::GREEN => Ids::HARD_GREEN_STAINED_GLASS_PANE,
|
||||||
|
DyeColor::LIGHT_BLUE => Ids::HARD_LIGHT_BLUE_STAINED_GLASS_PANE,
|
||||||
|
DyeColor::LIGHT_GRAY => Ids::HARD_LIGHT_GRAY_STAINED_GLASS_PANE,
|
||||||
|
DyeColor::LIME => Ids::HARD_LIME_STAINED_GLASS_PANE,
|
||||||
|
DyeColor::MAGENTA => Ids::HARD_MAGENTA_STAINED_GLASS_PANE,
|
||||||
|
DyeColor::ORANGE => Ids::HARD_ORANGE_STAINED_GLASS_PANE,
|
||||||
|
DyeColor::PINK => Ids::HARD_PINK_STAINED_GLASS_PANE,
|
||||||
|
DyeColor::PURPLE => Ids::HARD_PURPLE_STAINED_GLASS_PANE,
|
||||||
|
DyeColor::RED => Ids::HARD_RED_STAINED_GLASS_PANE,
|
||||||
|
DyeColor::WHITE => Ids::HARD_WHITE_STAINED_GLASS_PANE,
|
||||||
|
DyeColor::YELLOW => Ids::HARD_YELLOW_STAINED_GLASS_PANE,
|
||||||
|
}));
|
||||||
|
|
||||||
$this->map(Blocks::GLAZED_TERRACOTTA(), function(GlazedTerracotta $block) : Writer{
|
$this->map(Blocks::GLAZED_TERRACOTTA(), function(GlazedTerracotta $block) : Writer{
|
||||||
return Writer::create(match($block->getColor()){
|
return Writer::create(match($block->getColor()){
|
||||||
DyeColor::BLACK => Ids::BLACK_GLAZED_TERRACOTTA,
|
DyeColor::BLACK => Ids::BLACK_GLAZED_TERRACOTTA,
|
||||||
@ -1616,14 +1654,6 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{
|
|||||||
->writeString(StateNames::SPONGE_TYPE, $block->isWet() ? StringValues::SPONGE_TYPE_WET : StringValues::SPONGE_TYPE_DRY);
|
->writeString(StateNames::SPONGE_TYPE, $block->isWet() ? StringValues::SPONGE_TYPE_WET : StringValues::SPONGE_TYPE_DRY);
|
||||||
});
|
});
|
||||||
$this->map(Blocks::SPRUCE_SAPLING(), fn(Sapling $block) => Helper::encodeSapling($block, StringValues::SAPLING_TYPE_SPRUCE));
|
$this->map(Blocks::SPRUCE_SAPLING(), fn(Sapling $block) => Helper::encodeSapling($block, StringValues::SAPLING_TYPE_SPRUCE));
|
||||||
$this->map(Blocks::STAINED_HARDENED_GLASS(), function(StainedHardenedGlass $block) : Writer{
|
|
||||||
return Writer::create(Ids::HARD_STAINED_GLASS)
|
|
||||||
->writeColor($block->getColor());
|
|
||||||
});
|
|
||||||
$this->map(Blocks::STAINED_HARDENED_GLASS_PANE(), function(StainedHardenedGlassPane $block) : Writer{
|
|
||||||
return Writer::create(Ids::HARD_STAINED_GLASS_PANE)
|
|
||||||
->writeColor($block->getColor());
|
|
||||||
});
|
|
||||||
$this->map(Blocks::STONECUTTER(), fn(Stonecutter $block) => Writer::create(Ids::STONECUTTER_BLOCK)
|
$this->map(Blocks::STONECUTTER(), fn(Stonecutter $block) => Writer::create(Ids::STONECUTTER_BLOCK)
|
||||||
->writeCardinalHorizontalFacing($block->getFacing()));
|
->writeCardinalHorizontalFacing($block->getFacing()));
|
||||||
$this->map(Blocks::STONE_BRICKS(), fn() => Helper::encodeStoneBricks(StringValues::STONE_BRICK_TYPE_DEFAULT));
|
$this->map(Blocks::STONE_BRICKS(), fn() => Helper::encodeStoneBricks(StringValues::STONE_BRICK_TYPE_DEFAULT));
|
||||||
|
@ -25,7 +25,6 @@ namespace pocketmine\data\bedrock\block\convert;
|
|||||||
|
|
||||||
use pocketmine\block\utils\BellAttachmentType;
|
use pocketmine\block\utils\BellAttachmentType;
|
||||||
use pocketmine\block\utils\CoralType;
|
use pocketmine\block\utils\CoralType;
|
||||||
use pocketmine\block\utils\DyeColor;
|
|
||||||
use pocketmine\block\utils\SlabType;
|
use pocketmine\block\utils\SlabType;
|
||||||
use pocketmine\block\utils\WallConnectionType;
|
use pocketmine\block\utils\WallConnectionType;
|
||||||
use pocketmine\data\bedrock\block\BlockLegacyMetadata;
|
use pocketmine\data\bedrock\block\BlockLegacyMetadata;
|
||||||
@ -236,30 +235,6 @@ final class BlockStateReader{
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @throws BlockStateDeserializeException */
|
|
||||||
public function readColor() : DyeColor{
|
|
||||||
// * color (StringTag) = black, blue, brown, cyan, gray, green, light_blue, lime, magenta, orange, pink, purple, red, silver, white, yellow
|
|
||||||
return match($color = $this->readString(BlockStateNames::COLOR)){
|
|
||||||
StringValues::COLOR_BLACK => DyeColor::BLACK,
|
|
||||||
StringValues::COLOR_BLUE => DyeColor::BLUE,
|
|
||||||
StringValues::COLOR_BROWN => DyeColor::BROWN,
|
|
||||||
StringValues::COLOR_CYAN => DyeColor::CYAN,
|
|
||||||
StringValues::COLOR_GRAY => DyeColor::GRAY,
|
|
||||||
StringValues::COLOR_GREEN => DyeColor::GREEN,
|
|
||||||
StringValues::COLOR_LIGHT_BLUE => DyeColor::LIGHT_BLUE,
|
|
||||||
StringValues::COLOR_LIME => DyeColor::LIME,
|
|
||||||
StringValues::COLOR_MAGENTA => DyeColor::MAGENTA,
|
|
||||||
StringValues::COLOR_ORANGE => DyeColor::ORANGE,
|
|
||||||
StringValues::COLOR_PINK => DyeColor::PINK,
|
|
||||||
StringValues::COLOR_PURPLE => DyeColor::PURPLE,
|
|
||||||
StringValues::COLOR_RED => DyeColor::RED,
|
|
||||||
StringValues::COLOR_SILVER => DyeColor::LIGHT_GRAY,
|
|
||||||
StringValues::COLOR_WHITE => DyeColor::WHITE,
|
|
||||||
StringValues::COLOR_YELLOW => DyeColor::YELLOW,
|
|
||||||
default => throw $this->badValueException(BlockStateNames::COLOR, $color),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @throws BlockStateDeserializeException */
|
/** @throws BlockStateDeserializeException */
|
||||||
public function readCoralFacing() : int{
|
public function readCoralFacing() : int{
|
||||||
return $this->parseFacingValue($this->readInt(BlockStateNames::CORAL_DIRECTION), [
|
return $this->parseFacingValue($this->readInt(BlockStateNames::CORAL_DIRECTION), [
|
||||||
|
@ -57,42 +57,42 @@ use pocketmine\math\Facing;
|
|||||||
|
|
||||||
final class BlockStateSerializerHelper{
|
final class BlockStateSerializerHelper{
|
||||||
|
|
||||||
public static function encodeAllSidedLog(Wood $block) : BlockStateWriter{
|
public static function encodeAllSidedLog(Wood $block) : Writer{
|
||||||
return BlockStateWriter::create(Ids::WOOD)
|
return Writer::create(Ids::WOOD)
|
||||||
->writeBool(BlockStateNames::STRIPPED_BIT, $block->isStripped())
|
->writeBool(BlockStateNames::STRIPPED_BIT, $block->isStripped())
|
||||||
->writePillarAxis($block->getAxis())
|
->writePillarAxis($block->getAxis())
|
||||||
->writeLegacyWoodType($block->getWoodType());
|
->writeLegacyWoodType($block->getWoodType());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeButton(Button $block, BlockStateWriter $out) : BlockStateWriter{
|
public static function encodeButton(Button $block, Writer $out) : Writer{
|
||||||
return $out
|
return $out
|
||||||
->writeFacingDirection($block->getFacing())
|
->writeFacingDirection($block->getFacing())
|
||||||
->writeBool(BlockStateNames::BUTTON_PRESSED_BIT, $block->isPressed());
|
->writeBool(BlockStateNames::BUTTON_PRESSED_BIT, $block->isPressed());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeCandle(Candle $block, BlockStateWriter $out) : BlockStateWriter{
|
public static function encodeCandle(Candle $block, Writer $out) : Writer{
|
||||||
return $out
|
return $out
|
||||||
->writeBool(StateNames::LIT, $block->isLit())
|
->writeBool(StateNames::LIT, $block->isLit())
|
||||||
->writeInt(StateNames::CANDLES, $block->getCount() - 1);
|
->writeInt(StateNames::CANDLES, $block->getCount() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeChemistryTable(ChemistryTable $block, string $chemistryTableType, BlockStateWriter $out) : BlockStateWriter{
|
public static function encodeChemistryTable(ChemistryTable $block, string $chemistryTableType, Writer $out) : Writer{
|
||||||
return $out
|
return $out
|
||||||
->writeString(BlockStateNames::CHEMISTRY_TABLE_TYPE, $chemistryTableType)
|
->writeString(BlockStateNames::CHEMISTRY_TABLE_TYPE, $chemistryTableType)
|
||||||
->writeLegacyHorizontalFacing(Facing::opposite($block->getFacing()));
|
->writeLegacyHorizontalFacing(Facing::opposite($block->getFacing()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeCrops(Crops $block, BlockStateWriter $out) : BlockStateWriter{
|
public static function encodeCrops(Crops $block, Writer $out) : Writer{
|
||||||
return $out->writeInt(BlockStateNames::GROWTH, $block->getAge());
|
return $out->writeInt(BlockStateNames::GROWTH, $block->getAge());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeColoredTorch(Torch $block, bool $highBit, BlockStateWriter $out) : BlockStateWriter{
|
public static function encodeColoredTorch(Torch $block, bool $highBit, Writer $out) : Writer{
|
||||||
return $out
|
return $out
|
||||||
->writeBool(BlockStateNames::COLOR_BIT, $highBit)
|
->writeBool(BlockStateNames::COLOR_BIT, $highBit)
|
||||||
->writeTorchFacing($block->getFacing());
|
->writeTorchFacing($block->getFacing());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeCauldron(string $liquid, int $fillLevel) : BlockStateWriter{
|
public static function encodeCauldron(string $liquid, int $fillLevel) : Writer{
|
||||||
return Writer::create(Ids::CAULDRON)
|
return Writer::create(Ids::CAULDRON)
|
||||||
->writeString(BlockStateNames::CAULDRON_LIQUID, $liquid)
|
->writeString(BlockStateNames::CAULDRON_LIQUID, $liquid)
|
||||||
->writeInt(BlockStateNames::FILL_LEVEL, $fillLevel);
|
->writeInt(BlockStateNames::FILL_LEVEL, $fillLevel);
|
||||||
@ -107,7 +107,7 @@ final class BlockStateSerializerHelper{
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeDoor(Door $block, BlockStateWriter $out) : BlockStateWriter{
|
public static function encodeDoor(Door $block, Writer $out) : Writer{
|
||||||
return $out
|
return $out
|
||||||
->writeBool(BlockStateNames::UPPER_BLOCK_BIT, $block->isTop())
|
->writeBool(BlockStateNames::UPPER_BLOCK_BIT, $block->isTop())
|
||||||
->writeLegacyHorizontalFacing(Facing::rotateY($block->getFacing(), true))
|
->writeLegacyHorizontalFacing(Facing::rotateY($block->getFacing(), true))
|
||||||
@ -115,111 +115,111 @@ final class BlockStateSerializerHelper{
|
|||||||
->writeBool(BlockStateNames::OPEN_BIT, $block->isOpen());
|
->writeBool(BlockStateNames::OPEN_BIT, $block->isOpen());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeDoublePlant(DoublePlant $block, string $doublePlantType, BlockStateWriter $out) : BlockStateWriter{
|
public static function encodeDoublePlant(DoublePlant $block, string $doublePlantType, Writer $out) : Writer{
|
||||||
return $out
|
return $out
|
||||||
->writeBool(BlockStateNames::UPPER_BLOCK_BIT, $block->isTop())
|
->writeBool(BlockStateNames::UPPER_BLOCK_BIT, $block->isTop())
|
||||||
->writeString(BlockStateNames::DOUBLE_PLANT_TYPE, $doublePlantType);
|
->writeString(BlockStateNames::DOUBLE_PLANT_TYPE, $doublePlantType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeFenceGate(FenceGate $block, BlockStateWriter $out) : BlockStateWriter{
|
public static function encodeFenceGate(FenceGate $block, Writer $out) : Writer{
|
||||||
return $out
|
return $out
|
||||||
->writeLegacyHorizontalFacing($block->getFacing())
|
->writeLegacyHorizontalFacing($block->getFacing())
|
||||||
->writeBool(BlockStateNames::IN_WALL_BIT, $block->isInWall())
|
->writeBool(BlockStateNames::IN_WALL_BIT, $block->isInWall())
|
||||||
->writeBool(BlockStateNames::OPEN_BIT, $block->isOpen());
|
->writeBool(BlockStateNames::OPEN_BIT, $block->isOpen());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeFloorSign(FloorSign $block, BlockStateWriter $out) : BlockStateWriter{
|
public static function encodeFloorSign(FloorSign $block, Writer $out) : Writer{
|
||||||
return $out
|
return $out
|
||||||
->writeInt(BlockStateNames::GROUND_SIGN_DIRECTION, $block->getRotation());
|
->writeInt(BlockStateNames::GROUND_SIGN_DIRECTION, $block->getRotation());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeFurnace(Furnace $block, string $unlitId, string $litId) : BlockStateWriter{
|
public static function encodeFurnace(Furnace $block, string $unlitId, string $litId) : Writer{
|
||||||
return BlockStateWriter::create($block->isLit() ? $litId : $unlitId)
|
return Writer::create($block->isLit() ? $litId : $unlitId)
|
||||||
->writeCardinalHorizontalFacing($block->getFacing());
|
->writeCardinalHorizontalFacing($block->getFacing());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeItemFrame(ItemFrame $block, string $id) : BlockStateWriter{
|
public static function encodeItemFrame(ItemFrame $block, string $id) : Writer{
|
||||||
return Writer::create($id)
|
return Writer::create($id)
|
||||||
->writeBool(StateNames::ITEM_FRAME_MAP_BIT, $block->hasMap())
|
->writeBool(StateNames::ITEM_FRAME_MAP_BIT, $block->hasMap())
|
||||||
->writeBool(StateNames::ITEM_FRAME_PHOTO_BIT, false)
|
->writeBool(StateNames::ITEM_FRAME_PHOTO_BIT, false)
|
||||||
->writeFacingDirection($block->getFacing());
|
->writeFacingDirection($block->getFacing());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeLeaves(Leaves $block, BlockStateWriter $out) : BlockStateWriter{
|
public static function encodeLeaves(Leaves $block, Writer $out) : Writer{
|
||||||
return $out
|
return $out
|
||||||
->writeBool(BlockStateNames::PERSISTENT_BIT, $block->isNoDecay())
|
->writeBool(BlockStateNames::PERSISTENT_BIT, $block->isNoDecay())
|
||||||
->writeBool(BlockStateNames::UPDATE_BIT, $block->isCheckDecay());
|
->writeBool(BlockStateNames::UPDATE_BIT, $block->isCheckDecay());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeLeaves1(Leaves $block, string $type) : BlockStateWriter{
|
public static function encodeLeaves1(Leaves $block, string $type) : Writer{
|
||||||
return self::encodeLeaves($block, BlockStateWriter::create(Ids::LEAVES)
|
return self::encodeLeaves($block, Writer::create(Ids::LEAVES)
|
||||||
->writeString(BlockStateNames::OLD_LEAF_TYPE, $type));
|
->writeString(BlockStateNames::OLD_LEAF_TYPE, $type));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeLeaves2(Leaves $block, string $type) : BlockStateWriter{
|
public static function encodeLeaves2(Leaves $block, string $type) : Writer{
|
||||||
return self::encodeLeaves($block, BlockStateWriter::create(Ids::LEAVES2)
|
return self::encodeLeaves($block, Writer::create(Ids::LEAVES2)
|
||||||
->writeString(BlockStateNames::NEW_LEAF_TYPE, $type));
|
->writeString(BlockStateNames::NEW_LEAF_TYPE, $type));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeLiquid(Liquid $block, string $stillId, string $flowingId) : BlockStateWriter{
|
public static function encodeLiquid(Liquid $block, string $stillId, string $flowingId) : Writer{
|
||||||
return BlockStateWriter::create($block->isStill() ? $stillId : $flowingId)
|
return Writer::create($block->isStill() ? $stillId : $flowingId)
|
||||||
->writeInt(BlockStateNames::LIQUID_DEPTH, $block->getDecay() | ($block->isFalling() ? 0x8 : 0));
|
->writeInt(BlockStateNames::LIQUID_DEPTH, $block->getDecay() | ($block->isFalling() ? 0x8 : 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeLog(Wood $block, string $unstrippedId, string $strippedId) : BlockStateWriter{
|
public static function encodeLog(Wood $block, string $unstrippedId, string $strippedId) : Writer{
|
||||||
$out = $block->isStripped() ?
|
$out = $block->isStripped() ?
|
||||||
BlockStateWriter::create($strippedId) :
|
Writer::create($strippedId) :
|
||||||
BlockStateWriter::create($unstrippedId);
|
Writer::create($unstrippedId);
|
||||||
return $out
|
return $out
|
||||||
->writePillarAxis($block->getAxis());
|
->writePillarAxis($block->getAxis());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeMushroomBlock(RedMushroomBlock $block, BlockStateWriter $out) : BlockStateWriter{
|
public static function encodeMushroomBlock(RedMushroomBlock $block, Writer $out) : Writer{
|
||||||
return $out
|
return $out
|
||||||
->writeInt(BlockStateNames::HUGE_MUSHROOM_BITS, MushroomBlockTypeIdMap::getInstance()->toId($block->getMushroomBlockType()));
|
->writeInt(BlockStateNames::HUGE_MUSHROOM_BITS, MushroomBlockTypeIdMap::getInstance()->toId($block->getMushroomBlockType()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeQuartz(string $type, int $axis) : BlockStateWriter{
|
public static function encodeQuartz(string $type, int $axis) : Writer{
|
||||||
return BlockStateWriter::create(Ids::QUARTZ_BLOCK)
|
return Writer::create(Ids::QUARTZ_BLOCK)
|
||||||
->writeString(BlockStateNames::CHISEL_TYPE, $type)
|
->writeString(BlockStateNames::CHISEL_TYPE, $type)
|
||||||
->writePillarAxis($axis); //this isn't needed for all types, but we have to write it anyway
|
->writePillarAxis($axis); //this isn't needed for all types, but we have to write it anyway
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeRedFlower(string $type) : BlockStateWriter{
|
public static function encodeRedFlower(string $type) : Writer{
|
||||||
return BlockStateWriter::create(Ids::RED_FLOWER)->writeString(BlockStateNames::FLOWER_TYPE, $type);
|
return Writer::create(Ids::RED_FLOWER)->writeString(BlockStateNames::FLOWER_TYPE, $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeSandstone(string $id, string $type) : BlockStateWriter{
|
public static function encodeSandstone(string $id, string $type) : Writer{
|
||||||
return BlockStateWriter::create($id)->writeString(BlockStateNames::SAND_STONE_TYPE, $type);
|
return Writer::create($id)->writeString(BlockStateNames::SAND_STONE_TYPE, $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeSapling(Sapling $block, string $type) : BlockStateWriter{
|
public static function encodeSapling(Sapling $block, string $type) : Writer{
|
||||||
return BlockStateWriter::create(Ids::SAPLING)
|
return Writer::create(Ids::SAPLING)
|
||||||
->writeBool(BlockStateNames::AGE_BIT, $block->isReady())
|
->writeBool(BlockStateNames::AGE_BIT, $block->isReady())
|
||||||
->writeString(BlockStateNames::SAPLING_TYPE, $type);
|
->writeString(BlockStateNames::SAPLING_TYPE, $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeSimplePressurePlate(SimplePressurePlate $block, BlockStateWriter $out) : BlockStateWriter{
|
public static function encodeSimplePressurePlate(SimplePressurePlate $block, Writer $out) : Writer{
|
||||||
//TODO: not sure what the deal is here ... seems like a mojang bug / artifact of bad implementation?
|
//TODO: not sure what the deal is here ... seems like a mojang bug / artifact of bad implementation?
|
||||||
//best to keep this separate from weighted plates anyway...
|
//best to keep this separate from weighted plates anyway...
|
||||||
return $out
|
return $out
|
||||||
->writeInt(BlockStateNames::REDSTONE_SIGNAL, $block->isPressed() ? 15 : 0);
|
->writeInt(BlockStateNames::REDSTONE_SIGNAL, $block->isPressed() ? 15 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeSlab(Slab $block, string $singleId, string $doubleId) : BlockStateWriter{
|
public static function encodeSlab(Slab $block, string $singleId, string $doubleId) : Writer{
|
||||||
$slabType = $block->getSlabType();
|
$slabType = $block->getSlabType();
|
||||||
return BlockStateWriter::create($slabType === SlabType::DOUBLE ? $doubleId : $singleId)
|
return Writer::create($slabType === SlabType::DOUBLE ? $doubleId : $singleId)
|
||||||
//this is (intentionally) also written for double slabs (as zero) to maintain bug parity with MCPE
|
//this is (intentionally) also written for double slabs (as zero) to maintain bug parity with MCPE
|
||||||
->writeSlabPosition($slabType === SlabType::DOUBLE ? SlabType::BOTTOM : $slabType);
|
->writeSlabPosition($slabType === SlabType::DOUBLE ? SlabType::BOTTOM : $slabType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeStairs(Stair $block, BlockStateWriter $out) : BlockStateWriter{
|
public static function encodeStairs(Stair $block, Writer $out) : Writer{
|
||||||
return $out
|
return $out
|
||||||
->writeBool(BlockStateNames::UPSIDE_DOWN_BIT, $block->isUpsideDown())
|
->writeBool(BlockStateNames::UPSIDE_DOWN_BIT, $block->isUpsideDown())
|
||||||
->writeWeirdoHorizontalFacing($block->getFacing());
|
->writeWeirdoHorizontalFacing($block->getFacing());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeStem(Stem $block, BlockStateWriter $out) : BlockStateWriter{
|
public static function encodeStem(Stem $block, Writer $out) : Writer{
|
||||||
//In PM, we use Facing::UP to indicate that the stem is not attached to a pumpkin/melon, since this makes the
|
//In PM, we use Facing::UP to indicate that the stem is not attached to a pumpkin/melon, since this makes the
|
||||||
//most intuitive sense (the stem is pointing at the sky). However, Bedrock uses the DOWN state for this, which
|
//most intuitive sense (the stem is pointing at the sky). However, Bedrock uses the DOWN state for this, which
|
||||||
//is absurd, and I refuse to make our API similarly absurd.
|
//is absurd, and I refuse to make our API similarly absurd.
|
||||||
@ -228,40 +228,40 @@ final class BlockStateSerializerHelper{
|
|||||||
->writeFacingWithoutUp($facing === Facing::UP ? Facing::DOWN : $facing);
|
->writeFacingWithoutUp($facing === Facing::UP ? Facing::DOWN : $facing);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeStoneBricks(string $type) : BlockStateWriter{
|
public static function encodeStoneBricks(string $type) : Writer{
|
||||||
return BlockStateWriter::create(Ids::STONEBRICK)
|
return Writer::create(Ids::STONEBRICK)
|
||||||
->writeString(BlockStateNames::STONE_BRICK_TYPE, $type);
|
->writeString(BlockStateNames::STONE_BRICK_TYPE, $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function encodeStoneSlab(Slab $block, string $singleId, string $doubleId, string $typeKey, string $typeValue) : BlockStateWriter{
|
private static function encodeStoneSlab(Slab $block, string $singleId, string $doubleId, string $typeKey, string $typeValue) : Writer{
|
||||||
return self::encodeSlab($block, $singleId, $doubleId)
|
return self::encodeSlab($block, $singleId, $doubleId)
|
||||||
->writeString($typeKey, $typeValue);
|
->writeString($typeKey, $typeValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeStoneSlab1(Slab $block, string $typeValue) : BlockStateWriter{
|
public static function encodeStoneSlab1(Slab $block, string $typeValue) : Writer{
|
||||||
return self::encodeStoneSlab($block, Ids::STONE_BLOCK_SLAB, Ids::DOUBLE_STONE_BLOCK_SLAB, BlockStateNames::STONE_SLAB_TYPE, $typeValue);
|
return self::encodeStoneSlab($block, Ids::STONE_BLOCK_SLAB, Ids::DOUBLE_STONE_BLOCK_SLAB, BlockStateNames::STONE_SLAB_TYPE, $typeValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeStoneSlab2(Slab $block, string $typeValue) : BlockStateWriter{
|
public static function encodeStoneSlab2(Slab $block, string $typeValue) : Writer{
|
||||||
return self::encodeStoneSlab($block, Ids::STONE_BLOCK_SLAB2, Ids::DOUBLE_STONE_BLOCK_SLAB2, BlockStateNames::STONE_SLAB_TYPE_2, $typeValue);
|
return self::encodeStoneSlab($block, Ids::STONE_BLOCK_SLAB2, Ids::DOUBLE_STONE_BLOCK_SLAB2, BlockStateNames::STONE_SLAB_TYPE_2, $typeValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeStoneSlab3(Slab $block, string $typeValue) : BlockStateWriter{
|
public static function encodeStoneSlab3(Slab $block, string $typeValue) : Writer{
|
||||||
return self::encodeStoneSlab($block, Ids::STONE_BLOCK_SLAB3, Ids::DOUBLE_STONE_BLOCK_SLAB3, BlockStateNames::STONE_SLAB_TYPE_3, $typeValue);
|
return self::encodeStoneSlab($block, Ids::STONE_BLOCK_SLAB3, Ids::DOUBLE_STONE_BLOCK_SLAB3, BlockStateNames::STONE_SLAB_TYPE_3, $typeValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeStoneSlab4(Slab $block, string $typeValue) : BlockStateWriter{
|
public static function encodeStoneSlab4(Slab $block, string $typeValue) : Writer{
|
||||||
return self::encodeStoneSlab($block, Ids::STONE_BLOCK_SLAB4, Ids::DOUBLE_STONE_BLOCK_SLAB4, BlockStateNames::STONE_SLAB_TYPE_4, $typeValue);
|
return self::encodeStoneSlab($block, Ids::STONE_BLOCK_SLAB4, Ids::DOUBLE_STONE_BLOCK_SLAB4, BlockStateNames::STONE_SLAB_TYPE_4, $typeValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeTrapdoor(Trapdoor $block, BlockStateWriter $out) : BlockStateWriter{
|
public static function encodeTrapdoor(Trapdoor $block, Writer $out) : Writer{
|
||||||
return $out
|
return $out
|
||||||
->write5MinusHorizontalFacing($block->getFacing())
|
->write5MinusHorizontalFacing($block->getFacing())
|
||||||
->writeBool(BlockStateNames::UPSIDE_DOWN_BIT, $block->isTop())
|
->writeBool(BlockStateNames::UPSIDE_DOWN_BIT, $block->isTop())
|
||||||
->writeBool(BlockStateNames::OPEN_BIT, $block->isOpen());
|
->writeBool(BlockStateNames::OPEN_BIT, $block->isOpen());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeWall(Wall $block, BlockStateWriter $out) : BlockStateWriter{
|
public static function encodeWall(Wall $block, Writer $out) : Writer{
|
||||||
return $out
|
return $out
|
||||||
->writeBool(BlockStateNames::WALL_POST_BIT, $block->isPost())
|
->writeBool(BlockStateNames::WALL_POST_BIT, $block->isPost())
|
||||||
->writeWallConnectionType(BlockStateNames::WALL_CONNECTION_TYPE_EAST, $block->getConnection(Facing::EAST))
|
->writeWallConnectionType(BlockStateNames::WALL_CONNECTION_TYPE_EAST, $block->getConnection(Facing::EAST))
|
||||||
@ -270,17 +270,17 @@ final class BlockStateSerializerHelper{
|
|||||||
->writeWallConnectionType(BlockStateNames::WALL_CONNECTION_TYPE_WEST, $block->getConnection(Facing::WEST));
|
->writeWallConnectionType(BlockStateNames::WALL_CONNECTION_TYPE_WEST, $block->getConnection(Facing::WEST));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeLegacyWall(Wall $block, string $type) : BlockStateWriter{
|
public static function encodeLegacyWall(Wall $block, string $type) : Writer{
|
||||||
return self::encodeWall($block, BlockStateWriter::create(Ids::COBBLESTONE_WALL))
|
return self::encodeWall($block, Writer::create(Ids::COBBLESTONE_WALL))
|
||||||
->writeString(BlockStateNames::WALL_BLOCK_TYPE, $type);
|
->writeString(BlockStateNames::WALL_BLOCK_TYPE, $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeWallSign(WallSign $block, BlockStateWriter $out) : BlockStateWriter{
|
public static function encodeWallSign(WallSign $block, Writer $out) : Writer{
|
||||||
return $out
|
return $out
|
||||||
->writeHorizontalFacing($block->getFacing());
|
->writeHorizontalFacing($block->getFacing());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function encodeWoodenSlab(Slab $block, string $typeValue) : BlockStateWriter{
|
public static function encodeWoodenSlab(Slab $block, string $typeValue) : Writer{
|
||||||
return self::encodeSlab($block, Ids::WOODEN_SLAB, Ids::DOUBLE_WOODEN_SLAB)
|
return self::encodeSlab($block, Ids::WOODEN_SLAB, Ids::DOUBLE_WOODEN_SLAB)
|
||||||
->writeString(BlockStateNames::WOOD_TYPE, $typeValue);
|
->writeString(BlockStateNames::WOOD_TYPE, $typeValue);
|
||||||
}
|
}
|
||||||
|
@ -185,6 +185,48 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function registerFlatColorBlockDeserializers() : void{
|
private function registerFlatColorBlockDeserializers() : void{
|
||||||
|
foreach([
|
||||||
|
Ids::HARD_BLACK_STAINED_GLASS => DyeColor::BLACK,
|
||||||
|
Ids::HARD_BLUE_STAINED_GLASS => DyeColor::BLUE,
|
||||||
|
Ids::HARD_BROWN_STAINED_GLASS => DyeColor::BROWN,
|
||||||
|
Ids::HARD_CYAN_STAINED_GLASS => DyeColor::CYAN,
|
||||||
|
Ids::HARD_GRAY_STAINED_GLASS => DyeColor::GRAY,
|
||||||
|
Ids::HARD_GREEN_STAINED_GLASS => DyeColor::GREEN,
|
||||||
|
Ids::HARD_LIGHT_BLUE_STAINED_GLASS => DyeColor::LIGHT_BLUE,
|
||||||
|
Ids::HARD_LIGHT_GRAY_STAINED_GLASS => DyeColor::LIGHT_GRAY,
|
||||||
|
Ids::HARD_LIME_STAINED_GLASS => DyeColor::LIME,
|
||||||
|
Ids::HARD_MAGENTA_STAINED_GLASS => DyeColor::MAGENTA,
|
||||||
|
Ids::HARD_ORANGE_STAINED_GLASS => DyeColor::ORANGE,
|
||||||
|
Ids::HARD_PINK_STAINED_GLASS => DyeColor::PINK,
|
||||||
|
Ids::HARD_PURPLE_STAINED_GLASS => DyeColor::PURPLE,
|
||||||
|
Ids::HARD_RED_STAINED_GLASS => DyeColor::RED,
|
||||||
|
Ids::HARD_WHITE_STAINED_GLASS => DyeColor::WHITE,
|
||||||
|
Ids::HARD_YELLOW_STAINED_GLASS => DyeColor::YELLOW,
|
||||||
|
] as $id => $color){
|
||||||
|
$this->map($id, fn(Reader $in) => Blocks::STAINED_HARDENED_GLASS()->setColor($color));
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach([
|
||||||
|
Ids::HARD_BLACK_STAINED_GLASS_PANE => DyeColor::BLACK,
|
||||||
|
Ids::HARD_BLUE_STAINED_GLASS_PANE => DyeColor::BLUE,
|
||||||
|
Ids::HARD_BROWN_STAINED_GLASS_PANE => DyeColor::BROWN,
|
||||||
|
Ids::HARD_CYAN_STAINED_GLASS_PANE => DyeColor::CYAN,
|
||||||
|
Ids::HARD_GRAY_STAINED_GLASS_PANE => DyeColor::GRAY,
|
||||||
|
Ids::HARD_GREEN_STAINED_GLASS_PANE => DyeColor::GREEN,
|
||||||
|
Ids::HARD_LIGHT_BLUE_STAINED_GLASS_PANE => DyeColor::LIGHT_BLUE,
|
||||||
|
Ids::HARD_LIGHT_GRAY_STAINED_GLASS_PANE => DyeColor::LIGHT_GRAY,
|
||||||
|
Ids::HARD_LIME_STAINED_GLASS_PANE => DyeColor::LIME,
|
||||||
|
Ids::HARD_MAGENTA_STAINED_GLASS_PANE => DyeColor::MAGENTA,
|
||||||
|
Ids::HARD_ORANGE_STAINED_GLASS_PANE => DyeColor::ORANGE,
|
||||||
|
Ids::HARD_PINK_STAINED_GLASS_PANE => DyeColor::PINK,
|
||||||
|
Ids::HARD_PURPLE_STAINED_GLASS_PANE => DyeColor::PURPLE,
|
||||||
|
Ids::HARD_RED_STAINED_GLASS_PANE => DyeColor::RED,
|
||||||
|
Ids::HARD_WHITE_STAINED_GLASS_PANE => DyeColor::WHITE,
|
||||||
|
Ids::HARD_YELLOW_STAINED_GLASS_PANE => DyeColor::YELLOW,
|
||||||
|
] as $id => $color){
|
||||||
|
$this->map($id, fn(Reader $in) => Blocks::STAINED_HARDENED_GLASS_PANE()->setColor($color));
|
||||||
|
}
|
||||||
|
|
||||||
foreach([
|
foreach([
|
||||||
Ids::BLACK_GLAZED_TERRACOTTA => DyeColor::BLACK,
|
Ids::BLACK_GLAZED_TERRACOTTA => DyeColor::BLACK,
|
||||||
Ids::BLUE_GLAZED_TERRACOTTA => DyeColor::BLUE,
|
Ids::BLUE_GLAZED_TERRACOTTA => DyeColor::BLUE,
|
||||||
@ -1159,14 +1201,6 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{
|
|||||||
->setShape($in->readBoundedInt(StateNames::RAIL_DIRECTION, 0, 5));
|
->setShape($in->readBoundedInt(StateNames::RAIL_DIRECTION, 0, 5));
|
||||||
});
|
});
|
||||||
$this->mapStairs(Ids::GRANITE_STAIRS, fn() => Blocks::GRANITE_STAIRS());
|
$this->mapStairs(Ids::GRANITE_STAIRS, fn() => Blocks::GRANITE_STAIRS());
|
||||||
$this->map(Ids::HARD_STAINED_GLASS, function(Reader $in) : Block{
|
|
||||||
return Blocks::STAINED_HARDENED_GLASS()
|
|
||||||
->setColor($in->readColor());
|
|
||||||
});
|
|
||||||
$this->map(Ids::HARD_STAINED_GLASS_PANE, function(Reader $in) : Block{
|
|
||||||
return Blocks::STAINED_HARDENED_GLASS_PANE()
|
|
||||||
->setColor($in->readColor());
|
|
||||||
});
|
|
||||||
$this->map(Ids::HAY_BLOCK, function(Reader $in) : Block{
|
$this->map(Ids::HAY_BLOCK, function(Reader $in) : Block{
|
||||||
$in->ignored(StateNames::DEPRECATED);
|
$in->ignored(StateNames::DEPRECATED);
|
||||||
return Blocks::HAY_BALE()->setAxis($in->readPillarAxis());
|
return Blocks::HAY_BALE()->setAxis($in->readPillarAxis());
|
||||||
|
@ -25,7 +25,6 @@ namespace pocketmine\data\bedrock\block\convert;
|
|||||||
|
|
||||||
use pocketmine\block\utils\BellAttachmentType;
|
use pocketmine\block\utils\BellAttachmentType;
|
||||||
use pocketmine\block\utils\CoralType;
|
use pocketmine\block\utils\CoralType;
|
||||||
use pocketmine\block\utils\DyeColor;
|
|
||||||
use pocketmine\block\utils\SlabType;
|
use pocketmine\block\utils\SlabType;
|
||||||
use pocketmine\block\utils\WallConnectionType;
|
use pocketmine\block\utils\WallConnectionType;
|
||||||
use pocketmine\block\utils\WoodType;
|
use pocketmine\block\utils\WoodType;
|
||||||
@ -193,29 +192,6 @@ final class BlockStateWriter{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return $this */
|
|
||||||
public function writeColor(DyeColor $color) : self{
|
|
||||||
$this->writeString(BlockStateNames::COLOR, match($color){
|
|
||||||
DyeColor::BLACK => StringValues::COLOR_BLACK,
|
|
||||||
DyeColor::BLUE => StringValues::COLOR_BLUE,
|
|
||||||
DyeColor::BROWN => StringValues::COLOR_BROWN,
|
|
||||||
DyeColor::CYAN => StringValues::COLOR_CYAN,
|
|
||||||
DyeColor::GRAY => StringValues::COLOR_GRAY,
|
|
||||||
DyeColor::GREEN => StringValues::COLOR_GREEN,
|
|
||||||
DyeColor::LIGHT_BLUE => StringValues::COLOR_LIGHT_BLUE,
|
|
||||||
DyeColor::LIGHT_GRAY => StringValues::COLOR_SILVER,
|
|
||||||
DyeColor::LIME => StringValues::COLOR_LIME,
|
|
||||||
DyeColor::MAGENTA => StringValues::COLOR_MAGENTA,
|
|
||||||
DyeColor::ORANGE => StringValues::COLOR_ORANGE,
|
|
||||||
DyeColor::PINK => StringValues::COLOR_PINK,
|
|
||||||
DyeColor::PURPLE => StringValues::COLOR_PURPLE,
|
|
||||||
DyeColor::RED => StringValues::COLOR_RED,
|
|
||||||
DyeColor::WHITE => StringValues::COLOR_WHITE,
|
|
||||||
DyeColor::YELLOW => StringValues::COLOR_YELLOW,
|
|
||||||
});
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @return $this */
|
/** @return $this */
|
||||||
public function writeCoralFacing(int $value) : self{
|
public function writeCoralFacing(int $value) : self{
|
||||||
$this->writeInt(BlockStateNames::CORAL_DIRECTION, match($value){
|
$this->writeInt(BlockStateNames::CORAL_DIRECTION, match($value){
|
||||||
|
@ -348,7 +348,7 @@ final class ItemSerializerDeserializerRegistrar{
|
|||||||
$this->map1to1Item(Ids::RIB_ARMOR_TRIM_SMITHING_TEMPLATE, Items::RIB_ARMOR_TRIM_SMITHING_TEMPLATE());
|
$this->map1to1Item(Ids::RIB_ARMOR_TRIM_SMITHING_TEMPLATE, Items::RIB_ARMOR_TRIM_SMITHING_TEMPLATE());
|
||||||
$this->map1to1Item(Ids::ROTTEN_FLESH, Items::ROTTEN_FLESH());
|
$this->map1to1Item(Ids::ROTTEN_FLESH, Items::ROTTEN_FLESH());
|
||||||
$this->map1to1Item(Ids::SALMON, Items::RAW_SALMON());
|
$this->map1to1Item(Ids::SALMON, Items::RAW_SALMON());
|
||||||
$this->map1to1Item(Ids::SCUTE, Items::SCUTE());
|
$this->map1to1Item(Ids::TURTLE_SCUTE, Items::SCUTE());
|
||||||
$this->map1to1Item(Ids::SENTRY_ARMOR_TRIM_SMITHING_TEMPLATE, Items::SENTRY_ARMOR_TRIM_SMITHING_TEMPLATE());
|
$this->map1to1Item(Ids::SENTRY_ARMOR_TRIM_SMITHING_TEMPLATE, Items::SENTRY_ARMOR_TRIM_SMITHING_TEMPLATE());
|
||||||
$this->map1to1Item(Ids::SHAPER_ARMOR_TRIM_SMITHING_TEMPLATE, Items::SHAPER_ARMOR_TRIM_SMITHING_TEMPLATE());
|
$this->map1to1Item(Ids::SHAPER_ARMOR_TRIM_SMITHING_TEMPLATE, Items::SHAPER_ARMOR_TRIM_SMITHING_TEMPLATE());
|
||||||
$this->map1to1Item(Ids::SHEARS, Items::SHEARS());
|
$this->map1to1Item(Ids::SHEARS, Items::SHEARS());
|
||||||
|
@ -38,6 +38,8 @@ final class ItemTypeNames{
|
|||||||
public const ANGLER_POTTERY_SHERD = "minecraft:angler_pottery_sherd";
|
public const ANGLER_POTTERY_SHERD = "minecraft:angler_pottery_sherd";
|
||||||
public const APPLE = "minecraft:apple";
|
public const APPLE = "minecraft:apple";
|
||||||
public const ARCHER_POTTERY_SHERD = "minecraft:archer_pottery_sherd";
|
public const ARCHER_POTTERY_SHERD = "minecraft:archer_pottery_sherd";
|
||||||
|
public const ARMADILLO_SCUTE = "minecraft:armadillo_scute";
|
||||||
|
public const ARMADILLO_SPAWN_EGG = "minecraft:armadillo_spawn_egg";
|
||||||
public const ARMOR_STAND = "minecraft:armor_stand";
|
public const ARMOR_STAND = "minecraft:armor_stand";
|
||||||
public const ARMS_UP_POTTERY_SHERD = "minecraft:arms_up_pottery_sherd";
|
public const ARMS_UP_POTTERY_SHERD = "minecraft:arms_up_pottery_sherd";
|
||||||
public const ARROW = "minecraft:arrow";
|
public const ARROW = "minecraft:arrow";
|
||||||
@ -79,6 +81,7 @@ final class ItemTypeNames{
|
|||||||
public const BOW = "minecraft:bow";
|
public const BOW = "minecraft:bow";
|
||||||
public const BOWL = "minecraft:bowl";
|
public const BOWL = "minecraft:bowl";
|
||||||
public const BREAD = "minecraft:bread";
|
public const BREAD = "minecraft:bread";
|
||||||
|
public const BREEZE_SPAWN_EGG = "minecraft:breeze_spawn_egg";
|
||||||
public const BREWER_POTTERY_SHERD = "minecraft:brewer_pottery_sherd";
|
public const BREWER_POTTERY_SHERD = "minecraft:brewer_pottery_sherd";
|
||||||
public const BREWING_STAND = "minecraft:brewing_stand";
|
public const BREWING_STAND = "minecraft:brewing_stand";
|
||||||
public const BRICK = "minecraft:brick";
|
public const BRICK = "minecraft:brick";
|
||||||
@ -238,6 +241,8 @@ final class ItemTypeNames{
|
|||||||
public const GREEN_DYE = "minecraft:green_dye";
|
public const GREEN_DYE = "minecraft:green_dye";
|
||||||
public const GUARDIAN_SPAWN_EGG = "minecraft:guardian_spawn_egg";
|
public const GUARDIAN_SPAWN_EGG = "minecraft:guardian_spawn_egg";
|
||||||
public const GUNPOWDER = "minecraft:gunpowder";
|
public const GUNPOWDER = "minecraft:gunpowder";
|
||||||
|
public const HARD_STAINED_GLASS = "minecraft:hard_stained_glass";
|
||||||
|
public const HARD_STAINED_GLASS_PANE = "minecraft:hard_stained_glass_pane";
|
||||||
public const HEART_OF_THE_SEA = "minecraft:heart_of_the_sea";
|
public const HEART_OF_THE_SEA = "minecraft:heart_of_the_sea";
|
||||||
public const HEART_POTTERY_SHERD = "minecraft:heart_pottery_sherd";
|
public const HEART_POTTERY_SHERD = "minecraft:heart_pottery_sherd";
|
||||||
public const HEARTBREAK_POTTERY_SHERD = "minecraft:heartbreak_pottery_sherd";
|
public const HEARTBREAK_POTTERY_SHERD = "minecraft:heartbreak_pottery_sherd";
|
||||||
@ -404,7 +409,6 @@ final class ItemTypeNames{
|
|||||||
public const SALMON = "minecraft:salmon";
|
public const SALMON = "minecraft:salmon";
|
||||||
public const SALMON_BUCKET = "minecraft:salmon_bucket";
|
public const SALMON_BUCKET = "minecraft:salmon_bucket";
|
||||||
public const SALMON_SPAWN_EGG = "minecraft:salmon_spawn_egg";
|
public const SALMON_SPAWN_EGG = "minecraft:salmon_spawn_egg";
|
||||||
public const SCUTE = "minecraft:scute";
|
|
||||||
public const SENTRY_ARMOR_TRIM_SMITHING_TEMPLATE = "minecraft:sentry_armor_trim_smithing_template";
|
public const SENTRY_ARMOR_TRIM_SMITHING_TEMPLATE = "minecraft:sentry_armor_trim_smithing_template";
|
||||||
public const SHAPER_ARMOR_TRIM_SMITHING_TEMPLATE = "minecraft:shaper_armor_trim_smithing_template";
|
public const SHAPER_ARMOR_TRIM_SMITHING_TEMPLATE = "minecraft:shaper_armor_trim_smithing_template";
|
||||||
public const SHEAF_POTTERY_SHERD = "minecraft:sheaf_pottery_sherd";
|
public const SHEAF_POTTERY_SHERD = "minecraft:sheaf_pottery_sherd";
|
||||||
@ -466,11 +470,13 @@ final class ItemTypeNames{
|
|||||||
public const TORCHFLOWER_SEEDS = "minecraft:torchflower_seeds";
|
public const TORCHFLOWER_SEEDS = "minecraft:torchflower_seeds";
|
||||||
public const TOTEM_OF_UNDYING = "minecraft:totem_of_undying";
|
public const TOTEM_OF_UNDYING = "minecraft:totem_of_undying";
|
||||||
public const TRADER_LLAMA_SPAWN_EGG = "minecraft:trader_llama_spawn_egg";
|
public const TRADER_LLAMA_SPAWN_EGG = "minecraft:trader_llama_spawn_egg";
|
||||||
|
public const TRIAL_KEY = "minecraft:trial_key";
|
||||||
public const TRIDENT = "minecraft:trident";
|
public const TRIDENT = "minecraft:trident";
|
||||||
public const TROPICAL_FISH = "minecraft:tropical_fish";
|
public const TROPICAL_FISH = "minecraft:tropical_fish";
|
||||||
public const TROPICAL_FISH_BUCKET = "minecraft:tropical_fish_bucket";
|
public const TROPICAL_FISH_BUCKET = "minecraft:tropical_fish_bucket";
|
||||||
public const TROPICAL_FISH_SPAWN_EGG = "minecraft:tropical_fish_spawn_egg";
|
public const TROPICAL_FISH_SPAWN_EGG = "minecraft:tropical_fish_spawn_egg";
|
||||||
public const TURTLE_HELMET = "minecraft:turtle_helmet";
|
public const TURTLE_HELMET = "minecraft:turtle_helmet";
|
||||||
|
public const TURTLE_SCUTE = "minecraft:turtle_scute";
|
||||||
public const TURTLE_SPAWN_EGG = "minecraft:turtle_spawn_egg";
|
public const TURTLE_SPAWN_EGG = "minecraft:turtle_spawn_egg";
|
||||||
public const VEX_ARMOR_TRIM_SMITHING_TEMPLATE = "minecraft:vex_armor_trim_smithing_template";
|
public const VEX_ARMOR_TRIM_SMITHING_TEMPLATE = "minecraft:vex_armor_trim_smithing_template";
|
||||||
public const VEX_SPAWN_EGG = "minecraft:vex_spawn_egg";
|
public const VEX_SPAWN_EGG = "minecraft:vex_spawn_egg";
|
||||||
@ -497,6 +503,7 @@ final class ItemTypeNames{
|
|||||||
public const WITCH_SPAWN_EGG = "minecraft:witch_spawn_egg";
|
public const WITCH_SPAWN_EGG = "minecraft:witch_spawn_egg";
|
||||||
public const WITHER_SKELETON_SPAWN_EGG = "minecraft:wither_skeleton_spawn_egg";
|
public const WITHER_SKELETON_SPAWN_EGG = "minecraft:wither_skeleton_spawn_egg";
|
||||||
public const WITHER_SPAWN_EGG = "minecraft:wither_spawn_egg";
|
public const WITHER_SPAWN_EGG = "minecraft:wither_spawn_egg";
|
||||||
|
public const WOLF_ARMOR = "minecraft:wolf_armor";
|
||||||
public const WOLF_SPAWN_EGG = "minecraft:wolf_spawn_egg";
|
public const WOLF_SPAWN_EGG = "minecraft:wolf_spawn_egg";
|
||||||
public const WOODEN_AXE = "minecraft:wooden_axe";
|
public const WOODEN_AXE = "minecraft:wooden_axe";
|
||||||
public const WOODEN_DOOR = "minecraft:wooden_door";
|
public const WOODEN_DOOR = "minecraft:wooden_door";
|
||||||
|
@ -44,10 +44,14 @@ final class GameModeIdMap{
|
|||||||
private array $enumToId = [];
|
private array $enumToId = [];
|
||||||
|
|
||||||
public function __construct(){
|
public function __construct(){
|
||||||
$this->register(0, GameMode::SURVIVAL);
|
foreach(GameMode::cases() as $case){
|
||||||
$this->register(1, GameMode::CREATIVE);
|
$this->register(match($case){
|
||||||
$this->register(2, GameMode::ADVENTURE);
|
GameMode::SURVIVAL => 0,
|
||||||
$this->register(3, GameMode::SPECTATOR);
|
GameMode::CREATIVE => 1,
|
||||||
|
GameMode::ADVENTURE => 2,
|
||||||
|
GameMode::SPECTATOR => 3,
|
||||||
|
}, $case);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function register(int $id, GameMode $type) : void{
|
private function register(int $id, GameMode $type) : void{
|
||||||
|
@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
namespace pocketmine\item;
|
namespace pocketmine\item;
|
||||||
|
|
||||||
use pocketmine\block\Block;
|
use pocketmine\block\Block;
|
||||||
|
use pocketmine\block\BlockTypeIds;
|
||||||
use pocketmine\data\runtime\RuntimeDataDescriber;
|
use pocketmine\data\runtime\RuntimeDataDescriber;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -58,4 +59,12 @@ final class ItemBlock extends Item{
|
|||||||
public function getMaxStackSize() : int{
|
public function getMaxStackSize() : int{
|
||||||
return $this->block->getMaxStackSize();
|
return $this->block->getMaxStackSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isNull() : bool{
|
||||||
|
//TODO: we really shouldn't need to treat air as a special case here
|
||||||
|
//this is needed because the "null" empty slot item is represented by an air block, but there's no real reason
|
||||||
|
//why air should be needed at all. A separate special item type (or actual null) should be used instead, but
|
||||||
|
//this would cause a lot of BC breaks, so we can't do it yet.
|
||||||
|
return parent::isNull() || $this->block->getTypeId() === BlockTypeIds::AIR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,12 +30,14 @@ use pocketmine\network\mcpe\protocol\LevelChunkPacket;
|
|||||||
use pocketmine\network\mcpe\protocol\serializer\PacketBatch;
|
use pocketmine\network\mcpe\protocol\serializer\PacketBatch;
|
||||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializerContext;
|
use pocketmine\network\mcpe\protocol\serializer\PacketSerializerContext;
|
||||||
use pocketmine\network\mcpe\protocol\types\ChunkPosition;
|
use pocketmine\network\mcpe\protocol\types\ChunkPosition;
|
||||||
|
use pocketmine\network\mcpe\protocol\types\DimensionIds;
|
||||||
use pocketmine\network\mcpe\serializer\ChunkSerializer;
|
use pocketmine\network\mcpe\serializer\ChunkSerializer;
|
||||||
use pocketmine\scheduler\AsyncTask;
|
use pocketmine\scheduler\AsyncTask;
|
||||||
use pocketmine\thread\NonThreadSafeValue;
|
use pocketmine\thread\NonThreadSafeValue;
|
||||||
use pocketmine\utils\BinaryStream;
|
use pocketmine\utils\BinaryStream;
|
||||||
use pocketmine\world\format\Chunk;
|
use pocketmine\world\format\Chunk;
|
||||||
use pocketmine\world\format\io\FastChunkSerializer;
|
use pocketmine\world\format\io\FastChunkSerializer;
|
||||||
|
use function chr;
|
||||||
|
|
||||||
class ChunkRequestTask extends AsyncTask{
|
class ChunkRequestTask extends AsyncTask{
|
||||||
private const TLS_KEY_PROMISE = "promise";
|
private const TLS_KEY_PROMISE = "promise";
|
||||||
@ -43,16 +45,22 @@ class ChunkRequestTask extends AsyncTask{
|
|||||||
protected string $chunk;
|
protected string $chunk;
|
||||||
protected int $chunkX;
|
protected int $chunkX;
|
||||||
protected int $chunkZ;
|
protected int $chunkZ;
|
||||||
|
/** @phpstan-var DimensionIds::* */
|
||||||
|
private int $dimensionId;
|
||||||
/** @phpstan-var NonThreadSafeValue<Compressor> */
|
/** @phpstan-var NonThreadSafeValue<Compressor> */
|
||||||
protected NonThreadSafeValue $compressor;
|
protected NonThreadSafeValue $compressor;
|
||||||
private string $tiles;
|
private string $tiles;
|
||||||
|
|
||||||
public function __construct(int $chunkX, int $chunkZ, Chunk $chunk, CompressBatchPromise $promise, Compressor $compressor){
|
/**
|
||||||
|
* @phpstan-param DimensionIds::* $dimensionId
|
||||||
|
*/
|
||||||
|
public function __construct(int $chunkX, int $chunkZ, int $dimensionId, Chunk $chunk, CompressBatchPromise $promise, Compressor $compressor){
|
||||||
$this->compressor = new NonThreadSafeValue($compressor);
|
$this->compressor = new NonThreadSafeValue($compressor);
|
||||||
|
|
||||||
$this->chunk = FastChunkSerializer::serializeTerrain($chunk);
|
$this->chunk = FastChunkSerializer::serializeTerrain($chunk);
|
||||||
$this->chunkX = $chunkX;
|
$this->chunkX = $chunkX;
|
||||||
$this->chunkZ = $chunkZ;
|
$this->chunkZ = $chunkZ;
|
||||||
|
$this->dimensionId = $dimensionId;
|
||||||
$this->tiles = ChunkSerializer::serializeTiles($chunk);
|
$this->tiles = ChunkSerializer::serializeTiles($chunk);
|
||||||
|
|
||||||
$this->storeLocal(self::TLS_KEY_PROMISE, $promise);
|
$this->storeLocal(self::TLS_KEY_PROMISE, $promise);
|
||||||
@ -60,14 +68,18 @@ class ChunkRequestTask extends AsyncTask{
|
|||||||
|
|
||||||
public function onRun() : void{
|
public function onRun() : void{
|
||||||
$chunk = FastChunkSerializer::deserializeTerrain($this->chunk);
|
$chunk = FastChunkSerializer::deserializeTerrain($this->chunk);
|
||||||
$subCount = ChunkSerializer::getSubChunkCount($chunk);
|
$dimensionId = $this->dimensionId;
|
||||||
|
|
||||||
|
$subCount = ChunkSerializer::getSubChunkCount($chunk, $dimensionId);
|
||||||
$converter = TypeConverter::getInstance();
|
$converter = TypeConverter::getInstance();
|
||||||
$encoderContext = new PacketSerializerContext($converter->getItemTypeDictionary());
|
$encoderContext = new PacketSerializerContext($converter->getItemTypeDictionary());
|
||||||
$payload = ChunkSerializer::serializeFullChunk($chunk, $converter->getBlockTranslator(), $encoderContext, $this->tiles);
|
$payload = ChunkSerializer::serializeFullChunk($chunk, $dimensionId, $converter->getBlockTranslator(), $encoderContext, $this->tiles);
|
||||||
|
|
||||||
$stream = new BinaryStream();
|
$stream = new BinaryStream();
|
||||||
PacketBatch::encodePackets($stream, $encoderContext, [LevelChunkPacket::create(new ChunkPosition($this->chunkX, $this->chunkZ), $subCount, false, null, $payload)]);
|
PacketBatch::encodePackets($stream, $encoderContext, [LevelChunkPacket::create(new ChunkPosition($this->chunkX, $this->chunkZ), $dimensionId, $subCount, false, null, $payload)]);
|
||||||
$this->setResult($this->compressor->deserialize()->compress($stream->getBuffer()));
|
|
||||||
|
$compressor = $this->compressor->deserialize();
|
||||||
|
$this->setResult(chr($compressor->getNetworkId()) . $compressor->compress($stream->getBuffer()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onCompletion() : void{
|
public function onCompletion() : void{
|
||||||
|
@ -86,6 +86,7 @@ use pocketmine\network\mcpe\protocol\types\command\CommandEnum;
|
|||||||
use pocketmine\network\mcpe\protocol\types\command\CommandOverload;
|
use pocketmine\network\mcpe\protocol\types\command\CommandOverload;
|
||||||
use pocketmine\network\mcpe\protocol\types\command\CommandParameter;
|
use pocketmine\network\mcpe\protocol\types\command\CommandParameter;
|
||||||
use pocketmine\network\mcpe\protocol\types\command\CommandPermissions;
|
use pocketmine\network\mcpe\protocol\types\command\CommandPermissions;
|
||||||
|
use pocketmine\network\mcpe\protocol\types\CompressionAlgorithm;
|
||||||
use pocketmine\network\mcpe\protocol\types\DimensionIds;
|
use pocketmine\network\mcpe\protocol\types\DimensionIds;
|
||||||
use pocketmine\network\mcpe\protocol\types\PlayerListEntry;
|
use pocketmine\network\mcpe\protocol\types\PlayerListEntry;
|
||||||
use pocketmine\network\mcpe\protocol\types\PlayerPermissions;
|
use pocketmine\network\mcpe\protocol\types\PlayerPermissions;
|
||||||
@ -119,6 +120,7 @@ use function implode;
|
|||||||
use function in_array;
|
use function in_array;
|
||||||
use function is_string;
|
use function is_string;
|
||||||
use function json_encode;
|
use function json_encode;
|
||||||
|
use function ord;
|
||||||
use function random_bytes;
|
use function random_bytes;
|
||||||
use function str_split;
|
use function str_split;
|
||||||
use function strcasecmp;
|
use function strcasecmp;
|
||||||
@ -355,15 +357,27 @@ class NetworkSession{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(strlen($payload) < 1){
|
||||||
|
throw new PacketHandlingException("No bytes in payload");
|
||||||
|
}
|
||||||
|
|
||||||
if($this->enableCompression){
|
if($this->enableCompression){
|
||||||
Timings::$playerNetworkReceiveDecompress->startTiming();
|
Timings::$playerNetworkReceiveDecompress->startTiming();
|
||||||
try{
|
$compressionType = ord($payload[0]);
|
||||||
$decompressed = $this->compressor->decompress($payload);
|
$compressed = substr($payload, 1);
|
||||||
}catch(DecompressionException $e){
|
if($compressionType === CompressionAlgorithm::NONE){
|
||||||
$this->logger->debug("Failed to decompress packet: " . base64_encode($payload));
|
$decompressed = $compressed;
|
||||||
throw PacketHandlingException::wrap($e, "Compressed packet batch decode error");
|
}elseif($compressionType === $this->compressor->getNetworkId()){
|
||||||
}finally{
|
try{
|
||||||
Timings::$playerNetworkReceiveDecompress->stopTiming();
|
$decompressed = $this->compressor->decompress($compressed);
|
||||||
|
}catch(DecompressionException $e){
|
||||||
|
$this->logger->debug("Failed to decompress packet: " . base64_encode($compressed));
|
||||||
|
throw PacketHandlingException::wrap($e, "Compressed packet batch decode error");
|
||||||
|
}finally{
|
||||||
|
Timings::$playerNetworkReceiveDecompress->stopTiming();
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
throw new PacketHandlingException("Packet compressed with unexpected compression type $compressionType");
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$decompressed = $payload;
|
$decompressed = $payload;
|
||||||
|
@ -39,16 +39,6 @@ use function time;
|
|||||||
class ProcessLoginTask extends AsyncTask{
|
class ProcessLoginTask extends AsyncTask{
|
||||||
private const TLS_KEY_ON_COMPLETION = "completion";
|
private const TLS_KEY_ON_COMPLETION = "completion";
|
||||||
|
|
||||||
/**
|
|
||||||
* Old Mojang root auth key. This was used since the introduction of Xbox Live authentication in 0.15.0.
|
|
||||||
* This key is expected to be replaced by the key below in the future, but this has not yet happened as of
|
|
||||||
* 2023-07-01.
|
|
||||||
* Ideally we would place a time expiry on this key, but since Mojang have not given a hard date for the key change,
|
|
||||||
* and one bad guess has already caused a major outage, we can't do this.
|
|
||||||
* TODO: This needs to be removed as soon as the new key is deployed by Mojang's authentication servers.
|
|
||||||
*/
|
|
||||||
public const MOJANG_OLD_ROOT_PUBLIC_KEY = "MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE8ELkixyLcwlZryUQcu1TvPOmI2B7vX83ndnWRUaXm74wFfa5f/lwQNTfrLVHa2PmenpGI6JhIMUJaWZrjmMj90NoKNFSNBuKdm8rYiXsfaz3K36x/1U26HpG0ZxK/V1V";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* New Mojang root auth key. Mojang notified third-party developers of this change prior to the release of 1.20.0.
|
* New Mojang root auth key. Mojang notified third-party developers of this change prior to the release of 1.20.0.
|
||||||
* Expectations were that this would be used starting a "couple of weeks" after the release, but as of 2023-07-01,
|
* Expectations were that this would be used starting a "couple of weeks" after the release, but as of 2023-07-01,
|
||||||
@ -170,7 +160,7 @@ class ProcessLoginTask extends AsyncTask{
|
|||||||
throw new VerifyLoginException($e->getMessage(), null, 0, $e);
|
throw new VerifyLoginException($e->getMessage(), null, 0, $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($headers->x5u === self::MOJANG_ROOT_PUBLIC_KEY || $headers->x5u === self::MOJANG_OLD_ROOT_PUBLIC_KEY){
|
if($headers->x5u === self::MOJANG_ROOT_PUBLIC_KEY){
|
||||||
$this->authenticated = true; //we're signed into xbox live
|
$this->authenticated = true; //we're signed into xbox live
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
src/network/mcpe/cache/ChunkCache.php
vendored
2
src/network/mcpe/cache/ChunkCache.php
vendored
@ -27,6 +27,7 @@ use pocketmine\math\Vector3;
|
|||||||
use pocketmine\network\mcpe\ChunkRequestTask;
|
use pocketmine\network\mcpe\ChunkRequestTask;
|
||||||
use pocketmine\network\mcpe\compression\CompressBatchPromise;
|
use pocketmine\network\mcpe\compression\CompressBatchPromise;
|
||||||
use pocketmine\network\mcpe\compression\Compressor;
|
use pocketmine\network\mcpe\compression\Compressor;
|
||||||
|
use pocketmine\network\mcpe\protocol\types\DimensionIds;
|
||||||
use pocketmine\world\ChunkListener;
|
use pocketmine\world\ChunkListener;
|
||||||
use pocketmine\world\ChunkListenerNoOpTrait;
|
use pocketmine\world\ChunkListenerNoOpTrait;
|
||||||
use pocketmine\world\format\Chunk;
|
use pocketmine\world\format\Chunk;
|
||||||
@ -116,6 +117,7 @@ class ChunkCache implements ChunkListener{
|
|||||||
new ChunkRequestTask(
|
new ChunkRequestTask(
|
||||||
$chunkX,
|
$chunkX,
|
||||||
$chunkZ,
|
$chunkZ,
|
||||||
|
DimensionIds::OVERWORLD, //TODO: not hardcode this
|
||||||
$chunk,
|
$chunk,
|
||||||
$this->caches[$chunkHash],
|
$this->caches[$chunkHash],
|
||||||
$this->compressor
|
$this->compressor
|
||||||
|
@ -25,6 +25,7 @@ namespace pocketmine\network\mcpe\compression;
|
|||||||
|
|
||||||
use pocketmine\scheduler\AsyncTask;
|
use pocketmine\scheduler\AsyncTask;
|
||||||
use pocketmine\thread\NonThreadSafeValue;
|
use pocketmine\thread\NonThreadSafeValue;
|
||||||
|
use function chr;
|
||||||
|
|
||||||
class CompressBatchTask extends AsyncTask{
|
class CompressBatchTask extends AsyncTask{
|
||||||
|
|
||||||
@ -43,7 +44,8 @@ class CompressBatchTask extends AsyncTask{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function onRun() : void{
|
public function onRun() : void{
|
||||||
$this->setResult($this->compressor->deserialize()->compress($this->data));
|
$compressor = $this->compressor->deserialize();
|
||||||
|
$this->setResult(chr($compressor->getNetworkId()) . $compressor->compress($this->data));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onCompletion() : void{
|
public function onCompletion() : void{
|
||||||
|
@ -23,6 +23,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace pocketmine\network\mcpe\compression;
|
namespace pocketmine\network\mcpe\compression;
|
||||||
|
|
||||||
|
use pocketmine\network\mcpe\protocol\types\CompressionAlgorithm;
|
||||||
|
|
||||||
interface Compressor{
|
interface Compressor{
|
||||||
/**
|
/**
|
||||||
* @throws DecompressionException
|
* @throws DecompressionException
|
||||||
@ -31,6 +33,14 @@ interface Compressor{
|
|||||||
|
|
||||||
public function compress(string $payload) : string;
|
public function compress(string $payload) : string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the canonical ID of this compressor, used to tell the remote end how to decompress a packet compressed
|
||||||
|
* with this compressor.
|
||||||
|
*
|
||||||
|
* @return CompressionAlgorithm::*
|
||||||
|
*/
|
||||||
|
public function getNetworkId() : int;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the minimum size of packet batch that the compressor will attempt to compress.
|
* Returns the minimum size of packet batch that the compressor will attempt to compress.
|
||||||
*
|
*
|
||||||
|
@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace pocketmine\network\mcpe\compression;
|
namespace pocketmine\network\mcpe\compression;
|
||||||
|
|
||||||
|
use pocketmine\network\mcpe\protocol\types\CompressionAlgorithm;
|
||||||
use pocketmine\utils\SingletonTrait;
|
use pocketmine\utils\SingletonTrait;
|
||||||
use pocketmine\utils\Utils;
|
use pocketmine\utils\Utils;
|
||||||
use function function_exists;
|
use function function_exists;
|
||||||
@ -75,4 +76,8 @@ final class ZlibCompressor implements Compressor{
|
|||||||
libdeflate_deflate_compress($payload, $level) :
|
libdeflate_deflate_compress($payload, $level) :
|
||||||
Utils::assumeNotFalse(zlib_encode($payload, ZLIB_ENCODING_RAW, $level), "ZLIB compression failed");
|
Utils::assumeNotFalse(zlib_encode($payload, ZLIB_ENCODING_RAW, $level), "ZLIB compression failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNetworkId() : int{
|
||||||
|
return CompressionAlgorithm::ZLIB;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,6 @@ use pocketmine\network\mcpe\NetworkSession;
|
|||||||
use pocketmine\network\mcpe\protocol\NetworkSettingsPacket;
|
use pocketmine\network\mcpe\protocol\NetworkSettingsPacket;
|
||||||
use pocketmine\network\mcpe\protocol\ProtocolInfo;
|
use pocketmine\network\mcpe\protocol\ProtocolInfo;
|
||||||
use pocketmine\network\mcpe\protocol\RequestNetworkSettingsPacket;
|
use pocketmine\network\mcpe\protocol\RequestNetworkSettingsPacket;
|
||||||
use pocketmine\network\mcpe\protocol\types\CompressionAlgorithm;
|
|
||||||
|
|
||||||
final class SessionStartPacketHandler extends PacketHandler{
|
final class SessionStartPacketHandler extends PacketHandler{
|
||||||
|
|
||||||
@ -50,7 +49,7 @@ final class SessionStartPacketHandler extends PacketHandler{
|
|||||||
//TODO: we're filling in the defaults to get pre-1.19.30 behaviour back for now, but we should explore the new options in the future
|
//TODO: we're filling in the defaults to get pre-1.19.30 behaviour back for now, but we should explore the new options in the future
|
||||||
$this->session->sendDataPacket(NetworkSettingsPacket::create(
|
$this->session->sendDataPacket(NetworkSettingsPacket::create(
|
||||||
NetworkSettingsPacket::COMPRESS_EVERYTHING,
|
NetworkSettingsPacket::COMPRESS_EVERYTHING,
|
||||||
CompressionAlgorithm::ZLIB,
|
$this->session->getCompressor()->getNetworkId(),
|
||||||
false,
|
false,
|
||||||
0,
|
0,
|
||||||
0
|
0
|
||||||
|
@ -31,6 +31,7 @@ use pocketmine\network\mcpe\convert\BlockTranslator;
|
|||||||
use pocketmine\network\mcpe\protocol\serializer\NetworkNbtSerializer;
|
use pocketmine\network\mcpe\protocol\serializer\NetworkNbtSerializer;
|
||||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializerContext;
|
use pocketmine\network\mcpe\protocol\serializer\PacketSerializerContext;
|
||||||
|
use pocketmine\network\mcpe\protocol\types\DimensionIds;
|
||||||
use pocketmine\utils\Binary;
|
use pocketmine\utils\Binary;
|
||||||
use pocketmine\utils\BinaryStream;
|
use pocketmine\utils\BinaryStream;
|
||||||
use pocketmine\world\format\Chunk;
|
use pocketmine\world\format\Chunk;
|
||||||
@ -43,12 +44,34 @@ final class ChunkSerializer{
|
|||||||
//NOOP
|
//NOOP
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the min/max subchunk index expected in the protocol.
|
||||||
|
* This has no relation to the world height supported by PM.
|
||||||
|
*
|
||||||
|
* @phpstan-param DimensionIds::* $dimensionId
|
||||||
|
* @return int[]
|
||||||
|
* @phpstan-return array{int, int}
|
||||||
|
*/
|
||||||
|
public static function getDimensionChunkBounds(int $dimensionId) : array{
|
||||||
|
return match($dimensionId){
|
||||||
|
DimensionIds::OVERWORLD => [-4, 19],
|
||||||
|
DimensionIds::NETHER => [0, 7],
|
||||||
|
DimensionIds::THE_END => [0, 15],
|
||||||
|
default => throw new \InvalidArgumentException("Unknown dimension ID $dimensionId"),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of subchunks that will be sent from the given chunk.
|
* Returns the number of subchunks that will be sent from the given chunk.
|
||||||
* Chunks are sent in a stack, so every chunk below the top non-empty one must be sent.
|
* Chunks are sent in a stack, so every chunk below the top non-empty one must be sent.
|
||||||
|
*
|
||||||
|
* @phpstan-param DimensionIds::* $dimensionId
|
||||||
*/
|
*/
|
||||||
public static function getSubChunkCount(Chunk $chunk) : int{
|
public static function getSubChunkCount(Chunk $chunk, int $dimensionId) : int{
|
||||||
for($y = Chunk::MAX_SUBCHUNK_INDEX, $count = count($chunk->getSubChunks()); $y >= Chunk::MIN_SUBCHUNK_INDEX; --$y, --$count){
|
//if the protocol world bounds ever exceed the PM supported bounds again in the future, we might need to
|
||||||
|
//polyfill some stuff here
|
||||||
|
[$minSubChunkIndex, $maxSubChunkIndex] = self::getDimensionChunkBounds($dimensionId);
|
||||||
|
for($y = $maxSubChunkIndex, $count = $maxSubChunkIndex - $minSubChunkIndex + 1; $y >= $minSubChunkIndex; --$y, --$count){
|
||||||
if($chunk->getSubChunk($y)->isEmptyFast()){
|
if($chunk->getSubChunk($y)->isEmptyFast()){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -58,18 +81,23 @@ final class ChunkSerializer{
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function serializeFullChunk(Chunk $chunk, BlockTranslator $blockTranslator, PacketSerializerContext $encoderContext, ?string $tiles = null) : string{
|
/**
|
||||||
|
* @phpstan-param DimensionIds::* $dimensionId
|
||||||
|
*/
|
||||||
|
public static function serializeFullChunk(Chunk $chunk, int $dimensionId, BlockTranslator $blockTranslator, PacketSerializerContext $encoderContext, ?string $tiles = null) : string{
|
||||||
$stream = PacketSerializer::encoder($encoderContext);
|
$stream = PacketSerializer::encoder($encoderContext);
|
||||||
|
|
||||||
$subChunkCount = self::getSubChunkCount($chunk);
|
$subChunkCount = self::getSubChunkCount($chunk, $dimensionId);
|
||||||
$writtenCount = 0;
|
$writtenCount = 0;
|
||||||
for($y = Chunk::MIN_SUBCHUNK_INDEX; $writtenCount < $subChunkCount; ++$y, ++$writtenCount){
|
|
||||||
|
[$minSubChunkIndex, $maxSubChunkIndex] = self::getDimensionChunkBounds($dimensionId);
|
||||||
|
for($y = $minSubChunkIndex; $writtenCount < $subChunkCount; ++$y, ++$writtenCount){
|
||||||
self::serializeSubChunk($chunk->getSubChunk($y), $blockTranslator, $stream, false);
|
self::serializeSubChunk($chunk->getSubChunk($y), $blockTranslator, $stream, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
$biomeIdMap = LegacyBiomeIdToStringIdMap::getInstance();
|
$biomeIdMap = LegacyBiomeIdToStringIdMap::getInstance();
|
||||||
//all biomes must always be written :(
|
//all biomes must always be written :(
|
||||||
for($y = Chunk::MIN_SUBCHUNK_INDEX; $y <= Chunk::MAX_SUBCHUNK_INDEX; ++$y){
|
for($y = $minSubChunkIndex; $y <= $maxSubChunkIndex; ++$y){
|
||||||
self::serializeBiomePalette($chunk->getSubChunk($y)->getBiomeArray(), $biomeIdMap, $stream);
|
self::serializeBiomePalette($chunk->getSubChunk($y)->getBiomeArray(), $biomeIdMap, $stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace pocketmine\promise;
|
namespace pocketmine\promise;
|
||||||
|
|
||||||
|
use function count;
|
||||||
use function spl_object_id;
|
use function spl_object_id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -57,4 +58,53 @@ final class Promise{
|
|||||||
//rejected or just hasn't been resolved yet
|
//rejected or just hasn't been resolved yet
|
||||||
return $this->shared->state === true;
|
return $this->shared->state === true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a promise that will resolve only once all the Promises in
|
||||||
|
* `$promises` have resolved. The resolution value of the returned promise
|
||||||
|
* will be an array containing the resolution values of each Promises in
|
||||||
|
* `$promises` indexed by the respective Promises' array keys.
|
||||||
|
*
|
||||||
|
* @param Promise[] $promises
|
||||||
|
*
|
||||||
|
* @phpstan-template TPromiseValue
|
||||||
|
* @phpstan-template TKey of array-key
|
||||||
|
* @phpstan-param non-empty-array<TKey, Promise<TPromiseValue>> $promises
|
||||||
|
*
|
||||||
|
* @phpstan-return Promise<array<TKey, TPromiseValue>>
|
||||||
|
*/
|
||||||
|
public static function all(array $promises) : Promise{
|
||||||
|
if(count($promises) === 0){
|
||||||
|
throw new \InvalidArgumentException("At least one promise must be provided");
|
||||||
|
}
|
||||||
|
/** @phpstan-var PromiseResolver<array<TKey, TPromiseValue>> $resolver */
|
||||||
|
$resolver = new PromiseResolver();
|
||||||
|
$values = [];
|
||||||
|
$toResolve = count($promises);
|
||||||
|
$continue = true;
|
||||||
|
|
||||||
|
foreach($promises as $key => $promise){
|
||||||
|
$promise->onCompletion(
|
||||||
|
function(mixed $value) use ($resolver, $key, $toResolve, &$values) : void{
|
||||||
|
$values[$key] = $value;
|
||||||
|
|
||||||
|
if(count($values) === $toResolve){
|
||||||
|
$resolver->resolve($values);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
function() use ($resolver, &$continue) : void{
|
||||||
|
if($continue){
|
||||||
|
$continue = false;
|
||||||
|
$resolver->reject();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if(!$continue){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $resolver->getPromise();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,12 +24,10 @@ declare(strict_types=1);
|
|||||||
namespace pocketmine\scheduler;
|
namespace pocketmine\scheduler;
|
||||||
|
|
||||||
use pmmp\thread\Runnable;
|
use pmmp\thread\Runnable;
|
||||||
use pmmp\thread\Thread as NativeThread;
|
|
||||||
use pmmp\thread\ThreadSafe;
|
use pmmp\thread\ThreadSafe;
|
||||||
use pmmp\thread\ThreadSafeArray;
|
use pmmp\thread\ThreadSafeArray;
|
||||||
use pocketmine\thread\NonThreadSafeValue;
|
use pocketmine\thread\NonThreadSafeValue;
|
||||||
use function array_key_exists;
|
use function array_key_exists;
|
||||||
use function assert;
|
|
||||||
use function igbinary_serialize;
|
use function igbinary_serialize;
|
||||||
use function igbinary_unserialize;
|
use function igbinary_unserialize;
|
||||||
use function is_null;
|
use function is_null;
|
||||||
@ -83,9 +81,7 @@ abstract class AsyncTask extends Runnable{
|
|||||||
$this->onRun();
|
$this->onRun();
|
||||||
|
|
||||||
$this->finished = true;
|
$this->finished = true;
|
||||||
$worker = NativeThread::getCurrentThread();
|
AsyncWorker::getNotifier()->wakeupSleeper();
|
||||||
assert($worker instanceof AsyncWorker);
|
|
||||||
$worker->getNotifier()->wakeupSleeper();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -36,7 +36,7 @@ class AsyncWorker extends Worker{
|
|||||||
/** @var mixed[] */
|
/** @var mixed[] */
|
||||||
private static array $store = [];
|
private static array $store = [];
|
||||||
|
|
||||||
private const TLS_KEY_NOTIFIER = self::class . "::notifier";
|
private static ?SleeperNotifier $notifier = null;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private ThreadSafeLogger $logger,
|
private ThreadSafeLogger $logger,
|
||||||
@ -45,12 +45,11 @@ class AsyncWorker extends Worker{
|
|||||||
private SleeperHandlerEntry $sleeperEntry
|
private SleeperHandlerEntry $sleeperEntry
|
||||||
){}
|
){}
|
||||||
|
|
||||||
public function getNotifier() : SleeperNotifier{
|
public static function getNotifier() : SleeperNotifier{
|
||||||
$notifier = $this->getFromThreadStore(self::TLS_KEY_NOTIFIER);
|
if(self::$notifier !== null){
|
||||||
if(!$notifier instanceof SleeperNotifier){
|
return self::$notifier;
|
||||||
throw new AssumptionFailedError("SleeperNotifier not found in thread-local storage");
|
|
||||||
}
|
}
|
||||||
return $notifier;
|
throw new AssumptionFailedError("SleeperNotifier not found in thread-local storage");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function onRun() : void{
|
protected function onRun() : void{
|
||||||
@ -66,7 +65,7 @@ class AsyncWorker extends Worker{
|
|||||||
$this->logger->debug("No memory limit set");
|
$this->logger->debug("No memory limit set");
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->saveToThreadStore(self::TLS_KEY_NOTIFIER, $this->sleeperEntry->createNotifier());
|
self::$notifier = $this->sleeperEntry->createNotifier();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLogger() : ThreadSafeLogger{
|
public function getLogger() : ThreadSafeLogger{
|
||||||
@ -84,6 +83,8 @@ class AsyncWorker extends Worker{
|
|||||||
/**
|
/**
|
||||||
* Saves mixed data into the worker's thread-local object store. This can be used to store objects which you
|
* Saves mixed data into the worker's thread-local object store. This can be used to store objects which you
|
||||||
* want to use on this worker thread from multiple AsyncTasks.
|
* want to use on this worker thread from multiple AsyncTasks.
|
||||||
|
*
|
||||||
|
* @deprecated Use static class properties instead.
|
||||||
*/
|
*/
|
||||||
public function saveToThreadStore(string $identifier, mixed $value) : void{
|
public function saveToThreadStore(string $identifier, mixed $value) : void{
|
||||||
if(NativeThread::getCurrentThread() !== $this){
|
if(NativeThread::getCurrentThread() !== $this){
|
||||||
@ -99,6 +100,8 @@ class AsyncWorker extends Worker{
|
|||||||
* account for the possibility that what you're trying to retrieve might not exist.
|
* account for the possibility that what you're trying to retrieve might not exist.
|
||||||
*
|
*
|
||||||
* Objects stored in this storage may ONLY be retrieved while the task is running.
|
* Objects stored in this storage may ONLY be retrieved while the task is running.
|
||||||
|
*
|
||||||
|
* @deprecated Use static class properties instead.
|
||||||
*/
|
*/
|
||||||
public function getFromThreadStore(string $identifier) : mixed{
|
public function getFromThreadStore(string $identifier) : mixed{
|
||||||
if(NativeThread::getCurrentThread() !== $this){
|
if(NativeThread::getCurrentThread() !== $this){
|
||||||
@ -109,6 +112,8 @@ class AsyncWorker extends Worker{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes previously-stored mixed data from the worker's thread-local object store.
|
* Removes previously-stored mixed data from the worker's thread-local object store.
|
||||||
|
*
|
||||||
|
* @deprecated Use static class properties instead.
|
||||||
*/
|
*/
|
||||||
public function removeFromThreadStore(string $identifier) : void{
|
public function removeFromThreadStore(string $identifier) : void{
|
||||||
if(NativeThread::getCurrentThread() !== $this){
|
if(NativeThread::getCurrentThread() !== $this){
|
||||||
|
@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace pocketmine\thread;
|
namespace pocketmine\thread;
|
||||||
|
|
||||||
|
use pmmp\thread\Thread as NativeThread;
|
||||||
use pmmp\thread\ThreadSafeArray;
|
use pmmp\thread\ThreadSafeArray;
|
||||||
use pocketmine\errorhandler\ErrorToExceptionHandler;
|
use pocketmine\errorhandler\ErrorToExceptionHandler;
|
||||||
use pocketmine\Server;
|
use pocketmine\Server;
|
||||||
@ -77,9 +78,7 @@ trait CommonThreadPartsTrait{
|
|||||||
/**
|
/**
|
||||||
* Registers the class loaders for this thread.
|
* Registers the class loaders for this thread.
|
||||||
*
|
*
|
||||||
* WARNING: This method MUST be called from any descendent threads' run() method to make autoloading usable.
|
* @internal
|
||||||
* If you do not do this, you will not be able to use new classes that were not loaded when the thread was started
|
|
||||||
* (unless you are using a custom autoloader).
|
|
||||||
*/
|
*/
|
||||||
public function registerClassLoaders() : void{
|
public function registerClassLoaders() : void{
|
||||||
if($this->composerAutoloaderPath !== null){
|
if($this->composerAutoloaderPath !== null){
|
||||||
@ -96,6 +95,15 @@ trait CommonThreadPartsTrait{
|
|||||||
|
|
||||||
public function getCrashInfo() : ?ThreadCrashInfo{ return $this->crashInfo; }
|
public function getCrashInfo() : ?ThreadCrashInfo{ return $this->crashInfo; }
|
||||||
|
|
||||||
|
public function start(int $options = NativeThread::INHERIT_NONE) : bool{
|
||||||
|
ThreadManager::getInstance()->add($this);
|
||||||
|
|
||||||
|
if($this->getClassLoaders() === null){
|
||||||
|
$this->setClassLoaders();
|
||||||
|
}
|
||||||
|
return parent::start($options);
|
||||||
|
}
|
||||||
|
|
||||||
final public function run() : void{
|
final public function run() : void{
|
||||||
error_reporting(-1);
|
error_reporting(-1);
|
||||||
$this->registerClassLoaders();
|
$this->registerClassLoaders();
|
||||||
@ -110,6 +118,20 @@ trait CommonThreadPartsTrait{
|
|||||||
$this->isKilled = true;
|
$this->isKilled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stops the thread using the best way possible. Try to stop it yourself before calling this.
|
||||||
|
*/
|
||||||
|
public function quit() : void{
|
||||||
|
$this->isKilled = true;
|
||||||
|
|
||||||
|
if(!$this->isJoined()){
|
||||||
|
$this->notify();
|
||||||
|
$this->join();
|
||||||
|
}
|
||||||
|
|
||||||
|
ThreadManager::getInstance()->remove($this);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called by set_exception_handler() when an uncaught exception is thrown.
|
* Called by set_exception_handler() when an uncaught exception is thrown.
|
||||||
*/
|
*/
|
||||||
|
@ -37,28 +37,4 @@ use pocketmine\scheduler\AsyncTask;
|
|||||||
*/
|
*/
|
||||||
abstract class Thread extends NativeThread{
|
abstract class Thread extends NativeThread{
|
||||||
use CommonThreadPartsTrait;
|
use CommonThreadPartsTrait;
|
||||||
|
|
||||||
public function start(int $options = NativeThread::INHERIT_NONE) : bool{
|
|
||||||
//this is intentionally not traitified
|
|
||||||
ThreadManager::getInstance()->add($this);
|
|
||||||
|
|
||||||
if($this->getClassLoaders() === null){
|
|
||||||
$this->setClassLoaders();
|
|
||||||
}
|
|
||||||
return parent::start($options);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stops the thread using the best way possible. Try to stop it yourself before calling this.
|
|
||||||
*/
|
|
||||||
public function quit() : void{
|
|
||||||
$this->isKilled = true;
|
|
||||||
|
|
||||||
if(!$this->isJoined()){
|
|
||||||
$this->notify();
|
|
||||||
$this->join();
|
|
||||||
}
|
|
||||||
|
|
||||||
ThreadManager::getInstance()->remove($this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -51,12 +51,12 @@ class ThreadSafeClassLoader extends ThreadSafe{
|
|||||||
* @var ThreadSafeArray|string[]
|
* @var ThreadSafeArray|string[]
|
||||||
* @phpstan-var ThreadSafeArray<int, string>
|
* @phpstan-var ThreadSafeArray<int, string>
|
||||||
*/
|
*/
|
||||||
private $fallbackLookup;
|
private ThreadSafeArray $fallbackLookup;
|
||||||
/**
|
/**
|
||||||
* @var ThreadSafeArray|string[][]
|
* @var ThreadSafeArray|string[][]
|
||||||
* @phpstan-var ThreadSafeArray<string, ThreadSafeArray<int, string>>
|
* @phpstan-var ThreadSafeArray<string, ThreadSafeArray<int, string>>
|
||||||
*/
|
*/
|
||||||
private $psr4Lookup;
|
private ThreadSafeArray $psr4Lookup;
|
||||||
|
|
||||||
public function __construct(){
|
public function __construct(){
|
||||||
$this->fallbackLookup = new ThreadSafeArray();
|
$this->fallbackLookup = new ThreadSafeArray();
|
||||||
|
@ -23,7 +23,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace pocketmine\thread;
|
namespace pocketmine\thread;
|
||||||
|
|
||||||
use pmmp\thread\Thread as NativeThread;
|
|
||||||
use pmmp\thread\Worker as NativeWorker;
|
use pmmp\thread\Worker as NativeWorker;
|
||||||
use pocketmine\scheduler\AsyncTask;
|
use pocketmine\scheduler\AsyncTask;
|
||||||
|
|
||||||
@ -39,31 +38,4 @@ use pocketmine\scheduler\AsyncTask;
|
|||||||
*/
|
*/
|
||||||
abstract class Worker extends NativeWorker{
|
abstract class Worker extends NativeWorker{
|
||||||
use CommonThreadPartsTrait;
|
use CommonThreadPartsTrait;
|
||||||
|
|
||||||
public function start(int $options = NativeThread::INHERIT_NONE) : bool{
|
|
||||||
//this is intentionally not traitified
|
|
||||||
ThreadManager::getInstance()->add($this);
|
|
||||||
|
|
||||||
if($this->getClassLoaders() === null){
|
|
||||||
$this->setClassLoaders();
|
|
||||||
}
|
|
||||||
return parent::start($options);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stops the thread using the best way possible. Try to stop it yourself before calling this.
|
|
||||||
*/
|
|
||||||
public function quit() : void{
|
|
||||||
$this->isKilled = true;
|
|
||||||
|
|
||||||
if(!$this->isShutdown()){
|
|
||||||
$this->synchronized(function() : void{
|
|
||||||
while($this->unstack() !== null);
|
|
||||||
});
|
|
||||||
$this->notify();
|
|
||||||
$this->shutdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
ThreadManager::getInstance()->remove($this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace pocketmine\utils;
|
namespace pocketmine\utils;
|
||||||
|
|
||||||
use LogLevel;
|
|
||||||
use pmmp\thread\Thread as NativeThread;
|
use pmmp\thread\Thread as NativeThread;
|
||||||
use pocketmine\thread\log\AttachableThreadSafeLogger;
|
use pocketmine\thread\log\AttachableThreadSafeLogger;
|
||||||
use pocketmine\thread\log\ThreadSafeLoggerAttachment;
|
use pocketmine\thread\log\ThreadSafeLoggerAttachment;
|
||||||
@ -132,28 +131,28 @@ class MainLogger extends AttachableThreadSafeLogger implements \BufferedLogger{
|
|||||||
|
|
||||||
public function log($level, $message){
|
public function log($level, $message){
|
||||||
switch($level){
|
switch($level){
|
||||||
case LogLevel::EMERGENCY:
|
case \LogLevel::EMERGENCY:
|
||||||
$this->emergency($message);
|
$this->emergency($message);
|
||||||
break;
|
break;
|
||||||
case LogLevel::ALERT:
|
case \LogLevel::ALERT:
|
||||||
$this->alert($message);
|
$this->alert($message);
|
||||||
break;
|
break;
|
||||||
case LogLevel::CRITICAL:
|
case \LogLevel::CRITICAL:
|
||||||
$this->critical($message);
|
$this->critical($message);
|
||||||
break;
|
break;
|
||||||
case LogLevel::ERROR:
|
case \LogLevel::ERROR:
|
||||||
$this->error($message);
|
$this->error($message);
|
||||||
break;
|
break;
|
||||||
case LogLevel::WARNING:
|
case \LogLevel::WARNING:
|
||||||
$this->warning($message);
|
$this->warning($message);
|
||||||
break;
|
break;
|
||||||
case LogLevel::NOTICE:
|
case \LogLevel::NOTICE:
|
||||||
$this->notice($message);
|
$this->notice($message);
|
||||||
break;
|
break;
|
||||||
case LogLevel::INFO:
|
case \LogLevel::INFO:
|
||||||
$this->info($message);
|
$this->info($message);
|
||||||
break;
|
break;
|
||||||
case LogLevel::DEBUG:
|
case \LogLevel::DEBUG:
|
||||||
$this->debug($message);
|
$this->debug($message);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,8 @@ declare(strict_types=1);
|
|||||||
namespace pocketmine\utils;
|
namespace pocketmine\utils;
|
||||||
|
|
||||||
use pocketmine\thread\Thread;
|
use pocketmine\thread\Thread;
|
||||||
use function time;
|
use function hrtime;
|
||||||
|
use function intdiv;
|
||||||
|
|
||||||
class ServerKiller extends Thread{
|
class ServerKiller extends Thread{
|
||||||
private bool $stopped = false;
|
private bool $stopped = false;
|
||||||
@ -34,13 +35,15 @@ class ServerKiller extends Thread{
|
|||||||
){}
|
){}
|
||||||
|
|
||||||
protected function onRun() : void{
|
protected function onRun() : void{
|
||||||
$start = time();
|
$start = hrtime(true);
|
||||||
$this->synchronized(function() : void{
|
$remaining = $this->time * 1_000_000;
|
||||||
if(!$this->stopped){
|
$this->synchronized(function() use (&$remaining, $start) : void{
|
||||||
$this->wait($this->time * 1000000);
|
while(!$this->stopped && $remaining > 0){
|
||||||
|
$this->wait($remaining);
|
||||||
|
$remaining -= intdiv(hrtime(true) - $start, 1000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if(time() - $start >= $this->time){
|
if($remaining <= 0){
|
||||||
echo "\nTook too long to stop, server was killed forcefully!\n";
|
echo "\nTook too long to stop, server was killed forcefully!\n";
|
||||||
@Process::kill(Process::pid());
|
@Process::kill(Process::pid());
|
||||||
}
|
}
|
||||||
|
@ -51,12 +51,12 @@ use function time;
|
|||||||
class BedrockWorldData extends BaseNbtWorldData{
|
class BedrockWorldData extends BaseNbtWorldData{
|
||||||
|
|
||||||
public const CURRENT_STORAGE_VERSION = 10;
|
public const CURRENT_STORAGE_VERSION = 10;
|
||||||
public const CURRENT_STORAGE_NETWORK_VERSION = 630;
|
public const CURRENT_STORAGE_NETWORK_VERSION = 649;
|
||||||
public const CURRENT_CLIENT_VERSION_TARGET = [
|
public const CURRENT_CLIENT_VERSION_TARGET = [
|
||||||
1, //major
|
1, //major
|
||||||
20, //minor
|
20, //minor
|
||||||
50, //patch
|
60, //patch
|
||||||
3, //revision
|
4, //revision
|
||||||
0 //is beta
|
0 //is beta
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -35,3 +35,18 @@ parameters:
|
|||||||
count: 1
|
count: 1
|
||||||
path: ../../../src/world/generator/normal/Normal.php
|
path: ../../../src/world/generator/normal/Normal.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertFalse\\(\\) with false will always evaluate to true\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: ../../phpunit/promise/PromiseTest.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertTrue\\(\\) with false and 'All promise should…' will always evaluate to false\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: ../../phpunit/promise/PromiseTest.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertTrue\\(\\) with false will always evaluate to false\\.$#"
|
||||||
|
count: 2
|
||||||
|
path: ../../phpunit/promise/PromiseTest.php
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ require dirname(__DIR__, 3) . '/vendor/autoload.php';
|
|||||||
|
|
||||||
/* This script needs to be re-run after any intentional blockfactory change (adding or removing a block state). */
|
/* This script needs to be re-run after any intentional blockfactory change (adding or removing a block state). */
|
||||||
|
|
||||||
$factory = new \pocketmine\block\RuntimeBlockStateRegistry();
|
$factory = new RuntimeBlockStateRegistry();
|
||||||
$remaps = [];
|
$remaps = [];
|
||||||
$new = [];
|
$new = [];
|
||||||
foreach(RuntimeBlockStateRegistry::getInstance()->getAllKnownStates() as $index => $block){
|
foreach(RuntimeBlockStateRegistry::getInstance()->getAllKnownStates() as $index => $block){
|
||||||
@ -44,7 +44,7 @@ $oldTablePath = __DIR__ . '/block_factory_consistency_check.json';
|
|||||||
if(file_exists($oldTablePath)){
|
if(file_exists($oldTablePath)){
|
||||||
$oldTable = json_decode(file_get_contents($oldTablePath), true);
|
$oldTable = json_decode(file_get_contents($oldTablePath), true);
|
||||||
if(!is_array($oldTable)){
|
if(!is_array($oldTable)){
|
||||||
throw new \pocketmine\utils\AssumptionFailedError("Old table should be array{knownStates: array<string, string>, stateDataBits: int}");
|
throw new AssumptionFailedError("Old table should be array{knownStates: array<string, string>, stateDataBits: int}");
|
||||||
}
|
}
|
||||||
$old = [];
|
$old = [];
|
||||||
/**
|
/**
|
||||||
|
@ -39,4 +39,110 @@ final class PromiseTest extends TestCase{
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testAllPreResolved() : void{
|
||||||
|
$resolver = new PromiseResolver();
|
||||||
|
$resolver->resolve(1);
|
||||||
|
|
||||||
|
$allPromise = Promise::all([$resolver->getPromise()]);
|
||||||
|
$done = false;
|
||||||
|
$allPromise->onCompletion(
|
||||||
|
function($value) use (&$done) : void{
|
||||||
|
$done = true;
|
||||||
|
self::assertEquals([1], $value);
|
||||||
|
},
|
||||||
|
function() use (&$done) : void{
|
||||||
|
$done = true;
|
||||||
|
self::fail("Promise was rejected");
|
||||||
|
}
|
||||||
|
);
|
||||||
|
self::assertTrue($done);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testAllPostResolved() : void{
|
||||||
|
$resolver = new PromiseResolver();
|
||||||
|
|
||||||
|
$allPromise = Promise::all([$resolver->getPromise()]);
|
||||||
|
$done = false;
|
||||||
|
$allPromise->onCompletion(
|
||||||
|
function($value) use (&$done) : void{
|
||||||
|
$done = true;
|
||||||
|
self::assertEquals([1], $value);
|
||||||
|
},
|
||||||
|
function() use (&$done) : void{
|
||||||
|
$done = true;
|
||||||
|
self::fail("Promise was rejected");
|
||||||
|
}
|
||||||
|
);
|
||||||
|
self::assertFalse($done);
|
||||||
|
$resolver->resolve(1);
|
||||||
|
self::assertTrue($done);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testAllResolve() : void{
|
||||||
|
$resolver1 = new PromiseResolver();
|
||||||
|
$resolver2 = new PromiseResolver();
|
||||||
|
|
||||||
|
$allPromise = Promise::all([$resolver1->getPromise(), $resolver2->getPromise()]);
|
||||||
|
$done = false;
|
||||||
|
$allPromise->onCompletion(
|
||||||
|
function($value) use (&$done) : void{
|
||||||
|
$done = true;
|
||||||
|
self::assertEquals([1, 2], $value);
|
||||||
|
},
|
||||||
|
function() use (&$done) : void{
|
||||||
|
$done = true;
|
||||||
|
self::fail("Promise was rejected");
|
||||||
|
}
|
||||||
|
);
|
||||||
|
self::assertFalse($done);
|
||||||
|
$resolver1->resolve(1);
|
||||||
|
self::assertFalse($done);
|
||||||
|
$resolver2->resolve(2);
|
||||||
|
self::assertTrue($done);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testAllPartialReject() : void{
|
||||||
|
$resolver1 = new PromiseResolver();
|
||||||
|
$resolver2 = new PromiseResolver();
|
||||||
|
|
||||||
|
$allPromise = Promise::all([$resolver1->getPromise(), $resolver2->getPromise()]);
|
||||||
|
$done = false;
|
||||||
|
$allPromise->onCompletion(
|
||||||
|
function($value) use (&$done) : void{
|
||||||
|
$done = true;
|
||||||
|
self::fail("Promise was unexpectedly resolved");
|
||||||
|
},
|
||||||
|
function() use (&$done) : void{
|
||||||
|
$done = true;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
self::assertFalse($done);
|
||||||
|
$resolver2->reject();
|
||||||
|
self::assertTrue($done, "All promise should be rejected immediately after the first constituent rejection");
|
||||||
|
$resolver1->resolve(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Promise::all() should return a rejected promise if any of the input promises were rejected at the call time
|
||||||
|
*/
|
||||||
|
public function testAllPartialPreReject() : void{
|
||||||
|
$resolver1 = new PromiseResolver();
|
||||||
|
$resolver2 = new PromiseResolver();
|
||||||
|
$resolver2->reject();
|
||||||
|
|
||||||
|
$allPromise = Promise::all([$resolver1->getPromise(), $resolver2->getPromise()]);
|
||||||
|
$done = false;
|
||||||
|
$allPromise->onCompletion(
|
||||||
|
function($value) use (&$done) : void{
|
||||||
|
$done = true;
|
||||||
|
self::fail("Promise was unexpectedly resolved");
|
||||||
|
},
|
||||||
|
function() use (&$done) : void{
|
||||||
|
$done = true;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
self::assertTrue($done, "All promise should be rejected immediately after the first constituent rejection");
|
||||||
|
$resolver1->resolve(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,10 +21,29 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace pocketmine\tools\convert_world;
|
||||||
|
|
||||||
use pocketmine\world\format\io\FormatConverter;
|
use pocketmine\world\format\io\FormatConverter;
|
||||||
use pocketmine\world\format\io\WorldProviderManager;
|
use pocketmine\world\format\io\WorldProviderManager;
|
||||||
use pocketmine\world\format\io\WorldProviderManagerEntry;
|
use pocketmine\world\format\io\WorldProviderManagerEntry;
|
||||||
use pocketmine\world\format\io\WritableWorldProviderManagerEntry;
|
use pocketmine\world\format\io\WritableWorldProviderManagerEntry;
|
||||||
|
use function array_filter;
|
||||||
|
use function array_key_exists;
|
||||||
|
use function array_keys;
|
||||||
|
use function array_map;
|
||||||
|
use function array_shift;
|
||||||
|
use function count;
|
||||||
|
use function dirname;
|
||||||
|
use function fwrite;
|
||||||
|
use function getopt;
|
||||||
|
use function implode;
|
||||||
|
use function is_dir;
|
||||||
|
use function is_string;
|
||||||
|
use function is_writable;
|
||||||
|
use function mkdir;
|
||||||
|
use function realpath;
|
||||||
|
use const PHP_EOL;
|
||||||
|
use const STDERR;
|
||||||
|
|
||||||
require_once dirname(__DIR__) . '/vendor/autoload.php';
|
require_once dirname(__DIR__) . '/vendor/autoload.php';
|
||||||
|
|
||||||
@ -76,5 +95,5 @@ if(count($oldProviderClasses) > 1){
|
|||||||
$oldProviderClass = array_shift($oldProviderClasses);
|
$oldProviderClass = array_shift($oldProviderClasses);
|
||||||
$oldProvider = $oldProviderClass->fromPath($inputPath, new \PrefixedLogger(\GlobalLogger::get(), "Old World Provider"));
|
$oldProvider = $oldProviderClass->fromPath($inputPath, new \PrefixedLogger(\GlobalLogger::get(), "Old World Provider"));
|
||||||
|
|
||||||
$converter = new FormatConverter($oldProvider, $writableFormats[$args["format"]], $backupPath, GlobalLogger::get());
|
$converter = new FormatConverter($oldProvider, $writableFormats[$args["format"]], $backupPath, \GlobalLogger::get());
|
||||||
$converter->execute();
|
$converter->execute();
|
||||||
|
@ -165,7 +165,7 @@ class ParserPacketHandler extends PacketHandler{
|
|||||||
$data->block_states = self::blockStatePropertiesToString($blockState);
|
$data->block_states = self::blockStatePropertiesToString($blockState);
|
||||||
}
|
}
|
||||||
}elseif($itemStack->getBlockRuntimeId() !== ItemTranslator::NO_BLOCK_RUNTIME_ID){
|
}elseif($itemStack->getBlockRuntimeId() !== ItemTranslator::NO_BLOCK_RUNTIME_ID){
|
||||||
throw new PacketHandlingException("Non-blockitems should have a zero block runtime ID");
|
throw new PacketHandlingException("Non-blockitems should have a zero block runtime ID (" . $itemStack->getBlockRuntimeId() . " on " . $itemStringId . ")");
|
||||||
}elseif($meta !== 0){
|
}elseif($meta !== 0){
|
||||||
$data->meta = $meta;
|
$data->meta = $meta;
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,7 @@ use function get_class;
|
|||||||
use function json_encode;
|
use function json_encode;
|
||||||
use function ksort;
|
use function ksort;
|
||||||
use const JSON_PRETTY_PRINT;
|
use const JSON_PRETTY_PRINT;
|
||||||
|
use const SORT_NATURAL;
|
||||||
use const SORT_STRING;
|
use const SORT_STRING;
|
||||||
use const STDERR;
|
use const STDERR;
|
||||||
|
|
||||||
@ -82,7 +83,7 @@ foreach($states as $state){
|
|||||||
|
|
||||||
foreach(Utils::stringifyKeys($reportMap) as $blockName => $propertyList){
|
foreach(Utils::stringifyKeys($reportMap) as $blockName => $propertyList){
|
||||||
foreach(Utils::stringifyKeys($propertyList) as $propertyName => $propertyValues){
|
foreach(Utils::stringifyKeys($propertyList) as $propertyName => $propertyValues){
|
||||||
ksort($reportMap[$blockName][$propertyName]);
|
ksort($propertyValues, SORT_NATURAL);
|
||||||
$reportMap[$blockName][$propertyName] = array_values($propertyValues);
|
$reportMap[$blockName][$propertyName] = array_values($propertyValues);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,9 +94,14 @@ foreach($files as $file){
|
|||||||
$newDiff = [];
|
$newDiff = [];
|
||||||
|
|
||||||
foreach($target["simple"] as $oldId => $newId){
|
foreach($target["simple"] as $oldId => $newId){
|
||||||
if(($merged["simple"][$oldId] ?? null) !== $newId){
|
$previousNewId = $merged["simple"][$oldId] ?? null;
|
||||||
$newDiff["renamedIds"][$oldId] = $newId;
|
if(
|
||||||
|
$previousNewId === $newId || //if previous schemas already accounted for this
|
||||||
|
($previousNewId !== null && isset($target["simple"][$previousNewId])) //or the item's ID has been changed for a second time
|
||||||
|
){
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
$newDiff["renamedIds"][$oldId] = $newId;
|
||||||
}
|
}
|
||||||
if(isset($newDiff["renamedIds"])){
|
if(isset($newDiff["renamedIds"])){
|
||||||
ksort($newDiff["renamedIds"], SORT_STRING);
|
ksort($newDiff["renamedIds"], SORT_STRING);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user