Merge branch 'major-next' into command-alias-handling

This commit is contained in:
Dylan K. Taylor 2025-08-03 16:20:29 +01:00
commit 9a7d94cd1c
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
197 changed files with 2811 additions and 918 deletions

View File

@ -53,7 +53,7 @@ jobs:
run: echo NAME=$(echo "${GITHUB_REPOSITORY,,}") >> $GITHUB_OUTPUT
- name: Build image for tag
uses: docker/build-push-action@v6.16.0
uses: docker/build-push-action@v6.18.0
with:
push: true
context: ./pocketmine-mp
@ -66,7 +66,7 @@ jobs:
- name: Build image for major tag
if: steps.channel.outputs.CHANNEL == 'stable'
uses: docker/build-push-action@v6.16.0
uses: docker/build-push-action@v6.18.0
with:
push: true
context: ./pocketmine-mp
@ -79,7 +79,7 @@ jobs:
- name: Build image for minor tag
if: steps.channel.outputs.CHANNEL == 'stable'
uses: docker/build-push-action@v6.16.0
uses: docker/build-push-action@v6.18.0
with:
push: true
context: ./pocketmine-mp
@ -92,7 +92,7 @@ jobs:
- name: Build image for latest tag
if: steps.channel.outputs.CHANNEL == 'stable'
uses: docker/build-push-action@v6.16.0
uses: docker/build-push-action@v6.18.0
with:
push: true
context: ./pocketmine-mp

View File

@ -0,0 +1,47 @@
name: "Copilot Agent environment setup"
on:
workflow_dispatch:
push:
paths:
- .github/workflows/copilot-setup-steps.yml
pull_request:
paths:
- .github/workflows/copilot-setup-steps.yml
jobs:
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
copilot-setup-steps:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: pmmp/setup-php-action@3.2.0
with:
php-version: 8.3
install-path: "./bin"
pm-version-major: 5
- name: Restore Composer package cache
uses: actions/cache@v4
with:
path: |
~/.cache/composer/files
~/.cache/composer/vcs
key: "composer-v2-cache-8.3-${{ hashFiles('./composer.lock') }}"
restore-keys: |
composer-v2-cache-
- name: Install Composer dependencies
run: composer install --prefer-dist --no-interaction
- name: Clone extension stubs
uses: actions/checkout@v4
with:
repository: pmmp/phpstorm-stubs
path: extension-stubs

View File

@ -13,9 +13,9 @@ jobs:
- uses: actions/checkout@v4
- name: Setup PHP and tools
uses: shivammathur/setup-php@2.33.0
uses: shivammathur/setup-php@2.34.1
with:
php-version: 8.2
php-version: 8.3
- name: Restore Composer package cache
uses: actions/cache@v4

View File

@ -49,9 +49,9 @@ jobs:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@2.33.0
uses: shivammathur/setup-php@2.34.1
with:
php-version: 8.2
php-version: 8.3
- name: Restore Composer package cache
uses: actions/cache@v4

View File

@ -18,7 +18,7 @@ on:
- "*"
env:
PHP_VERSION: "8.2"
PHP_VERSION: "8.3"
jobs:
skip:
@ -87,7 +87,7 @@ jobs:
submodules: true
- name: Setup PHP
uses: shivammathur/setup-php@2.33.0
uses: shivammathur/setup-php@2.34.1
with:
php-version: ${{ env.PHP_VERSION }}
@ -165,7 +165,7 @@ jobs:
${{ github.workspace }}/core-permissions.rst
- name: Create draft release
uses: ncipollo/release-action@v1.16.0
uses: ncipollo/release-action@v1.18.0
id: create-draft
with:
artifacts: ${{ github.workspace }}/PocketMine-MP.phar,${{ github.workspace }}/start.*,${{ github.workspace }}/build_info.json,${{ github.workspace }}/core-permissions.rst
@ -188,4 +188,4 @@ jobs:
if: github.event_name == 'pull_request_target'
uses: thollander/actions-comment-pull-request@v3
with:
message: "[Draft release ${{ steps.get-pm-version.outputs.PM_VERSION }}](${{ steps.create-draft.outputs.html_url }}) has been created for commit ${{ github.sha }}. Please review and publish it."
message: "${{ vars.DRAFT_RELEASE_NOTIFICATION_MENTION }} [Draft release ${{ steps.get-pm-version.outputs.PM_VERSION }}](${{ steps.create-draft.outputs.html_url }}) has been created for commit ${{ github.sha }}. Please review and publish it."

View File

@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ["8.1", "8.2", "8.3"]
php: ["8.3"]
uses: ./.github/workflows/main-php-matrix.yml
with:
@ -28,7 +28,7 @@ jobs:
- uses: actions/checkout@v4
- name: Setup PHP and tools
uses: shivammathur/setup-php@2.33.0
uses: shivammathur/setup-php@2.34.1
with:
php-version: 8.3
tools: php-cs-fixer:3.75

View File

@ -12,7 +12,7 @@
</p>
<p align="center">
<a href="https://github.com/pmmp/PocketMine-MP/actions/workflows/main.yml"><img src="https://github.com/pmmp/PocketMine-MP/workflows/CI/badge.svg" alt="CI" /></a>
<a href="https://github.com/pmmp/PocketMine-MP/actions/workflows/main.yml"><img src="https://github.com/pmmp/PocketMine-MP/actions/workflows/main.yml/badge.svg" alt="CI" /></a>
<a href="https://github.com/pmmp/PocketMine-MP/releases/latest"><img alt="GitHub release (latest SemVer)" src="https://img.shields.io/github/v/release/pmmp/PocketMine-MP?label=release&sort=semver"></a>
<a href="https://discord.gg/bmSAZBG"><img src="https://img.shields.io/discord/373199722573201408?label=discord&color=7289DA&logo=discord" alt="Discord" /></a>
<br>

@ -1 +1 @@
Subproject commit 15494337976e645499e2e3e8c8b491227522be91
Subproject commit ce1b095a9c6f47dadc7b5812da4e469d52f272bc

25
changelogs/5.29.md Normal file
View File

@ -0,0 +1,25 @@
# 5.29.0
Released 18th June 2025.
This is a support release for Minecraft: Bedrock Edition 1.21.90.
**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.21.90.
- Removed support for earlier versions.
## Fixes
- Fixed thread crashes sometimes not reporting proper cause information in crashdumps.
- Fixed crash when a plugin replaced a player's held tool with a different tool with a damage exceeding the old tool's max damage during an action.
- Fixed performance issue of `PlayerAuthInputPacket` input flags handling (broken change detection).
- Fixed `BaseInventory->addItem()` triggering updates on empty slots when no items were added.
- Fixed slow check in `SubChunk` block layer garbage collection.
## Internals
- `LoginPacketHandler->processLogin()` signature has changed. This will break any plugins overriding `LoginPacketHandler`. As noted above, this is _not_ covered by the API version guarantee.
- Automated branch sync for `minor-next` and `major-next` is now triggered by `repository_dispatch` from a cron job in this repository instead of `RestrictedActions`. The `RestrictedActions` cron job was getting automatically disabled by GitHub due to repo inactivity.

73
changelogs/5.30.md Normal file
View File

@ -0,0 +1,73 @@
# 5.30.0
Released 18th June 2025.
This is a minor feature release containing API additions, internals cleanup and user experience improvements.
**Plugin compatibility:** Plugins for previous 5.x versions will run unchanged on this release, unless they use internal APIs, reflection, or packages like the `pocketmine\network\mcpe` or `pocketmine\data` namespace.
Do not update plugin minimum API versions unless you need new features added in this release.
**WARNING: If your plugin uses the `pocketmine\network\mcpe` namespace, you're not shielded by API change constraints.**
Consider using the `mcpe-protocol` directive in `plugin.yml` as a constraint if you're using packets directly.
## General
- Significantly reduced log spam when unknown blocks, tiles and entities are found in saved worlds.
- The file name structure for crashdumps has been changed to improve sorting order in file browsers.
- Buffering is now skipped on the RakLib layer. In theory this could reduce player network latency by 10 ms (YMMV).
## Gameplay
### Blocks
- Many blocks have had their hardness and blast resistance updated to match vanilla.
- Implemented Respawn Anchor.
- Melon Stem and Pumpkin Stem drop amounts should now match vanilla (using binomial distribution).
## API
## General
- Verification of save registration has been added for blocks, entities and tiles. This is intended to make it easier to find mistakes when registering custom things, which previously would produce obscure core crashes.
### `pocketmine\event\block`
- The following classes have been added:
- `BlockPreExplodeEvent` - called before a block tries to explode
- `BlockExplodeEvent` - called when after a block's explosion calculation has been done, but before any changes are applied
### `pocketmine\event\entity`
- The following classes have been added:
- `EntityExtinguishEvent` - called when a burning entity is extinguished by water or other sources
- `EntityFrostWalkerEvent` - called every tick upon which an entity wearing Frost Walker boots moves; this can be used to customise or cancel the behaviour of the Frost Walker enchantment
### `pocketmine\event\player`
- The following classes have been added:
- `PlayerRespawnAnchorUseEvent` - called when a player interacts with a charged respawn anchor
### `pocketmine\entity`
- The following methods have been added:
- `public Entity->getStepHeight() : float`
- `public Entity->setStepHeight(float $stepHeight) : void`
### `pocketmine\world\generator`
- Generator execution has been decoupled from `PopulationTask` and async tasks in general. The following classes have been added:
- `executor\GeneratorExecutor`
- `executor\SyncGeneratorExecutor` - runs a generator on the main thread (used for flat world generation, which doesn't need threads)
- `executor\AsyncGeneratorExecutor` - runs a generator inside an async task, as before
- `PopulationUtils` - contains population business logic previously baked into `PopulationTask` - this permits the reuse of that logic outside async tasks
- The following methods have signature changes:
- `GeneratorManager->addGenerator()` now accepts an optional `bool $fast` parameter, defaulting to `false`; setting this to `true` will cause your generator to run on the main thread
- The following methods have been added:
- `public GeneratorManagerEntry->isFast() : bool` - returns whether this generator should run on the main thread
- `PopulationTask` has been marked as `@internal`. In the next major version, it will move to the `generator\executor` namespace; however, for now it stays put because plugins currently have no other way to regenerate chunks.
## Internals
- World data version numbers have been consolidated in `pocketmine\data\bedrock\WorldDataVersions`. This removes the need to modify several different files to support new world versions, and reduces the chances of things getting missed.
- Block hardness and blast resistance is now unit-tested against `block_properties_table.json` in `BedrockData`. This file comes from vanilla BDS, so we can use it to verify compliance.
- Protocol-layer "server auth block breaking" has been enabled. Functionally, this is no different from the previous system, it just works differently on the network layer.
- Various internal classes in the `pocketmine\world\generator` namespace have been moved to the `generator\executor` namespace.
- Removed `World->registerGenerator()` and `World->unregisterGenerator()`.
- Removed redundant calls to `curl_close()` (obsolete since PHP 8.0).
# 5.30.1
Released 23rd June 2025.
## Fixes
- Fixed accidental break of backwards compatibility in `EntityExplodeEvent` introduced in the previous release.
- Fixed placement of player holding block when exploding respawn anchor.
- Updated BedrockProtocol to fix incorrect encoding of `ServerScriptDebugDrawerPacket`.
- Disabled client-side locator bar, allowing plugins to write their own implementations.

14
changelogs/5.31.md Normal file
View File

@ -0,0 +1,14 @@
# 5.31.0
Released 8th July 2025.
This is a support release for Minecraft: Bedrock Edition 1.21.93.
**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.21.93.
- Removed support for earlier versions.

View File

@ -5,7 +5,7 @@
"homepage": "https://pmmp.io",
"license": "LGPL-3.0",
"require": {
"php": "^8.1",
"php": "^8.3",
"php-64bit": "*",
"ext-chunkutils2": "^0.3.1",
"ext-crypto": "^0.3.1",
@ -34,28 +34,28 @@
"adhocore/json-comment": "~1.2.0",
"netresearch/jsonmapper": "~v5.0.0",
"pocketmine/bedrock-block-upgrade-schema": "~5.1.0+bedrock-1.21.60",
"pocketmine/bedrock-data": "~5.0.0+bedrock-1.21.80",
"pocketmine/bedrock-data": "~5.2.0+bedrock-1.21.93",
"pocketmine/bedrock-item-upgrade-schema": "~1.14.0+bedrock-1.21.50",
"pocketmine/bedrock-protocol": "~38.0.0+bedrock-1.21.80",
"pocketmine/bedrock-protocol": "~39.1.0+bedrock-1.21.93",
"pocketmine/binaryutils": "^0.2.1",
"pocketmine/callback-validator": "^1.0.2",
"pocketmine/color": "^0.3.0",
"pocketmine/errorhandler": "^0.7.0",
"pocketmine/locale-data": "~2.24.0",
"pocketmine/locale-data": "~2.25.0",
"pocketmine/log": "^0.4.0",
"pocketmine/math": "~1.0.0",
"pocketmine/nbt": "~1.1.0",
"pocketmine/raklib": "~1.1.2",
"pocketmine/raklib": "~1.2.0",
"pocketmine/raklib-ipc": "~1.0.0",
"pocketmine/snooze": "^0.5.0",
"ramsey/uuid": "~4.7.0",
"symfony/filesystem": "~6.4.0"
"ramsey/uuid": "~4.9.0",
"symfony/filesystem": "~7.3.0"
},
"require-dev": {
"phpstan/phpstan": "2.1.16",
"phpstan/phpstan": "2.1.17",
"phpstan/phpstan-phpunit": "^2.0.0",
"phpstan/phpstan-strict-rules": "^2.0.0",
"phpunit/phpunit": "^10.5.24"
"phpunit/phpunit": "^12.2.1"
},
"replace": {
"symfony/polyfill-ctype": "*",
@ -77,7 +77,7 @@
},
"config": {
"platform": {
"php": "8.1.0"
"php": "8.3.0"
},
"sort-packages": true
},

778
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -55,7 +55,7 @@ namespace pocketmine {
require_once __DIR__ . '/VersionInfo.php';
const MIN_PHP_VERSION = "8.1.0";
const MIN_PHP_VERSION = "8.3.0";
/**
* @param string $message

View File

@ -1624,7 +1624,7 @@ class Server{
if(!is_dir($crashFolder)){
mkdir($crashFolder);
}
$crashDumpPath = Path::join($crashFolder, date("D_M_j-H.i.s-T_Y", (int) $dump->getData()->time) . ".log");
$crashDumpPath = Path::join($crashFolder, date("Y-m-d_H.i.s_T", (int) $dump->getData()->time) . ".log");
$fp = @fopen($crashDumpPath, "wb");
if(!is_resource($fp)){

View File

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

View File

@ -23,9 +23,10 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\PoweredByRedstone;
use pocketmine\block\utils\RailPoweredByRedstoneTrait;
class ActivatorRail extends StraightOnlyRail{
class ActivatorRail extends StraightOnlyRail implements PoweredByRedstone{
use RailPoweredByRedstoneTrait;
//TODO

View File

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\AmethystTrait;
use pocketmine\block\utils\AnyFacing;
use pocketmine\block\utils\AnyFacingTrait;
use pocketmine\block\utils\FortuneDropHelper;
use pocketmine\block\utils\SupportType;
@ -38,7 +39,7 @@ use pocketmine\player\Player;
use pocketmine\utils\AssumptionFailedError;
use pocketmine\world\BlockTransaction;
final class AmethystCluster extends Transparent{
final class AmethystCluster extends Transparent implements AnyFacing{
use AmethystTrait;
use AnyFacingTrait;

View File

@ -26,6 +26,7 @@ namespace pocketmine\block;
use pocketmine\block\inventory\AnvilInventory;
use pocketmine\block\utils\Fallable;
use pocketmine\block\utils\FallableTrait;
use pocketmine\block\utils\HorizontalFacing;
use pocketmine\block\utils\HorizontalFacingTrait;
use pocketmine\block\utils\SupportType;
use pocketmine\data\runtime\RuntimeDataDescriber;
@ -41,7 +42,7 @@ use pocketmine\world\sound\AnvilFallSound;
use pocketmine\world\sound\Sound;
use function round;
class Anvil extends Transparent implements Fallable{
class Anvil extends Transparent implements Fallable, HorizontalFacing{
use FallableTrait;
use HorizontalFacingTrait;

View File

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\tile\Barrel as TileBarrel;
use pocketmine\block\utils\AnyFacing;
use pocketmine\block\utils\AnyFacingTrait;
use pocketmine\data\runtime\RuntimeDataDescriber;
use pocketmine\item\Item;
@ -33,7 +34,7 @@ use pocketmine\player\Player;
use pocketmine\world\BlockTransaction;
use function abs;
class Barrel extends Opaque{
class Barrel extends Opaque implements AnyFacing{
use AnyFacingTrait;
protected bool $open = false;

View File

@ -25,6 +25,7 @@ namespace pocketmine\block;
use pocketmine\block\tile\Banner as TileBanner;
use pocketmine\block\utils\BannerPatternLayer;
use pocketmine\block\utils\Colored;
use pocketmine\block\utils\ColoredTrait;
use pocketmine\block\utils\SupportType;
use pocketmine\item\Banner as ItemBanner;
@ -36,7 +37,7 @@ use pocketmine\world\BlockTransaction;
use function assert;
use function count;
abstract class BaseBanner extends Transparent{
abstract class BaseBanner extends Transparent implements Colored{
use ColoredTrait;
/**

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\HorizontalFacing;
use pocketmine\block\utils\HorizontalFacingTrait;
use pocketmine\block\utils\SupportType;
use pocketmine\event\block\StructureGrowEvent;
@ -33,7 +34,7 @@ use pocketmine\math\Vector3;
use pocketmine\player\Player;
use pocketmine\world\BlockTransaction;
abstract class BaseBigDripleaf extends Transparent{
abstract class BaseBigDripleaf extends Transparent implements HorizontalFacing{
use HorizontalFacingTrait;
abstract protected function isHead() : bool;

View File

@ -24,12 +24,13 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\BlockEventHelper;
use pocketmine\block\utils\CoralMaterial;
use pocketmine\block\utils\CoralTypeTrait;
use pocketmine\block\utils\SupportType;
use pocketmine\item\Item;
use function mt_rand;
abstract class BaseCoral extends Transparent{
abstract class BaseCoral extends Transparent implements CoralMaterial{
use CoralTypeTrait;
public function onNearbyBlockChange() : void{

View File

@ -27,6 +27,7 @@ use pocketmine\block\tile\Sign as TileSign;
use pocketmine\block\utils\DyeColor;
use pocketmine\block\utils\SignText;
use pocketmine\block\utils\SupportType;
use pocketmine\block\utils\WoodMaterial;
use pocketmine\block\utils\WoodType;
use pocketmine\block\utils\WoodTypeTrait;
use pocketmine\color\Color;
@ -44,7 +45,7 @@ use function array_map;
use function assert;
use function strlen;
abstract class BaseSign extends Transparent{
abstract class BaseSign extends Transparent implements WoodMaterial{
use WoodTypeTrait;
protected SignText $text;

View File

@ -24,8 +24,10 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\tile\Bed as TileBed;
use pocketmine\block\utils\Colored;
use pocketmine\block\utils\ColoredTrait;
use pocketmine\block\utils\DyeColor;
use pocketmine\block\utils\HorizontalFacing;
use pocketmine\block\utils\HorizontalFacingTrait;
use pocketmine\block\utils\SupportType;
use pocketmine\data\runtime\RuntimeDataDescriber;
@ -41,7 +43,7 @@ use pocketmine\utils\TextFormat;
use pocketmine\world\BlockTransaction;
use pocketmine\world\World;
class Bed extends Transparent{
class Bed extends Transparent implements Colored, HorizontalFacing{
use ColoredTrait;
use HorizontalFacingTrait;

View File

@ -25,6 +25,7 @@ namespace pocketmine\block;
use pocketmine\block\tile\Bell as TileBell;
use pocketmine\block\utils\BellAttachmentType;
use pocketmine\block\utils\HorizontalFacing;
use pocketmine\block\utils\HorizontalFacingTrait;
use pocketmine\block\utils\SupportType;
use pocketmine\data\runtime\RuntimeDataDescriber;
@ -38,7 +39,7 @@ use pocketmine\player\Player;
use pocketmine\world\BlockTransaction;
use pocketmine\world\sound\BellRingSound;
final class Bell extends Transparent{
final class Bell extends Transparent implements HorizontalFacing{
use HorizontalFacingTrait;
private BellAttachmentType $attachmentType = BellAttachmentType::FLOOR;

View File

@ -73,7 +73,7 @@ class BlockBreakInfo{
return new self(0.0, $toolType, $toolHarvestLevel, 0.0);
}
public static function indestructible(float $blastResistance = 18000000.0) : self{
public static function indestructible(float $blastResistance = 18000003.75) : self{
return new self(-1.0, BlockToolType::NONE, 0, $blastResistance);
}

View File

@ -786,8 +786,9 @@ final class BlockTypeIds{
public const RESIN_BRICKS = 10756;
public const RESIN_CLUMP = 10757;
public const CHISELED_RESIN_BRICKS = 10758;
public const RESPAWN_ANCHOR = 10759;
public const FIRST_UNUSED_BLOCK_ID = 10759;
public const FIRST_UNUSED_BLOCK_ID = 10760;
private static int $nextDynamicId = self::FIRST_UNUSED_BLOCK_ID;

View File

@ -23,8 +23,9 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\PillarRotation;
use pocketmine\block\utils\PillarRotationTrait;
class BoneBlock extends Opaque{
class BoneBlock extends Opaque implements PillarRotation{
use PillarRotationTrait;
}

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\AnyFacing;
use pocketmine\block\utils\AnyFacingTrait;
use pocketmine\data\runtime\RuntimeDataDescriber;
use pocketmine\item\Item;
@ -33,7 +34,7 @@ use pocketmine\world\BlockTransaction;
use pocketmine\world\sound\RedstonePowerOffSound;
use pocketmine\world\sound\RedstonePowerOnSound;
abstract class Button extends Flowable{
abstract class Button extends Flowable implements AnyFacing{
use AnyFacingTrait;
protected bool $pressed = false;

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\Ageable;
use pocketmine\block\utils\AgeableTrait;
use pocketmine\block\utils\BlockEventHelper;
use pocketmine\block\utils\StaticSupportTrait;
@ -33,7 +34,7 @@ use pocketmine\event\entity\EntityDamageEvent;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Facing;
class Cactus extends Transparent{
class Cactus extends Transparent implements Ageable{
use AgeableTrait;
use StaticSupportTrait;

View File

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\CandleTrait;
use pocketmine\block\utils\Lightable;
use pocketmine\entity\Living;
use pocketmine\item\Item;
use pocketmine\math\AxisAlignedBB;
@ -31,7 +32,7 @@ use pocketmine\math\Facing;
use pocketmine\math\Vector3;
use pocketmine\player\Player;
class CakeWithCandle extends BaseCake{
class CakeWithCandle extends BaseCake implements Lightable{
use CandleTrait {
onInteract as onInteractCandle;
}

View File

@ -23,10 +23,11 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\Colored;
use pocketmine\block\utils\ColoredTrait;
use pocketmine\block\utils\DyeColor;
class CakeWithDyedCandle extends CakeWithCandle{
class CakeWithDyedCandle extends CakeWithCandle implements Colored{
use ColoredTrait;
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){

View File

@ -25,7 +25,9 @@ namespace pocketmine\block;
use pocketmine\block\inventory\CampfireInventory;
use pocketmine\block\tile\Campfire as TileCampfire;
use pocketmine\block\utils\HorizontalFacing;
use pocketmine\block\utils\HorizontalFacingTrait;
use pocketmine\block\utils\Lightable;
use pocketmine\block\utils\LightableTrait;
use pocketmine\block\utils\SupportType;
use pocketmine\crafting\FurnaceRecipe;
@ -59,7 +61,7 @@ use function count;
use function min;
use function mt_rand;
class Campfire extends Transparent{
class Campfire extends Transparent implements Lightable, HorizontalFacing{
use HorizontalFacingTrait{
HorizontalFacingTrait::describeBlockOnlyState as encodeFacingState;
}

View File

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\CandleTrait;
use pocketmine\block\utils\Lightable;
use pocketmine\block\utils\SupportType;
use pocketmine\data\runtime\RuntimeDataDescriber;
use pocketmine\item\Item;
@ -35,7 +36,7 @@ use pocketmine\player\Player;
use pocketmine\utils\AssumptionFailedError;
use pocketmine\world\BlockTransaction;
class Candle extends Transparent{
class Candle extends Transparent implements Lightable{
use CandleTrait {
describeBlockOnlyState as encodeLitState;
getLightLevel as getBaseLightLevel;

View File

@ -23,12 +23,13 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\Colored;
use pocketmine\block\utils\ColoredTrait;
use pocketmine\block\utils\StaticSupportTrait;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Facing;
class Carpet extends Flowable{
class Carpet extends Flowable implements Colored{
use ColoredTrait;
use StaticSupportTrait;

View File

@ -24,7 +24,8 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\FacesOppositePlacingPlayerTrait;
use pocketmine\block\utils\HorizontalFacing;
class CarvedPumpkin extends Opaque{
class CarvedPumpkin extends Opaque implements HorizontalFacing{
use FacesOppositePlacingPlayerTrait;
}

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\Ageable;
use pocketmine\block\utils\AgeableTrait;
use pocketmine\block\utils\BlockEventHelper;
use pocketmine\block\utils\StaticSupportTrait;
@ -39,7 +40,7 @@ use pocketmine\world\BlockTransaction;
use pocketmine\world\sound\GlowBerriesPickSound;
use function mt_rand;
class CaveVines extends Flowable{
class CaveVines extends Flowable implements Ageable{
use AgeableTrait;
use StaticSupportTrait;

View File

@ -23,13 +23,14 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\PillarRotation;
use pocketmine\block\utils\PillarRotationTrait;
use pocketmine\block\utils\SupportType;
use pocketmine\math\Axis;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Facing;
final class Chain extends Transparent{
final class Chain extends Transparent implements PillarRotation{
use PillarRotationTrait;
public function getSupportType(int $facing) : SupportType{

View File

@ -24,11 +24,12 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\FacesOppositePlacingPlayerTrait;
use pocketmine\block\utils\HorizontalFacing;
use pocketmine\item\Item;
use pocketmine\math\Vector3;
use pocketmine\player\Player;
final class ChemistryTable extends Opaque{
final class ChemistryTable extends Opaque implements HorizontalFacing{
use FacesOppositePlacingPlayerTrait;
public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null, array &$returnedItems = []) : bool{

View File

@ -25,6 +25,7 @@ namespace pocketmine\block;
use pocketmine\block\tile\Chest as TileChest;
use pocketmine\block\utils\FacesOppositePlacingPlayerTrait;
use pocketmine\block\utils\HorizontalFacing;
use pocketmine\block\utils\SupportType;
use pocketmine\event\block\ChestPairEvent;
use pocketmine\item\Item;
@ -33,7 +34,7 @@ use pocketmine\math\Facing;
use pocketmine\math\Vector3;
use pocketmine\player\Player;
class Chest extends Transparent{
class Chest extends Transparent implements HorizontalFacing{
use FacesOppositePlacingPlayerTrait;
protected function recalculateCollisionBoxes() : array{

View File

@ -26,6 +26,7 @@ namespace pocketmine\block;
use pocketmine\block\tile\ChiseledBookshelf as TileChiseledBookshelf;
use pocketmine\block\utils\ChiseledBookshelfSlot;
use pocketmine\block\utils\FacesOppositePlacingPlayerTrait;
use pocketmine\block\utils\HorizontalFacing;
use pocketmine\block\utils\HorizontalFacingTrait;
use pocketmine\data\runtime\RuntimeDataDescriber;
use pocketmine\item\Book;
@ -38,7 +39,7 @@ use pocketmine\math\Vector3;
use pocketmine\player\Player;
use function spl_object_id;
class ChiseledBookshelf extends Opaque{
class ChiseledBookshelf extends Opaque implements HorizontalFacing{
use HorizontalFacingTrait;
use FacesOppositePlacingPlayerTrait;

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\Ageable;
use pocketmine\block\utils\AgeableTrait;
use pocketmine\block\utils\StaticSupportTrait;
use pocketmine\entity\projectile\Projectile;
@ -40,7 +41,7 @@ use function array_rand;
use function min;
use function mt_rand;
final class ChorusFlower extends Flowable{
final class ChorusFlower extends Flowable implements Ageable{
use AgeableTrait;
use StaticSupportTrait;

View File

@ -23,8 +23,10 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\Ageable;
use pocketmine\block\utils\AgeableTrait;
use pocketmine\block\utils\BlockEventHelper;
use pocketmine\block\utils\HorizontalFacing;
use pocketmine\block\utils\HorizontalFacingTrait;
use pocketmine\block\utils\WoodType;
use pocketmine\data\runtime\RuntimeDataDescriber;
@ -39,7 +41,7 @@ use pocketmine\player\Player;
use pocketmine\world\BlockTransaction;
use function mt_rand;
class CocoaBlock extends Flowable{
class CocoaBlock extends Flowable implements Ageable, HorizontalFacing{
use HorizontalFacingTrait;
use AgeableTrait;

View File

@ -23,8 +23,9 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\Colored;
use pocketmine\block\utils\ColoredTrait;
class Concrete extends Opaque{
class Concrete extends Opaque implements Colored{
use ColoredTrait;
}

View File

@ -24,12 +24,13 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\BlockEventHelper;
use pocketmine\block\utils\Colored;
use pocketmine\block\utils\ColoredTrait;
use pocketmine\block\utils\Fallable;
use pocketmine\block\utils\FallableTrait;
use pocketmine\math\Facing;
class ConcretePowder extends Opaque implements Fallable{
class ConcretePowder extends Opaque implements Fallable, Colored{
use ColoredTrait;
use FallableTrait {
onNearbyBlockChange as protected startFalling;

View File

@ -26,11 +26,13 @@ namespace pocketmine\block;
use pocketmine\block\utils\CopperMaterial;
use pocketmine\block\utils\CopperOxidation;
use pocketmine\block\utils\CopperTrait;
use pocketmine\block\utils\Lightable;
use pocketmine\block\utils\LightableTrait;
use pocketmine\block\utils\PoweredByRedstone;
use pocketmine\block\utils\PoweredByRedstoneTrait;
use pocketmine\data\runtime\RuntimeDataDescriber;
class CopperBulb extends Opaque implements CopperMaterial{
class CopperBulb extends Opaque implements CopperMaterial, Lightable, PoweredByRedstone{
use CopperTrait;
use PoweredByRedstoneTrait;
use LightableTrait{

View File

@ -24,11 +24,12 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\BlockEventHelper;
use pocketmine\block\utils\CoralMaterial;
use pocketmine\block\utils\CoralTypeTrait;
use pocketmine\item\Item;
use function mt_rand;
final class CoralBlock extends Opaque{
final class CoralBlock extends Opaque implements CoralMaterial{
use CoralTypeTrait;
public function onNearbyBlockChange() : void{

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\Ageable;
use pocketmine\block\utils\AgeableTrait;
use pocketmine\block\utils\BlockEventHelper;
use pocketmine\block\utils\CropGrowthHelper;
@ -34,7 +35,7 @@ use pocketmine\math\Vector3;
use pocketmine\player\Player;
use function mt_rand;
abstract class Crops extends Flowable{
abstract class Crops extends Flowable implements Ageable{
use AgeableTrait;
use StaticSupportTrait;

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\AnalogRedstoneSignalEmitter;
use pocketmine\block\utils\AnalogRedstoneSignalEmitterTrait;
use pocketmine\block\utils\SupportType;
use pocketmine\data\runtime\RuntimeDataDescriber;
@ -36,7 +37,7 @@ use function max;
use function round;
use const M_PI;
class DaylightSensor extends Transparent{
class DaylightSensor extends Transparent implements AnalogRedstoneSignalEmitter{
use AnalogRedstoneSignalEmitterTrait;
protected bool $inverted = false;

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\HorizontalFacing;
use pocketmine\block\utils\HorizontalFacingTrait;
use pocketmine\block\utils\SupportType;
use pocketmine\data\runtime\RuntimeDataDescriber;
@ -34,7 +35,7 @@ use pocketmine\player\Player;
use pocketmine\world\BlockTransaction;
use pocketmine\world\sound\DoorSound;
class Door extends Transparent{
class Door extends Transparent implements HorizontalFacing{
use HorizontalFacingTrait;
protected bool $top = false;

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\Ageable;
use pocketmine\block\utils\AgeableTrait;
use pocketmine\block\utils\CropGrowthHelper;
use pocketmine\data\runtime\RuntimeDataDescriber;
@ -37,7 +38,7 @@ use pocketmine\math\Vector3;
use pocketmine\player\Player;
use pocketmine\world\BlockTransaction;
final class DoublePitcherCrop extends DoublePlant{
final class DoublePitcherCrop extends DoublePlant implements Ageable{
use AgeableTrait {
describeBlockOnlyState as describeAge;
}

View File

@ -23,9 +23,10 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\Colored;
use pocketmine\block\utils\ColoredTrait;
class DyedCandle extends Candle{
class DyedCandle extends Candle implements Colored{
use ColoredTrait;
protected function getCandleIfCompatibleType(Block $block) : ?Candle{

View File

@ -23,8 +23,9 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\Colored;
use pocketmine\block\utils\ColoredTrait;
final class DyedShulkerBox extends ShulkerBox{
final class DyedShulkerBox extends ShulkerBox implements Colored{
use ColoredTrait;
}

View File

@ -24,11 +24,12 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\FacesOppositePlacingPlayerTrait;
use pocketmine\block\utils\HorizontalFacing;
use pocketmine\data\runtime\RuntimeDataDescriber;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Facing;
class EndPortalFrame extends Opaque{
class EndPortalFrame extends Opaque implements HorizontalFacing{
use FacesOppositePlacingPlayerTrait;
protected bool $eye = false;

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\AnyFacing;
use pocketmine\block\utils\AnyFacingTrait;
use pocketmine\item\Item;
use pocketmine\math\Axis;
@ -32,7 +33,7 @@ use pocketmine\math\Vector3;
use pocketmine\player\Player;
use pocketmine\world\BlockTransaction;
class EndRod extends Flowable{
class EndRod extends Flowable implements AnyFacing{
use AnyFacingTrait;
public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{

View File

@ -26,6 +26,7 @@ namespace pocketmine\block;
use pocketmine\block\inventory\EnderChestInventory;
use pocketmine\block\tile\EnderChest as TileEnderChest;
use pocketmine\block\utils\FacesOppositePlacingPlayerTrait;
use pocketmine\block\utils\HorizontalFacing;
use pocketmine\block\utils\SupportType;
use pocketmine\item\Item;
use pocketmine\math\AxisAlignedBB;
@ -33,7 +34,7 @@ use pocketmine\math\Facing;
use pocketmine\math\Vector3;
use pocketmine\player\Player;
class EnderChest extends Transparent{
class EnderChest extends Transparent implements HorizontalFacing{
use FacesOppositePlacingPlayerTrait;
public function getLightLevel() : int{

View File

@ -23,8 +23,10 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\HorizontalFacing;
use pocketmine\block\utils\HorizontalFacingTrait;
use pocketmine\block\utils\SupportType;
use pocketmine\block\utils\WoodMaterial;
use pocketmine\block\utils\WoodTypeTrait;
use pocketmine\data\runtime\RuntimeDataDescriber;
use pocketmine\item\Item;
@ -35,7 +37,7 @@ use pocketmine\player\Player;
use pocketmine\world\BlockTransaction;
use pocketmine\world\sound\DoorSound;
class FenceGate extends Transparent{
class FenceGate extends Transparent implements HorizontalFacing, WoodMaterial{
use WoodTypeTrait;
use HorizontalFacingTrait;

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\Ageable;
use pocketmine\block\utils\AgeableTrait;
use pocketmine\block\utils\BlockEventHelper;
use pocketmine\block\utils\SupportType;
@ -35,7 +36,7 @@ use function max;
use function min;
use function mt_rand;
class Fire extends BaseFire{
class Fire extends BaseFire implements Ageable{
use AgeableTrait;
public const MAX_AGE = 15;

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\SignLikeRotation;
use pocketmine\block\utils\SignLikeRotationTrait;
use pocketmine\item\Item;
use pocketmine\math\Facing;
@ -30,7 +31,7 @@ use pocketmine\math\Vector3;
use pocketmine\player\Player;
use pocketmine\world\BlockTransaction;
final class FloorBanner extends BaseBanner{
final class FloorBanner extends BaseBanner implements SignLikeRotation{
use SignLikeRotationTrait;
protected function getSupportingFace() : int{

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\SignLikeRotation;
use pocketmine\block\utils\SignLikeRotationTrait;
use pocketmine\item\Item;
use pocketmine\math\Facing;
@ -30,7 +31,7 @@ use pocketmine\math\Vector3;
use pocketmine\player\Player;
use pocketmine\world\BlockTransaction;
final class FloorSign extends BaseSign{
final class FloorSign extends BaseSign implements SignLikeRotation{
use SignLikeRotationTrait;
protected function getSupportingFace() : int{

View File

@ -23,11 +23,12 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\Ageable;
use pocketmine\block\utils\AgeableTrait;
use pocketmine\block\utils\BlockEventHelper;
use function mt_rand;
class FrostedIce extends Ice{
class FrostedIce extends Ice implements Ageable{
use AgeableTrait;
public const MAX_AGE = 3;

View File

@ -25,6 +25,7 @@ namespace pocketmine\block;
use pocketmine\block\tile\Furnace as TileFurnace;
use pocketmine\block\utils\FacesOppositePlacingPlayerTrait;
use pocketmine\block\utils\Lightable;
use pocketmine\block\utils\LightableTrait;
use pocketmine\crafting\FurnaceType;
use pocketmine\data\runtime\RuntimeDataDescriber;
@ -33,7 +34,7 @@ use pocketmine\math\Vector3;
use pocketmine\player\Player;
use function mt_rand;
class Furnace extends Opaque{
class Furnace extends Opaque implements Lightable{
use FacesOppositePlacingPlayerTrait;
use LightableTrait;

View File

@ -23,10 +23,12 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\Colored;
use pocketmine\block\utils\ColoredTrait;
use pocketmine\block\utils\FacesOppositePlacingPlayerTrait;
use pocketmine\block\utils\HorizontalFacing;
class GlazedTerracotta extends Opaque{
class GlazedTerracotta extends Opaque implements Colored, HorizontalFacing{
use ColoredTrait;
use FacesOppositePlacingPlayerTrait;
}

View File

@ -25,6 +25,7 @@ namespace pocketmine\block;
use pocketmine\block\utils\BlockEventHelper;
use pocketmine\block\utils\MultiAnySupportTrait;
use pocketmine\block\utils\MultiFacing;
use pocketmine\block\utils\SupportType;
use pocketmine\item\Fertilizer;
use pocketmine\item\Item;
@ -35,7 +36,7 @@ use pocketmine\world\World;
use function count;
use function shuffle;
class GlowLichen extends Transparent{
class GlowLichen extends Transparent implements MultiFacing{
use MultiAnySupportTrait;
public function getLightLevel() : int{

View File

@ -23,10 +23,11 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\PillarRotation;
use pocketmine\block\utils\PillarRotationTrait;
use pocketmine\entity\Entity;
class HayBale extends Opaque{
class HayBale extends Opaque implements PillarRotation{
use PillarRotationTrait;
public function getFlameEncouragement() : int{

View File

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\tile\Hopper as TileHopper;
use pocketmine\block\utils\PoweredByRedstone;
use pocketmine\block\utils\PoweredByRedstoneTrait;
use pocketmine\block\utils\SupportType;
use pocketmine\data\runtime\RuntimeDataDescriber;
@ -34,7 +35,7 @@ use pocketmine\math\Vector3;
use pocketmine\player\Player;
use pocketmine\world\BlockTransaction;
class Hopper extends Transparent{
class Hopper extends Transparent implements PoweredByRedstone{
use PoweredByRedstoneTrait;
private int $facing = Facing::DOWN;

View File

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\tile\ItemFrame as TileItemFrame;
use pocketmine\block\utils\AnyFacing;
use pocketmine\block\utils\AnyFacingTrait;
use pocketmine\block\utils\SupportType;
use pocketmine\data\runtime\RuntimeDataDescriber;
@ -39,7 +40,7 @@ use pocketmine\world\sound\ItemFrameRotateItemSound;
use function is_infinite;
use function is_nan;
class ItemFrame extends Flowable{
class ItemFrame extends Flowable implements AnyFacing{
use AnyFacingTrait;
public const ROTATIONS = 8;

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\HorizontalFacing;
use pocketmine\block\utils\HorizontalFacingTrait;
use pocketmine\block\utils\SupportType;
use pocketmine\entity\Entity;
@ -35,7 +36,7 @@ use pocketmine\math\Vector3;
use pocketmine\player\Player;
use pocketmine\world\BlockTransaction;
class Ladder extends Transparent{
class Ladder extends Transparent implements HorizontalFacing{
use HorizontalFacingTrait;
public function hasEntityCollision() : bool{

View File

@ -25,6 +25,7 @@ namespace pocketmine\block;
use pocketmine\block\tile\Lectern as TileLectern;
use pocketmine\block\utils\FacesOppositePlacingPlayerTrait;
use pocketmine\block\utils\HorizontalFacing;
use pocketmine\block\utils\SupportType;
use pocketmine\data\runtime\RuntimeDataDescriber;
use pocketmine\item\Item;
@ -36,7 +37,7 @@ use pocketmine\player\Player;
use pocketmine\world\sound\LecternPlaceBookSound;
use function count;
class Lectern extends Transparent{
class Lectern extends Transparent implements HorizontalFacing{
use FacesOppositePlacingPlayerTrait;
protected int $viewedPage = 0;

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\AnyFacing;
use pocketmine\block\utils\AnyFacingTrait;
use pocketmine\item\Item;
use pocketmine\math\Axis;
@ -32,7 +33,7 @@ use pocketmine\math\Vector3;
use pocketmine\player\Player;
use pocketmine\world\BlockTransaction;
final class LightningRod extends Transparent{
final class LightningRod extends Transparent implements AnyFacing{
use AnyFacingTrait;
protected function recalculateCollisionBoxes() : array{

View File

@ -25,11 +25,12 @@ namespace pocketmine\block;
use pocketmine\block\inventory\LoomInventory;
use pocketmine\block\utils\FacesOppositePlacingPlayerTrait;
use pocketmine\block\utils\HorizontalFacing;
use pocketmine\item\Item;
use pocketmine\math\Vector3;
use pocketmine\player\Player;
final class Loom extends Opaque{
final class Loom extends Opaque implements HorizontalFacing{
use FacesOppositePlacingPlayerTrait;
public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null, array &$returnedItems = []) : bool{

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\Ageable;
use pocketmine\block\utils\AgeableTrait;
use pocketmine\block\utils\FortuneDropHelper;
use pocketmine\block\utils\StaticSupportTrait;
@ -41,7 +42,7 @@ use function mt_rand;
/**
* This class is used for Weeping & Twisting vines, because they have same behaviour
*/
class NetherVines extends Flowable{
class NetherVines extends Flowable implements Ageable{
use AgeableTrait;
use StaticSupportTrait;

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\Ageable;
use pocketmine\block\utils\AgeableTrait;
use pocketmine\block\utils\BlockEventHelper;
use pocketmine\block\utils\FortuneDropHelper;
@ -31,7 +32,7 @@ use pocketmine\item\Item;
use pocketmine\math\Facing;
use function mt_rand;
class NetherWartPlant extends Flowable{
class NetherWartPlant extends Flowable implements Ageable{
use AgeableTrait;
use StaticSupportTrait;

View File

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\BlockEventHelper;
use pocketmine\block\utils\HorizontalFacing;
use pocketmine\block\utils\HorizontalFacingTrait;
use pocketmine\block\utils\StaticSupportTrait;
use pocketmine\data\runtime\RuntimeDataDescriber;
@ -34,7 +35,7 @@ use pocketmine\math\Vector3;
use pocketmine\player\Player;
use pocketmine\world\BlockTransaction;
class PinkPetals extends Flowable{
class PinkPetals extends Flowable implements HorizontalFacing{
use HorizontalFacingTrait;
use StaticSupportTrait {
canBePlacedAt as supportedWhenPlacedAt;

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\Ageable;
use pocketmine\block\utils\AgeableTrait;
use pocketmine\block\utils\BlockEventHelper;
use pocketmine\block\utils\CropGrowthHelper;
@ -38,7 +39,7 @@ use pocketmine\math\Vector3;
use pocketmine\player\Player;
use pocketmine\world\BlockTransaction;
final class PitcherCrop extends Flowable{
final class PitcherCrop extends Flowable implements Ageable{
use AgeableTrait;
use StaticSupportTrait;

View File

@ -23,9 +23,10 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\WoodMaterial;
use pocketmine\block\utils\WoodTypeTrait;
class Planks extends Opaque{
class Planks extends Opaque implements WoodMaterial{
use WoodTypeTrait;
public function getFuelTime() : int{

View File

@ -23,8 +23,9 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\PoweredByRedstone;
use pocketmine\block\utils\RailPoweredByRedstoneTrait;
class PoweredRail extends StraightOnlyRail{
class PoweredRail extends StraightOnlyRail implements PoweredByRedstone{
use RailPoweredByRedstoneTrait;
}

View File

@ -24,8 +24,11 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\tile\Comparator;
use pocketmine\block\utils\AnalogRedstoneSignalEmitter;
use pocketmine\block\utils\AnalogRedstoneSignalEmitterTrait;
use pocketmine\block\utils\HorizontalFacing;
use pocketmine\block\utils\HorizontalFacingTrait;
use pocketmine\block\utils\PoweredByRedstone;
use pocketmine\block\utils\PoweredByRedstoneTrait;
use pocketmine\block\utils\StaticSupportTrait;
use pocketmine\block\utils\SupportType;
@ -38,7 +41,7 @@ use pocketmine\player\Player;
use pocketmine\world\BlockTransaction;
use function assert;
class RedstoneComparator extends Flowable{
class RedstoneComparator extends Flowable implements AnalogRedstoneSignalEmitter, PoweredByRedstone, HorizontalFacing{
use HorizontalFacingTrait;
use AnalogRedstoneSignalEmitterTrait;
use PoweredByRedstoneTrait;

View File

@ -23,10 +23,11 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\PoweredByRedstone;
use pocketmine\block\utils\PoweredByRedstoneTrait;
use pocketmine\data\runtime\RuntimeDataDescriber;
class RedstoneLamp extends Opaque{
class RedstoneLamp extends Opaque implements PoweredByRedstone{
use PoweredByRedstoneTrait;
protected function describeBlockOnlyState(RuntimeDataDescriber $w) : void{

View File

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\FortuneDropHelper;
use pocketmine\block\utils\Lightable;
use pocketmine\block\utils\LightableTrait;
use pocketmine\item\Item;
use pocketmine\item\VanillaItems;
@ -31,7 +32,7 @@ use pocketmine\math\Vector3;
use pocketmine\player\Player;
use function mt_rand;
class RedstoneOre extends Opaque{
class RedstoneOre extends Opaque implements Lightable{
use LightableTrait;
public function getLightLevel() : int{

View File

@ -23,7 +23,9 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\HorizontalFacing;
use pocketmine\block\utils\HorizontalFacingTrait;
use pocketmine\block\utils\PoweredByRedstone;
use pocketmine\block\utils\PoweredByRedstoneTrait;
use pocketmine\block\utils\StaticSupportTrait;
use pocketmine\block\utils\SupportType;
@ -35,7 +37,7 @@ use pocketmine\math\Vector3;
use pocketmine\player\Player;
use pocketmine\world\BlockTransaction;
class RedstoneRepeater extends Flowable{
class RedstoneRepeater extends Flowable implements PoweredByRedstone, HorizontalFacing{
use HorizontalFacingTrait;
use PoweredByRedstoneTrait;
use StaticSupportTrait;

View File

@ -23,10 +23,11 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\Lightable;
use pocketmine\block\utils\LightableTrait;
use pocketmine\data\runtime\RuntimeDataDescriber;
class RedstoneTorch extends Torch{
class RedstoneTorch extends Torch implements Lightable{
use LightableTrait;
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){

View File

@ -23,13 +23,14 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\AnalogRedstoneSignalEmitter;
use pocketmine\block\utils\AnalogRedstoneSignalEmitterTrait;
use pocketmine\block\utils\StaticSupportTrait;
use pocketmine\item\Item;
use pocketmine\item\VanillaItems;
use pocketmine\math\Facing;
class RedstoneWire extends Flowable{
class RedstoneWire extends Flowable implements AnalogRedstoneSignalEmitter{
use AnalogRedstoneSignalEmitterTrait;
use StaticSupportTrait;

View File

@ -24,9 +24,10 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\MultiAnySupportTrait;
use pocketmine\block\utils\MultiFacing;
use pocketmine\block\utils\SupportType;
final class ResinClump extends Transparent{
final class ResinClump extends Transparent implements MultiFacing{
use MultiAnySupportTrait;
public function isSolid() : bool{

123
src/block/RespawnAnchor.php Normal file
View File

@ -0,0 +1,123 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\data\runtime\RuntimeDataDescriber;
use pocketmine\event\block\BlockPreExplodeEvent;
use pocketmine\event\player\PlayerRespawnAnchorUseEvent;
use pocketmine\item\Item;
use pocketmine\item\ItemTypeIds;
use pocketmine\lang\KnownTranslationFactory;
use pocketmine\math\Vector3;
use pocketmine\player\Player;
use pocketmine\utils\TextFormat;
use pocketmine\world\Explosion;
use pocketmine\world\Position;
use pocketmine\world\sound\RespawnAnchorChargeSound;
use pocketmine\world\sound\RespawnAnchorSetSpawnSound;
final class RespawnAnchor extends Opaque{
private const MIN_CHARGES = 0;
private const MAX_CHARGES = 4;
private int $charges = self::MIN_CHARGES;
protected function describeBlockOnlyState(RuntimeDataDescriber $w) : void{
$w->boundedIntAuto(self::MIN_CHARGES, self::MAX_CHARGES, $this->charges);
}
public function getCharges() : int{
return $this->charges;
}
/** @return $this */
public function setCharges(int $charges) : self{
if($charges < self::MIN_CHARGES || $charges > self::MAX_CHARGES){
throw new \InvalidArgumentException("Charges must be between " . self::MIN_CHARGES . " and " . self::MAX_CHARGES . ", given: $charges");
}
$this->charges = $charges;
return $this;
}
public function getLightLevel() : int{
return $this->charges > 0 ? ($this->charges * 4) - 1 : 0;
}
public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null, array &$returnedItems = []) : bool{
if($item->getTypeId() === ItemTypeIds::fromBlockTypeId(BlockTypeIds::GLOWSTONE) && $this->charges < self::MAX_CHARGES){
$this->position->getWorld()->setBlock($this->position, $this->setCharges($this->charges + 1));
$this->position->getWorld()->addSound($this->position, new RespawnAnchorChargeSound());
return true;
}
if($this->charges > self::MIN_CHARGES){
if($player === null){
return false;
}
$ev = new PlayerRespawnAnchorUseEvent($player, $this, PlayerRespawnAnchorUseEvent::ACTION_EXPLODE);
$ev->call();
if($ev->isCancelled()){
return false;
}
switch($ev->getAction()){
case PlayerRespawnAnchorUseEvent::ACTION_EXPLODE:
$this->explode($player);
return true;
case PlayerRespawnAnchorUseEvent::ACTION_SET_SPAWN:
if($player->getSpawn() !== null && $player->getSpawn()->equals($this->position)){
return true;
}
$player->setSpawn($this->position);
$this->position->getWorld()->addSound($this->position, new RespawnAnchorSetSpawnSound());
$player->sendMessage(KnownTranslationFactory::tile_respawn_anchor_respawnSet()->prefix(TextFormat::GRAY));
return true;
}
}
return false;
}
private function explode(?Player $player) : void{
$ev = new BlockPreExplodeEvent($this, 5, $player);
$ev->setIncendiary(true);
$ev->call();
if($ev->isCancelled()){
return;
}
$this->position->getWorld()->setBlock($this->position, VanillaBlocks::AIR());
$explosion = new Explosion(Position::fromObject($this->position->add(0.5, 0.5, 0.5), $this->position->getWorld()), $ev->getRadius(), $this);
$explosion->setFireChance($ev->getFireChance());
if($ev->isBlockBreaking()){
$explosion->explodeA();
}
$explosion->explodeB();
}
}

View File

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\tile\ShulkerBox as TileShulkerBox;
use pocketmine\block\utils\AnyFacing;
use pocketmine\block\utils\AnyFacingTrait;
use pocketmine\block\utils\SupportType;
use pocketmine\data\runtime\RuntimeDataDescriber;
@ -32,7 +33,7 @@ use pocketmine\math\Vector3;
use pocketmine\player\Player;
use pocketmine\world\BlockTransaction;
class ShulkerBox extends Opaque{
class ShulkerBox extends Opaque implements AnyFacing{
use AnyFacingTrait;
protected function describeBlockOnlyState(RuntimeDataDescriber $w) : void{

View File

@ -23,12 +23,13 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\PillarRotation;
use pocketmine\block\utils\PillarRotationTrait;
/**
* @internal This class provides a general base for pillar-like blocks. It **should not** be used for contract binding
* in APIs, because not all pillar-like blocks extend this class.
*/
class SimplePillar extends Opaque{
class SimplePillar extends Opaque implements PillarRotation{
use PillarRotationTrait;
}

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\HorizontalFacing;
use pocketmine\block\utils\HorizontalFacingTrait;
use pocketmine\block\utils\SupportType;
use pocketmine\data\runtime\RuntimeDataDescriber;
@ -36,7 +37,7 @@ use pocketmine\world\BlockTransaction;
use pocketmine\world\Position;
use function mt_rand;
class SmallDripleaf extends Transparent{
class SmallDripleaf extends Transparent implements HorizontalFacing{
use HorizontalFacingTrait;
protected bool $top = false;

View File

@ -23,8 +23,9 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\Colored;
use pocketmine\block\utils\ColoredTrait;
final class StainedGlass extends Glass{
final class StainedGlass extends Glass implements Colored{
use ColoredTrait;
}

View File

@ -23,8 +23,9 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\Colored;
use pocketmine\block\utils\ColoredTrait;
final class StainedGlassPane extends GlassPane{
final class StainedGlassPane extends GlassPane implements Colored{
use ColoredTrait;
}

View File

@ -23,8 +23,9 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\Colored;
use pocketmine\block\utils\ColoredTrait;
final class StainedHardenedClay extends HardenedClay{
final class StainedHardenedClay extends HardenedClay implements Colored{
use ColoredTrait;
}

View File

@ -23,8 +23,9 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\Colored;
use pocketmine\block\utils\ColoredTrait;
final class StainedHardenedGlass extends HardenedGlass{
final class StainedHardenedGlass extends HardenedGlass implements Colored{
use ColoredTrait;
}

View File

@ -23,8 +23,9 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\Colored;
use pocketmine\block\utils\ColoredTrait;
final class StainedHardenedGlassPane extends HardenedGlassPane{
final class StainedHardenedGlassPane extends HardenedGlassPane implements Colored{
use ColoredTrait;
}

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\HorizontalFacing;
use pocketmine\block\utils\HorizontalFacingTrait;
use pocketmine\block\utils\StairShape;
use pocketmine\block\utils\SupportType;
@ -35,7 +36,7 @@ use pocketmine\math\Vector3;
use pocketmine\player\Player;
use pocketmine\world\BlockTransaction;
class Stair extends Transparent{
class Stair extends Transparent implements HorizontalFacing{
use HorizontalFacingTrait;
protected bool $upsideDown = false;

View File

@ -25,11 +25,12 @@ namespace pocketmine\block;
use pocketmine\block\utils\BlockEventHelper;
use pocketmine\block\utils\CropGrowthHelper;
use pocketmine\block\utils\FortuneDropHelper;
use pocketmine\data\runtime\RuntimeDataDescriber;
use pocketmine\item\Item;
use pocketmine\item\VanillaItems;
use pocketmine\math\Facing;
use function array_rand;
use function mt_rand;
abstract class Stem extends Crops{
protected int $facing = Facing::UP;
@ -90,8 +91,10 @@ abstract class Stem extends Crops{
}
public function getDropsForCompatibleTool(Item $item) : array{
//TODO: bit annoying we have to pass an Item instance here
//this should not be affected by Fortune, but still follows a binomial distribution
return [
$this->asItem()->setCount(mt_rand(0, 2))
$this->asItem()->setCount(FortuneDropHelper::binomial(VanillaItems::AIR(), 0, chance: ($this->age + 1) / 15))
];
}
}

View File

@ -25,6 +25,7 @@ namespace pocketmine\block;
use pocketmine\block\inventory\StonecutterInventory;
use pocketmine\block\utils\FacesOppositePlacingPlayerTrait;
use pocketmine\block\utils\HorizontalFacing;
use pocketmine\block\utils\SupportType;
use pocketmine\item\Item;
use pocketmine\math\AxisAlignedBB;
@ -32,7 +33,7 @@ use pocketmine\math\Facing;
use pocketmine\math\Vector3;
use pocketmine\player\Player;
class Stonecutter extends Transparent{
class Stonecutter extends Transparent implements HorizontalFacing{
use FacesOppositePlacingPlayerTrait;
public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null, array &$returnedItems = []) : bool{

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\Ageable;
use pocketmine\block\utils\AgeableTrait;
use pocketmine\block\utils\BlockEventHelper;
use pocketmine\block\utils\StaticSupportTrait;
@ -34,7 +35,7 @@ use pocketmine\player\Player;
use pocketmine\world\BlockTransaction;
use pocketmine\world\Position;
class Sugarcane extends Flowable{
class Sugarcane extends Flowable implements Ageable{
use AgeableTrait;
use StaticSupportTrait {
onNearbyBlockChange as onSupportBlockChange;

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\Ageable;
use pocketmine\block\utils\AgeableTrait;
use pocketmine\block\utils\BlockEventHelper;
use pocketmine\block\utils\FortuneDropHelper;
@ -39,7 +40,7 @@ use pocketmine\player\Player;
use pocketmine\world\sound\SweetBerriesPickSound;
use function mt_rand;
class SweetBerryBush extends Flowable{
class SweetBerryBush extends Flowable implements Ageable{
use AgeableTrait;
use StaticSupportTrait;

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\HorizontalFacing;
use pocketmine\block\utils\HorizontalFacingTrait;
use pocketmine\block\utils\SupportType;
use pocketmine\data\runtime\RuntimeDataDescriber;
@ -34,7 +35,7 @@ use pocketmine\player\Player;
use pocketmine\world\BlockTransaction;
use pocketmine\world\sound\DoorSound;
class Trapdoor extends Transparent{
class Trapdoor extends Transparent implements HorizontalFacing{
use HorizontalFacingTrait;
protected bool $open = false;

Some files were not shown because too many files have changed in this diff Show More