Merge branch 'master' into mcpe-1.2

This commit is contained in:
Dylan K. Taylor
2017-08-19 21:42:33 +01:00
71 changed files with 286 additions and 219 deletions

View File

@@ -30,4 +30,6 @@ class ActivatorRail extends Rail{
public function getName() : string{
return "Activator Rail";
}
//TODO
}

View File

@@ -377,12 +377,7 @@ class Block extends Position implements BlockIds, Metadatable{
*/
public static function get(int $id, int $meta = 0, Position $pos = null) : Block{
try{
$block = self::$fullList[($id << 4) | $meta];
if($block !== null){
$block = clone $block;
}else{
$block = new UnknownBlock($id, $meta);
}
$block = clone self::$fullList[($id << 4) | $meta];
}catch(\RuntimeException $e){
//TODO: this probably should return null (out of bounds IDs may cause unexpected behaviour)
$block = new UnknownBlock($id, $meta);
@@ -398,8 +393,9 @@ class Block extends Position implements BlockIds, Metadatable{
return $block;
}
/** @var int */
protected $id;
/** @var int */
protected $meta = 0;
/** @var string */
protected $fallbackName;
@@ -460,6 +456,19 @@ class Block extends Position implements BlockIds, Metadatable{
$this->meta = $meta & 0x0f;
}
/**
* Bitmask to use to remove superfluous information from block meta when getting its item form or name.
* This defaults to -1 (don't remove any data). Used to remove rotation data and bitflags from block drops.
*
* If your block should not have any meta value when it's dropped as an item, override this to return 0 in
* descendent classes.
*
* @return int
*/
public function getVariantBitmask() : int{
return -1;
}
/**
* Places the Block, using block space and block target, and side. Returns if the block has been placed.
*
@@ -497,7 +506,7 @@ class Block extends Position implements BlockIds, Metadatable{
* @return bool
*/
public function onBreak(Item $item) : bool{
return $this->getLevel()->setBlock($this, new Air(), true, true);
return $this->getLevel()->setBlock($this, Block::get(Block::AIR), true, true);
}
/**
@@ -658,7 +667,7 @@ class Block extends Position implements BlockIds, Metadatable{
*/
public function getDrops(Item $item) : array{
return [
Item::get($this->getItemId(), $this->getDamage(), 1),
Item::get($this->getItemId(), $this->getDamage() & $this->getVariantBitmask(), 1),
];
}

View File

@@ -44,4 +44,10 @@ class BrewingStand extends Transparent{
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getVariantBitmask() : int{
return 0;
}
//TODO
}

View File

@@ -67,7 +67,7 @@ class BrownMushroom extends Flowable{
return false;
}
public function getBoundingBox(){
protected function recalculateBoundingBox(){
return null;
}

View File

@@ -118,11 +118,13 @@ class BurningFurnace extends Solid{
return true;
}
public function getVariantBitmask() : int{
return 0;
}
public function getDrops(Item $item) : array{
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [
Item::get($this->getItemId(), 0, 1)
];
return parent::getDrops($item);
}
return [];

View File

@@ -90,7 +90,7 @@ class Cactus extends Transparent{
for($y = 1; $y < 3; ++$y){
$b = $this->getLevel()->getBlock(new Vector3($this->x, $this->y + $y, $this->z));
if($b->getId() === self::AIR){
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($b, new Cactus()));
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($b, Block::get(Block::CACTUS)));
if(!$ev->isCancelled()){
$this->getLevel()->setBlock($b, $ev->getNewState(), true);
}
@@ -125,9 +125,7 @@ class Cactus extends Transparent{
return false;
}
public function getDrops(Item $item) : array{
return [
Item::get($this->getItemId(), 0, 1)
];
public function getVariantBitmask() : int{
return 0;
}
}

View File

@@ -76,7 +76,7 @@ class Cake extends Transparent implements FoodSource{
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(Vector3::SIDE_DOWN)->getId() === self::AIR){ //Replace with common break method
$this->getLevel()->setBlock($this, new Air(), true);
$this->getLevel()->setBlock($this, Block::get(Block::AIR), true);
return Level::BLOCK_UPDATE_NORMAL;
}
@@ -114,7 +114,7 @@ class Cake extends Transparent implements FoodSource{
$clone = clone $this;
$clone->meta++;
if($clone->meta >= 0x06){
$clone = new Air();
$clone = Block::get(Block::AIR);
}
return $clone;
}

View File

@@ -129,7 +129,7 @@ class Chest extends Transparent{
if($t instanceof TileChest){
$t->unpair();
}
$this->getLevel()->setBlock($this, new Air(), true, true);
$this->getLevel()->setBlock($this, Block::get(Block::AIR), true, true);
return true;
}
@@ -169,10 +169,8 @@ class Chest extends Transparent{
return true;
}
public function getDrops(Item $item) : array{
return [
Item::get($this->getItemId(), 0, 1)
];
public function getVariantBitmask() : int{
return 0;
}
public function getFuelTime() : int{

View File

@@ -34,4 +34,6 @@ class CocoaBlock extends Solid{
public function getName() : string{
return "Cocoa Block";
}
//TODO
}

View File

@@ -42,4 +42,6 @@ class DaylightSensor extends Transparent{
public function getFuelTime() : int{
return 300;
}
//TODO
}

View File

@@ -30,4 +30,6 @@ class DetectorRail extends Rail{
public function getName() : string{
return "Detector Rail";
}
//TODO
}

View File

@@ -204,9 +204,9 @@ abstract class Door extends Transparent{
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(Vector3::SIDE_DOWN)->getId() === self::AIR){ //Replace with common break method
$this->getLevel()->setBlock($this, new Air(), false);
$this->getLevel()->setBlock($this, Block::get(Block::AIR), false);
if($this->getSide(Vector3::SIDE_UP) instanceof Door){
$this->getLevel()->setBlock($this->getSide(Vector3::SIDE_UP), new Air(), false);
$this->getLevel()->setBlock($this->getSide(Vector3::SIDE_UP), Block::get(Block::AIR), false);
}
return Level::BLOCK_UPDATE_NORMAL;
@@ -250,15 +250,15 @@ abstract class Door extends Transparent{
if(($this->getDamage() & 0x08) === 0x08){
$down = $this->getSide(Vector3::SIDE_DOWN);
if($down->getId() === $this->getId()){
$this->getLevel()->setBlock($down, new Air(), true);
$this->getLevel()->setBlock($down, Block::get(Block::AIR), true);
}
}else{
$up = $this->getSide(Vector3::SIDE_UP);
if($up->getId() === $this->getId()){
$this->getLevel()->setBlock($up, new Air(), true);
$this->getLevel()->setBlock($up, Block::get(Block::AIR), true);
}
}
$this->getLevel()->setBlock($this, new Air(), true);
$this->getLevel()->setBlock($this, Block::get(Block::AIR), true);
return true;
}
@@ -282,4 +282,8 @@ abstract class Door extends Transparent{
return true;
}
public function getVariantBitmask() : int{
return 0;
}
}

View File

@@ -104,6 +104,10 @@ class DoublePlant extends Flowable{
return false;
}
public function getVariantBitmask() : int{
return 0x07;
}
public function getDrops(Item $item) : array{
if(!$item->isShears() and ($this->meta === 2 or $this->meta === 3)){ //grass or fern
if(mt_rand(0, 24) === 0){
@@ -115,8 +119,6 @@ class DoublePlant extends Flowable{
return [];
}
return [
Item::get($this->getItemId(), $this->getDamage() & 0x07, 1)
];
return parent::getDrops($item);
}
}

View File

@@ -92,9 +92,7 @@ class EnchantingTable extends Transparent{
public function getDrops(Item $item) : array{
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [
Item::get($this->getItemId(), 0, 1)
];
return parent::getDrops($item);
}
return [];

View File

@@ -19,8 +19,9 @@
*
*/
namespace pocketmine\block;
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\math\AxisAlignedBB;
@@ -97,10 +98,7 @@ class EndRod extends Flowable{
return null;
}
public function getDrops(Item $item) : array{
return [
Item::get($this->getId(), 0, 1)
];
public function getVariantBitmask() : int{
return 0;
}
}

View File

@@ -75,10 +75,8 @@ class FenceGate extends Transparent{
return true;
}
public function getDrops(Item $item) : array{
return [
Item::get($this->getItemId(), 0, 1)
];
public function getVariantBitmask() : int{
return 0;
}
public function onActivate(Item $item, Player $player = null) : bool{

View File

@@ -87,14 +87,14 @@ class Fire extends Flowable{
return false;
}
}
$this->getLevel()->setBlock($this, new Air(), true);
$this->getLevel()->setBlock($this, Block::get(Block::AIR), true);
return Level::BLOCK_UPDATE_NORMAL;
}elseif($type === Level::BLOCK_UPDATE_RANDOM){
if($this->getSide(Vector3::SIDE_DOWN)->getId() !== self::NETHERRACK){
if(mt_rand(0, 2) === 0){
if($this->meta === 0x0F){
$this->level->setBlock($this, new Air());
$this->level->setBlock($this, Block::get(Block::AIR));
}else{
$this->meta++;
$this->level->setBlock($this, $this);

View File

@@ -52,11 +52,13 @@ class GlazedTerracotta extends Solid{
return $this->getLevel()->setBlock($block, $this, true, true);
}
public function getVariantBitmask() : int{
return 0;
}
public function getDrops(Item $item) : array{
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [
Item::get($this->getItemId(), 0, 1)
];
return parent::getDrops($item);
}
return [];

View File

@@ -105,12 +105,12 @@ class Grass extends Solid{
return true;
}elseif($item->isHoe()){
$item->useOn($this);
$this->getLevel()->setBlock($this, new Farmland());
$this->getLevel()->setBlock($this, Block::get(Block::FARMLAND));
return true;
}elseif($item->isShovel() and $this->getSide(Vector3::SIDE_UP)->getId() === Block::AIR){
$item->useOn($this);
$this->getLevel()->setBlock($this, new GrassPath());
$this->getLevel()->setBlock($this, Block::get(Block::GRASS_PATH));
return true;
}

View File

@@ -53,9 +53,7 @@ class Gravel extends Fallable{
];
}
return [
Item::get(Item::GRAVEL, 0, 1)
];
return parent::getDrops($item);
}
}

View File

@@ -58,10 +58,7 @@ class HayBale extends Solid{
return true;
}
public function getDrops(Item $item) : array{
return [
Item::get($this->getItemId(), 0, 1)
];
public function getVariantBitmask() : int{
return 0x03;
}
}

View File

@@ -52,7 +52,7 @@ class Ice extends Transparent{
}
public function onBreak(Item $item) : bool{
$this->getLevel()->setBlock($this, new Water(), true);
$this->getLevel()->setBlock($this, Block::get(Block::WATER), true);
return true;
}

View File

@@ -46,11 +46,13 @@ class IronBars extends Thin{
return Tool::TYPE_PICKAXE;
}
public function getVariantBitmask() : int{
return 0;
}
public function getDrops(Item $item) : array{
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [
Item::get($this->getItemId(), 0, 1)
];
return parent::getDrops($item);
}
return [];

View File

@@ -139,10 +139,7 @@ class ItemFrame extends Flowable{
}
public function getDrops(Item $item) : array{
return [
Item::get($this->getItemId(), 0, 1)
];
public function getVariantBitmask() : int{
return 0;
}
}

View File

@@ -149,9 +149,7 @@ class Ladder extends Transparent{
return Tool::TYPE_AXE;
}
public function getDrops(Item $item) : array{
return [
Item::get($this->getItemId(), 0, 1)
];
public function getVariantBitmask() : int{
return 0;
}
}

View File

@@ -241,7 +241,7 @@ abstract class Liquid extends Transparent{
if($k !== $decay){
$decay = $k;
if($decay < 0){
$this->getLevel()->setBlock($this, new Air(), true, true);
$this->getLevel()->setBlock($this, Block::get(Block::AIR), true, true);
}else{
$this->getLevel()->setBlock($this, Block::get($this->id, $decay), true, true);
$this->getLevel()->scheduleDelayedBlockUpdate($this, $this->tickRate());
@@ -442,7 +442,7 @@ abstract class Liquid extends Transparent{
}
}
public function getBoundingBox(){
protected function recalculateBoundingBox(){
return null;
}

View File

@@ -68,7 +68,7 @@ class MelonStem extends Crops{
$side = $this->getSide(mt_rand(2, 5));
$d = $side->getSide(Vector3::SIDE_DOWN);
if($side->getId() === self::AIR and ($d->getId() === self::FARMLAND or $d->getId() === self::GRASS or $d->getId() === self::DIRT)){
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($side, new Melon()));
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($side, Block::get(Block::MELON_BLOCK)));
if(!$ev->isCancelled()){
$this->getLevel()->setBlock($side, $ev->getNewState(), true);
}

View File

@@ -23,8 +23,6 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class MossyCobblestone extends Cobblestone{

View File

@@ -65,7 +65,7 @@ class Mycelium extends Solid{
$block = $this->getLevel()->getBlock(new Vector3($x, $y, $z));
if($block->getId() === Block::DIRT){
if($block->getSide(Vector3::SIDE_UP) instanceof Transparent){
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockSpreadEvent($block, $this, new Mycelium()));
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockSpreadEvent($block, $this, Block::get(Block::MYCELIUM)));
if(!$ev->isCancelled()){
$this->getLevel()->setBlock($block, $ev->getNewState());
}

View File

@@ -29,6 +29,10 @@ class NetherBrickStairs extends Stair{
protected $id = self::NETHER_BRICK_STAIRS;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName() : string{
return "Nether Brick Stairs";
}
@@ -41,8 +45,4 @@ class NetherBrickStairs extends Stair{
return Tool::TYPE_PICKAXE;
}
public function __construct(int $meta = 0){
$this->meta = $meta;
}
}

View File

@@ -55,11 +55,13 @@ class Prismarine extends Solid{
return Tool::TYPE_PICKAXE;
}
public function getVariantBitmask() : int{
return 0x03;
}
public function getDrops(Item $item) : array{
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [
Item::get($this->getItemId(), $this->getDamage() & 0x03, 1)
];
return parent::getDrops($item);
}
return [];

View File

@@ -56,4 +56,7 @@ class Pumpkin extends Solid{
return true;
}
public function getVariantBitmask() : int{
return 0;
}
}

View File

@@ -68,7 +68,7 @@ class PumpkinStem extends Crops{
$side = $this->getSide(mt_rand(2, 5));
$d = $side->getSide(Vector3::SIDE_DOWN);
if($side->getId() === self::AIR and ($d->getId() === self::FARMLAND or $d->getId() === self::GRASS or $d->getId() === self::DIRT)){
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($side, new Pumpkin()));
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($side, Block::get(Block::PUMPKIN)));
if(!$ev->isCancelled()){
$this->getLevel()->setBlock($side, $ev->getNewState(), true);
}

View File

@@ -57,11 +57,13 @@ class Quartz extends Solid{
return Tool::TYPE_PICKAXE;
}
public function getVariantBitmask() : int{
return 0x03;
}
public function getDrops(Item $item) : array{
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [
Item::get($this->getItemId(), $this->getDamage() & 0x03, 1)
];
return parent::getDrops($item);
}
return [];

View File

@@ -75,4 +75,8 @@ class Rail extends Flowable{
return false;
}
public function getVariantBitmask() : int{
return 0;
}
}

View File

@@ -55,11 +55,13 @@ class Sandstone extends Solid{
return Tool::TYPE_PICKAXE;
}
public function getVariantBitmask() : int{
return 0x03;
}
public function getDrops(Item $item) : array{
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [
Item::get($this->getItemId(), $this->getDamage() & 0x03, 1)
];
return parent::getDrops($item);
}
return [];

View File

@@ -55,7 +55,7 @@ class SignPost extends Transparent{
return "Sign Post";
}
public function getBoundingBox(){
protected function recalculateBoundingBox(){
return null;
}
@@ -114,4 +114,8 @@ class SignPost extends Transparent{
public function getToolType() : int{
return Tool::TYPE_AXE;
}
public function getVariantBitmask() : int{
return 0;
}
}

View File

@@ -24,16 +24,11 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\ColorBlockMetaHelper;
use pocketmine\item\Item;
class StainedGlass extends Glass{
protected $id = self::STAINED_GLASS;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName() : string{
return ColorBlockMetaHelper::getColorFromMeta($this->meta) . " Stained Glass";
}

View File

@@ -24,16 +24,11 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\ColorBlockMetaHelper;
use pocketmine\item\Item;
class StainedGlassPane extends GlassPane{
protected $id = self::STAINED_GLASS_PANE;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName() : string{
return ColorBlockMetaHelper::getColorFromMeta($this->meta) . " Stained Glass Pane";
}

View File

@@ -145,11 +145,13 @@ abstract class Stair extends Transparent{
return true;
}
public function getVariantBitmask() : int{
return 0;
}
public function getDrops(Item $item) : array{
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [
Item::get($this->getItemId(), 0, 1)
];
return parent::getDrops($item);
}
return [];

View File

@@ -58,9 +58,7 @@ class StoneBricks extends Solid{
public function getDrops(Item $item) : array{
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [
Item::get($this->getItemId(), $this->getDamage() & 0x03, 1)
];
return parent::getDrops($item);
}
return [];

View File

@@ -38,4 +38,8 @@ class StoneButton extends Flowable{
public function getHardness() : float{
return 0.5;
}
public function getVariantBitmask() : int{
return 0;
}
}

View File

@@ -42,4 +42,8 @@ class StonePressurePlate extends Transparent{
public function getHardness() : float{
return 0.5;
}
public function getVariantBitmask() : int{
return 0;
}
}

View File

@@ -50,7 +50,7 @@ class Sugarcane extends Flowable{
for($y = 1; $y < 3; ++$y){
$b = $this->getLevel()->getBlock(new Vector3($this->x, $this->y + $y, $this->z));
if($b->getId() === self::AIR){
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($b, new Sugarcane()));
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($b, Block::get(Block::SUGARCANE_BLOCK)));
if(!$ev->isCancelled()){
$this->getLevel()->setBlock($b, $ev->getNewState(), true);
}
@@ -84,7 +84,7 @@ class Sugarcane extends Flowable{
for($y = 1; $y < 3; ++$y){
$b = $this->getLevel()->getBlock(new Vector3($this->x, $this->y + $y, $this->z));
if($b->getId() === self::AIR){
$this->getLevel()->setBlock($b, new Sugarcane(), true);
$this->getLevel()->setBlock($b, Block::get(Block::SUGARCANE_BLOCK), true);
break;
}
}
@@ -105,7 +105,7 @@ class Sugarcane extends Flowable{
public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{
$down = $this->getSide(Vector3::SIDE_DOWN);
if($down->getId() === self::SUGARCANE_BLOCK){
$this->getLevel()->setBlock($block, new Sugarcane(), true);
$this->getLevel()->setBlock($block, Block::get(Block::SUGARCANE_BLOCK), true);
return true;
}elseif($down->getId() === self::GRASS or $down->getId() === self::DIRT or $down->getId() === self::SAND){
@@ -114,7 +114,7 @@ class Sugarcane extends Flowable{
$block2 = $down->getSide(Vector3::SIDE_WEST);
$block3 = $down->getSide(Vector3::SIDE_EAST);
if(($block0 instanceof Water) or ($block1 instanceof Water) or ($block2 instanceof Water) or ($block3 instanceof Water)){
$this->getLevel()->setBlock($block, new Sugarcane(), true);
$this->getLevel()->setBlock($block, Block::get(Block::SUGARCANE_BLOCK), true);
return true;
}
@@ -122,4 +122,8 @@ class Sugarcane extends Flowable{
return false;
}
public function getVariantBitmask() : int{
return 0;
}
}

View File

@@ -60,7 +60,7 @@ class TNT extends Solid{
}
public function ignite(int $fuse = 80){
$this->getLevel()->setBlock($this, new Air(), true);
$this->getLevel()->setBlock($this, Block::get(Block::AIR), true);
$mot = (new Random())->nextSignedFloat() * M_PI * 2;
$tnt = Entity::createEntity("PrimedTNT", $this->getLevel(), new CompoundTag("", [

View File

@@ -64,7 +64,7 @@ class TallGrass extends Flowable{
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(Vector3::SIDE_DOWN)->isTransparent() === true){ //Replace with common break method
$this->getLevel()->setBlock($this, new Air(), true, true);
$this->getLevel()->setBlock($this, Block::get(Block::AIR), true, true);
return Level::BLOCK_UPDATE_NORMAL;
}

View File

@@ -93,9 +93,7 @@ class Torch extends Flowable{
return false;
}
public function getDrops(Item $item) : array{
return [
Item::get($this->getItemId(), 0, 1)
];
public function getVariantBitmask() : int{
return 0;
}
}

View File

@@ -140,10 +140,8 @@ class Trapdoor extends Transparent{
return true;
}
public function getDrops(Item $item) : array{
return [
Item::get($this->getItemId(), 0, 1)
];
public function getVariantBitmask() : int{
return 0;
}
public function onActivate(Item $item, Player $player = null) : bool{

View File

@@ -34,4 +34,10 @@ class TripwireHook extends Flowable{
public function getName() : string{
return "Tripwire Hook";
}
public function getVariantBitmask() : int{
return 0;
}
//TODO
}

View File

@@ -174,11 +174,13 @@ class Vine extends Transparent{
return false;
}
public function getVariantBitmask() : int{
return 0;
}
public function getDrops(Item $item) : array{
if($item->isShears()){
return [
Item::get($this->getItemId(), 0, 1)
];
return parent::getDrops($item);
}
return [];

View File

@@ -80,9 +80,7 @@ class WaterLily extends Flowable{
return false;
}
public function getDrops(Item $item) : array{
return [
Item::get($this->getItemId(), 0, 1)
];
public function getVariantBitmask() : int{
return 0;
}
}

View File

@@ -42,4 +42,8 @@ class WeightedPressurePlateLight extends Transparent{
public function getHardness() : float{
return 0.5;
}
public function getVariantBitmask() : int{
return 0;
}
}

View File

@@ -69,10 +69,8 @@ class Wood extends Solid{
return true;
}
public function getDrops(Item $item) : array{
return [
Item::get($this->getItemId(), $this->getDamage() & 0x03, 1)
];
public function getVariantBitmask() : int{
return 0x03;
}
public function getToolType() : int{

View File

@@ -23,7 +23,6 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class WoodenDoor extends Door{
@@ -35,10 +34,4 @@ class WoodenDoor extends Door{
public function getToolType() : int{
return Tool::TYPE_AXE;
}
public function getDrops(Item $item) : array{
return [
Item::get($this->getItemId(), 0, 1)
];
}
}

View File

@@ -129,10 +129,8 @@ class WoodenSlab extends Transparent{
return Tool::TYPE_AXE;
}
public function getDrops(Item $item) : array{
return [
Item::get($this->getItemId(), $this->getDamage() & 0x07, 1)
];
public function getVariantBitmask() : int{
return 0x07;
}
public function getFuelTime() : int{

View File

@@ -41,8 +41,9 @@ class WoodenStairs extends Stair{
}
public function getDrops(Item $item) : array{
//TODO: Hierarchy problem (base class is for stone stairs)
return [
Item::get($this->getItemId(), 0, 1)
Item::get($this->getItemId(), $this->getDamage() & $this->getVariantBitmask(), 1)
];
}
}