Skip to content

Add blocks interfaces for commons properties #6639

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: minor-next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/block/ActivatorRail.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@

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
Expand Down
3 changes: 2 additions & 1 deletion src/block/AmethystCluster.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
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;
Expand All @@ -38,7 +39,7 @@
use pocketmine\utils\AssumptionFailedError;
use pocketmine\world\BlockTransaction;

final class AmethystCluster extends Transparent{
final class AmethystCluster extends Transparent implements AnyFacing{
use AmethystTrait;
use AnyFacingTrait;

Expand Down
3 changes: 2 additions & 1 deletion src/block/Anvil.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
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;
Expand All @@ -41,7 +42,7 @@
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;

Expand Down
3 changes: 2 additions & 1 deletion src/block/Barrel.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
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;
Expand All @@ -33,7 +34,7 @@
use pocketmine\world\BlockTransaction;
use function abs;

class Barrel extends Opaque{
class Barrel extends Opaque implements AnyFacing{
use AnyFacingTrait;

protected bool $open = false;
Expand Down
3 changes: 2 additions & 1 deletion src/block/BaseBanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

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;
Expand All @@ -36,7 +37,7 @@
use function assert;
use function count;

abstract class BaseBanner extends Transparent{
abstract class BaseBanner extends Transparent implements Colored{
use ColoredTrait;

/**
Expand Down
3 changes: 2 additions & 1 deletion src/block/BaseBigDripleaf.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

namespace pocketmine\block;

use pocketmine\block\utils\HorizontalFacing;
use pocketmine\block\utils\HorizontalFacingTrait;
use pocketmine\block\utils\SupportType;
use pocketmine\event\block\StructureGrowEvent;
Expand All @@ -33,7 +34,7 @@
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;
Expand Down
3 changes: 2 additions & 1 deletion src/block/BaseCoral.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@
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{
Expand Down
3 changes: 2 additions & 1 deletion src/block/BaseSign.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
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;
Expand All @@ -44,7 +45,7 @@
use function assert;
use function strlen;

abstract class BaseSign extends Transparent{
abstract class BaseSign extends Transparent implements WoodMaterial{
use WoodTypeTrait;

protected SignText $text;
Expand Down
4 changes: 3 additions & 1 deletion src/block/Bed.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
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;
Expand All @@ -41,7 +43,7 @@
use pocketmine\world\BlockTransaction;
use pocketmine\world\World;

class Bed extends Transparent{
class Bed extends Transparent implements Colored, HorizontalFacing{
use ColoredTrait;
use HorizontalFacingTrait;

Expand Down
3 changes: 2 additions & 1 deletion src/block/Bell.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

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;
Expand All @@ -38,7 +39,7 @@
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;
Expand Down
3 changes: 2 additions & 1 deletion src/block/BoneBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@

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;
}
3 changes: 2 additions & 1 deletion src/block/Button.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

namespace pocketmine\block;

use pocketmine\block\utils\AnyFacing;
use pocketmine\block\utils\AnyFacingTrait;
use pocketmine\data\runtime\RuntimeDataDescriber;
use pocketmine\item\Item;
Expand All @@ -33,7 +34,7 @@
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;
Expand Down
3 changes: 2 additions & 1 deletion src/block/Cactus.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

namespace pocketmine\block;

use pocketmine\block\utils\Ageable;
use pocketmine\block\utils\AgeableTrait;
use pocketmine\block\utils\BlockEventHelper;
use pocketmine\block\utils\StaticSupportTrait;
Expand All @@ -33,7 +34,7 @@
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Facing;

class Cactus extends Transparent{
class Cactus extends Transparent implements Ageable{
use AgeableTrait;
use StaticSupportTrait;

Expand Down
3 changes: 2 additions & 1 deletion src/block/CakeWithCandle.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@
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;
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;
}
Expand Down
3 changes: 2 additions & 1 deletion src/block/CakeWithDyedCandle.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@

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){
Expand Down
4 changes: 3 additions & 1 deletion src/block/Campfire.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@

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;
Expand Down Expand Up @@ -59,7 +61,7 @@
use function min;
use function mt_rand;

class Campfire extends Transparent{
class Campfire extends Transparent implements Lightable, HorizontalFacing{
use HorizontalFacingTrait{
HorizontalFacingTrait::describeBlockOnlyState as encodeFacingState;
}
Expand Down
3 changes: 2 additions & 1 deletion src/block/Candle.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
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;
Expand All @@ -35,7 +36,7 @@
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;
Expand Down
3 changes: 2 additions & 1 deletion src/block/Carpet.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@

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;

Expand Down
3 changes: 2 additions & 1 deletion src/block/CarvedPumpkin.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
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;
}
3 changes: 2 additions & 1 deletion src/block/CaveVines.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

namespace pocketmine\block;

use pocketmine\block\utils\Ageable;
use pocketmine\block\utils\AgeableTrait;
use pocketmine\block\utils\BlockEventHelper;
use pocketmine\block\utils\StaticSupportTrait;
Expand All @@ -39,7 +40,7 @@
use pocketmine\world\sound\GlowBerriesPickSound;
use function mt_rand;

class CaveVines extends Flowable{
class CaveVines extends Flowable implements Ageable{
use AgeableTrait;
use StaticSupportTrait;

Expand Down
3 changes: 2 additions & 1 deletion src/block/Chain.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@

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{
Expand Down
3 changes: 2 additions & 1 deletion src/block/ChemistryTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@
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{
Expand Down
3 changes: 2 additions & 1 deletion src/block/Chest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

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;
Expand All @@ -33,7 +34,7 @@
use pocketmine\math\Vector3;
use pocketmine\player\Player;

class Chest extends Transparent{
class Chest extends Transparent implements HorizontalFacing{
use FacesOppositePlacingPlayerTrait;

protected function recalculateCollisionBoxes() : array{
Expand Down
3 changes: 2 additions & 1 deletion src/block/ChiseledBookshelf.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
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;
Expand All @@ -38,7 +39,7 @@
use pocketmine\player\Player;
use function spl_object_id;

class ChiseledBookshelf extends Opaque{
class ChiseledBookshelf extends Opaque implements HorizontalFacing{
use HorizontalFacingTrait;
use FacesOppositePlacingPlayerTrait;

Expand Down
3 changes: 2 additions & 1 deletion src/block/ChorusFlower.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

namespace pocketmine\block;

use pocketmine\block\utils\Ageable;
use pocketmine\block\utils\AgeableTrait;
use pocketmine\block\utils\StaticSupportTrait;
use pocketmine\entity\projectile\Projectile;
Expand All @@ -40,7 +41,7 @@
use function min;
use function mt_rand;

final class ChorusFlower extends Flowable{
final class ChorusFlower extends Flowable implements Ageable{
use AgeableTrait;
use StaticSupportTrait;

Expand Down
Loading