mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 02:08:21 +00:00
Update for pocketmine/math Axis refactor
This commit is contained in:
@ -25,23 +25,23 @@ namespace pocketmine\block;
|
||||
|
||||
use pocketmine\entity\Entity;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\math\Axis;
|
||||
use pocketmine\math\AxisAlignedBB;
|
||||
use pocketmine\math\Facing;
|
||||
|
||||
class NetherPortal extends Transparent{
|
||||
/** @var int */
|
||||
protected $axis = Facing::AXIS_X;
|
||||
protected $axis = Axis::X;
|
||||
|
||||
public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){
|
||||
parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::indestructible(0.0));
|
||||
}
|
||||
|
||||
public function readStateFromData(int $id, int $stateMeta) : void{
|
||||
$this->axis = $stateMeta === BlockLegacyMetadata::NETHER_PORTAL_AXIS_Z ? Facing::AXIS_Z : Facing::AXIS_X; //mojang u dumb
|
||||
$this->axis = $stateMeta === BlockLegacyMetadata::NETHER_PORTAL_AXIS_Z ? Axis::Z : Axis::X; //mojang u dumb
|
||||
}
|
||||
|
||||
protected function writeStateToMeta() : int{
|
||||
return $this->axis === Facing::AXIS_Z ? BlockLegacyMetadata::NETHER_PORTAL_AXIS_Z : BlockLegacyMetadata::NETHER_PORTAL_AXIS_X;
|
||||
return $this->axis === Axis::Z ? BlockLegacyMetadata::NETHER_PORTAL_AXIS_Z : BlockLegacyMetadata::NETHER_PORTAL_AXIS_X;
|
||||
}
|
||||
|
||||
public function getStateBitmask() : int{
|
||||
@ -57,7 +57,7 @@ class NetherPortal extends Transparent{
|
||||
* @return $this
|
||||
*/
|
||||
public function setAxis(int $axis) : self{
|
||||
if($axis !== Facing::AXIS_X and $axis !== Facing::AXIS_Z){
|
||||
if($axis !== Axis::X and $axis !== Axis::Z){
|
||||
throw new \InvalidArgumentException("Invalid axis");
|
||||
}
|
||||
$this->axis = $axis;
|
||||
|
Reference in New Issue
Block a user