diff --git a/src/pocketmine/block/BlockFactory.php b/src/pocketmine/block/BlockFactory.php index a18489588..3b8e97698 100644 --- a/src/pocketmine/block/BlockFactory.php +++ b/src/pocketmine/block/BlockFactory.php @@ -213,6 +213,7 @@ class BlockFactory{ self::register(new NetherBrick(new BID(Block::RED_NETHER_BRICK), "Red Nether Bricks")); self::register(new NetherBrickFence(new BID(Block::NETHER_BRICK_FENCE), "Nether Brick Fence")); self::register(new NetherBrickStairs(new BID(Block::NETHER_BRICK_STAIRS), "Nether Brick Stairs")); + self::register(new NetherPortal(new BID(Block::PORTAL), "Nether Portal")); self::register(new NetherQuartzOre(new BID(Block::NETHER_QUARTZ_ORE), "Nether Quartz Ore")); self::register(new NetherReactor(new BID(Block::NETHERREACTOR), "Nether Reactor Core")); self::register(new NetherWartBlock(new BID(Block::NETHER_WART_BLOCK), "Nether Wart Block")); diff --git a/src/pocketmine/block/NetherPortal.php b/src/pocketmine/block/NetherPortal.php new file mode 100644 index 000000000..39b448522 --- /dev/null +++ b/src/pocketmine/block/NetherPortal.php @@ -0,0 +1,96 @@ +axis = $stateMeta === 2 ? Facing::AXIS_Z : Facing::AXIS_X; //mojang u dumb + } + + protected function writeStateToMeta() : int{ + return $this->axis === Facing::AXIS_Z ? 2 : 1; + } + + public function getStateBitmask() : int{ + return 0b11; + } + + /** + * @return int + */ + public function getAxis() : int{ + return $this->axis; + } + + /** + * @param int $axis + * @throws \InvalidArgumentException + */ + public function setAxis(int $axis) : void{ + if($axis !== Facing::AXIS_X and $axis !== Facing::AXIS_Z){ + throw new \InvalidArgumentException("Invalid axis"); + } + $this->axis = $axis; + } + + public function getLightLevel() : int{ + return 11; + } + + public function isSolid() : bool{ + return false; + } + + public function getBoundingBox() : ?AxisAlignedBB{ + return null; + } + + public function isBreakable(Item $item) : bool{ + return false; + } + + public function getHardness() : float{ + return -1; + } + + public function getBlastResistance() : float{ + return 0; + } + + public function getDrops(Item $item) : array{ + return []; + } + + public function onEntityInside(Entity $entity) : void{ + //TODO + } +}