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

Public Member Functions

 __construct ($x=0, $y=0, $z=0, Level $level=null)
 
 getLevel ()
 
 setLevel (Level $level=null)
 
 getSide ($side, $step=1)
 
 __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)
 
- 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)
 

Protected Attributes

 $levelId = -1
 

Additional Inherited Members

- 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,
Level  $level = null 
)
Parameters
int$x
int$y
int$z
Level$level
37  {
38  $this->x = $x;
39  $this->y = $y;
40  $this->z = $z;
41  $this->levelId = ($level !== null ? $level->getId() : -1);
42  }

Member Function Documentation

◆ __toString()

__toString ( )
Returns
string
96  {
97  return "Weak" . parent::__toString();
98  }

◆ fromObject()

static fromObject ( Vector3  $pos,
Level  $level = null 
)
static
Parameters
Vector3$pos
Level | null$level
Returns
WeakPosition
50  {
51  return new WeakPosition($pos->x, $pos->y, $pos->z, $level);
52  }

◆ getLevel()

getLevel ( )
Returns
Level|null
57  {
58  return Server::getInstance()->getLevel($this->levelId);
59  }

◆ getSide()

getSide (   $side,
  $step = 1 
)

Returns a side Vector

Parameters
int$side
int$step
Returns
WeakPosition
Exceptions
LevelException
87  {
88  assert($this->isValid());
89 
90  return WeakPosition::fromObject(parent::getSide($side, $step), $this->level);
91  }

◆ setLevel()

setLevel ( Level  $level = null)
Parameters
Level | null$level
Returns
$this
Exceptions
68  {
69  if($level !== null and $level->isClosed()){
70  throw new \InvalidArgumentException("Specified level has been unloaded and cannot be used");
71  }
72 
73  $this->levelId = ($level !== null ? $level->getId() : -1);
74  return $this;
75  }

Field Documentation

◆ $levelId

$levelId = -1
protected

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