GenisysPro  for Minecraft PE/Windows 10 v1.1.x
Feature-rich server software for Minecraft PE and Windows 10 Edition
Location Class Reference

Public Member Functions

 __construct ($x=0, $y=0, $z=0, $yaw=0.0, $pitch=0.0, Level $level=null)
 
 asLocation ()
 
 add ($x, $y=0, $z=0, $yaw=0, $pitch=0)
 
 getYaw ()
 
 getPitch ()
 
 fromObjectAdd (Vector3 $pos, $x, $y, $z)
 
 __toString ()
 
- Public Member Functions inherited from Position
 __construct ($x=0, $y=0, $z=0, Level $level=null)
 
 asPosition ()
 
 add ($x, $y=0, $z=0)
 
 getLevel ()
 
 setLevel (Level $level=null)
 
 isValid ()
 
 getSide ($side, $step=1)
 
 __toString ()
 
 setComponents ($x, $y, $z)
 
 fromObjectAdd (Vector3 $pos, $x, $y, $z)
 
- Public Member Functions inherited from Vector3
 __construct ($x=0, $y=0, $z=0)
 
 getX ()
 
 getY ()
 
 getZ ()
 
 getFloorX ()
 
 getFloorY ()
 
 getFloorZ ()
 
 getRight ()
 
 getUp ()
 
 getForward ()
 
 getSouth ()
 
 getWest ()
 
 add ($x, $y=0, $z=0)
 
 subtract ($x=0, $y=0, $z=0)
 
 multiply ($number)
 
 divide ($number)
 
 ceil ()
 
 floor ()
 
 round ()
 
 abs ()
 
 getSide ($side, $step=1)
 
 asVector3 ()
 
 distance (Vector3 $pos)
 
 distanceSquared (Vector3 $pos)
 
 maxPlainDistance ($x=0, $z=0)
 
 length ()
 
 lengthSquared ()
 
 normalize ()
 
 dot (Vector3 $v)
 
 cross (Vector3 $v)
 
 equals (Vector3 $v)
 
 getIntermediateWithXValue (Vector3 $v, $x)
 
 getIntermediateWithYValue (Vector3 $v, $y)
 
 getIntermediateWithZValue (Vector3 $v, $z)
 
 setComponents ($x, $y, $z)
 
 fromObjectAdd (Vector3 $pos, $x, $y, $z)
 
 __toString ()
 

Static Public Member Functions

static fromObject (Vector3 $pos, Level $level=null, $yaw=0.0, $pitch=0.0)
 
- Static Public Member Functions inherited from Position
static fromObject (Vector3 $pos, Level $level=null)
 
- Static Public Member Functions inherited from Vector3
static getOppositeSide ($side)
 
static createRandomDirection (Random $random)
 

Data Fields

 $yaw
 
 $pitch
 
- Data Fields inherited from Position
 $level = null
 
- Data Fields inherited from Vector3
const SIDE_DOWN = 0
 
const SIDE_UP = 1
 
const SIDE_NORTH = 2
 
const SIDE_SOUTH = 3
 
const SIDE_WEST = 4
 
const SIDE_EAST = 5
 
 $x
 
 $y
 
 $z
 

Constructor & Destructor Documentation

◆ __construct()

__construct (   $x = 0,
  $y = 0,
  $z = 0,
  $yaw = 0.0,
  $pitch = 0.0,
Level  $level = null 
)
Parameters
int$x
int$y
int$z
float$yaw
float$pitch
Level$level
39  {
40  $this->x = $x;
41  $this->y = $y;
42  $this->z = $z;
43  $this->yaw = $yaw;
44  $this->pitch = $pitch;
45  $this->level = $level;
46  }

Member Function Documentation

◆ __toString()

__toString ( )
Returns
string
120  {
121  return "Location (level=" . ($this->isValid() ? $this->getLevel()->getName() : "null") . ", x=$this->x, y=$this->y, z=$this->z, yaw=$this->yaw, pitch=$this->pitch)";
122  }

◆ add()

add (   $x,
  $y = 0,
  $z = 0,
  $yaw = 0,
  $pitch = 0 
)
Parameters
$x
int$y
int$z
int$yaw
int$pitch
Returns
Location
78  {
79  if($x instanceof Location){
80  return new Location($this->x + $x->x, $this->y + $x->y, $this->z + $x->z, $this->yaw + $x->yaw, $this->pitch + $x->pitch, $this->level);
81  }else{
82  return new Location($this->x + $x, $this->y + $y, $this->z + $z, $this->yaw + $yaw, $this->pitch + $pitch, $this->level);
83  }
84  }

◆ asLocation()

asLocation ( )

Return a Location instance

Returns
Location
65  : Location{
66  return new Location($this->x, $this->y, $this->z, $this->yaw, $this->pitch, $this->level);
67  }

◆ fromObject()

static fromObject ( Vector3  $pos,
Level  $level = null,
  $yaw = 0.0,
  $pitch = 0.0 
)
static
Parameters
Vector3$pos
Level | null$leveldefault null
float$yawdefault 0.0
float$pitchdefault 0.0
Returns
Location
56  {
57  return new Location($pos->x, $pos->y, $pos->z, $yaw, $pitch, ($level === null) ? (($pos instanceof Position) ? $pos->level : null) : $level);
58  }

◆ fromObjectAdd()

fromObjectAdd ( Vector3  $pos,
  $x,
  $y,
  $z 
)
Parameters
Vector3$pos
$x
$y
$z
Returns
$this
108  {
109  if($pos instanceof Location){
110  $this->yaw = $pos->yaw;
111  $this->pitch = $pos->pitch;
112  }
113  parent::fromObjectAdd($pos, $x, $y, $z);
114  return $this;
115  }

◆ getPitch()

getPitch ( )
Returns
float
96  {
97  return $this->pitch;
98  }

◆ getYaw()

getYaw ( )
Returns
float
89  {
90  return $this->yaw;
91  }

Field Documentation

◆ $pitch

$pitch

◆ $yaw

$yaw

The documentation for this class was generated from the following file: