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

Public Member Functions

 getSaveId ()
 
 __construct (Level $level, CompoundTag $nbt)
 
 getId ()
 
 saveNBT ()
 
 getBlock ()
 
 onUpdate ()
 
 scheduleUpdate ()
 
 __destruct ()
 
 close ()
 
 getName ()
 
- 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 init ()
 
static createTile ($type, Level $level, CompoundTag $nbt,... $args)
 
static registerTile ($className)
 
- 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

const BREWING_STAND = "BrewingStand"
 
const CHEST = "Chest"
 
const DL_DETECTOR = "DayLightDetector"
 
const ENCHANT_TABLE = "EnchantTable"
 
const FLOWER_POT = "FlowerPot"
 
const FURNACE = "Furnace"
 
const MOB_SPAWNER = "MobSpawner"
 
const SIGN = "Sign"
 
const SKULL = "Skull"
 
const ITEM_FRAME = "ItemFrame"
 
const DISPENSER = "Dispenser"
 
const DROPPER = "Dropper"
 
const CAULDRON = "Cauldron"
 
const HOPPER = "Hopper"
 
const BEACON = "Beacon"
 
const ENDER_CHEST = "EnderChest"
 
const BED = "Bed"
 
const DAY_LIGHT_DETECTOR = "DLDetector"
 
 $chunk
 
 $name
 
 $id
 
 $x
 
 $y
 
 $z
 
 $attach
 
 $metadata
 
 $closed = false
 
 $namedtag
 
 $tickTimer
 
- 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
 

Static Public Attributes

static $tileCount = 1
 

Protected Attributes

 $lastUpdate
 
 $server
 
 $timings
 

Constructor & Destructor Documentation

◆ __construct()

__construct ( Level  $level,
CompoundTag  $nbt 
)

Tile constructor.

Parameters
Level$level
CompoundTag$nbt
148  {
149  $this->timings = Timings::getTileEntityTimings($this);
150 
151  $this->namedtag = $nbt;
152  $this->server = $level->getServer();
153  $this->setLevel($level);
154  $this->chunk = $level->getChunk($this->namedtag["x"] >> 4, $this->namedtag["z"] >> 4, false);
155  assert($this->chunk !== null);
156 
157  $this->name = "";
158  $this->lastUpdate = microtime(true);
159  $this->id = Tile::$tileCount++;
160  $this->x = (int) $this->namedtag["x"];
161  $this->y = (int) $this->namedtag["y"];
162  $this->z = (int) $this->namedtag["z"];
163 
164  $this->chunk->addTile($this);
165  $this->getLevel()->addTile($this);
166  $this->tickTimer = Timings::getTileEntityTimings($this);
167  }

◆ __destruct()

__destruct ( )
201  {
202  $this->close();
203  }

Member Function Documentation

◆ close()

close ( )
205  {
206  if(!$this->closed){
207  $this->closed = true;
208  unset($this->level->updateTiles[$this->id]);
209  if($this->chunk instanceof Chunk){
210  $this->chunk->removeTile($this);
211  }
212  if(($level = $this->getLevel()) instanceof Level){
213  $level->removeTile($this);
214  }
215  $this->level = null;
216  }
217  }

◆ createTile()

static createTile (   $type,
Level  $level,
CompoundTag  $nbt,
  $args 
)
static
Parameters
string$type
Level$level
CompoundTag$nbt
array$args
Returns
Tile
108  {
109  if(isset(self::$knownTiles[$type])){
110  $class = self::$knownTiles[$type];
111  return new $class($level, $nbt, ...$args);
112  }
113 
114  return null;
115  }

◆ getBlock()

getBlock ( )
Returns
186  {
187  return $this->level->getBlock($this);
188  }

◆ getId()

getId ( )
Returns
int
172  {
173  return $this->id;
174  }

◆ getName()

getName ( )
Returns
string
222  : string{
223  return $this->name;
224  }

◆ getSaveId()

getSaveId ( )

Returns the short save name

Returns
string
138  {
139  return self::$shortNames[static::class];
140  }

◆ init()

static init ( )
static
80  {
81  self::registerTile(Beacon::class);
82  self::registerTile(Bed::class);
83  self::registerTile(BrewingStand::class);
84  self::registerTile(Cauldron::class);
85  self::registerTile(Chest::class);
86  self::registerTile(Dispenser::class);
87  self::registerTile(DLDetector::class);
88  self::registerTile(Dropper::class);
89  self::registerTile(EnchantTable::class);
90  self::registerTile(EnderChest::class);
91  self::registerTile(FlowerPot::class);
92  self::registerTile(Furnace::class);
93  self::registerTile(Hopper::class);
94  self::registerTile(ItemFrame::class);
95  self::registerTile(MobSpawner::class);
96  self::registerTile(Sign::class);
97  self::registerTile(Skull::class);
98  }

◆ onUpdate()

onUpdate ( )
Returns
bool
193  {
194  return false;
195  }

◆ registerTile()

static registerTile (   $className)
static
Parameters
$className
Returns
bool
122  {
123  $class = new \ReflectionClass($className);
124  if(is_a($className, Tile::class, true) and !$class->isAbstract()){
125  self::$knownTiles[$class->getShortName()] = $className;
126  self::$shortNames[$className] = $class->getShortName();
127  return true;
128  }
129 
130  return false;
131  }

◆ saveNBT()

saveNBT ( )
176  {
177  $this->namedtag->id = new StringTag("id", $this->getSaveId());
178  $this->namedtag->x = new IntTag("x", $this->x);
179  $this->namedtag->y = new IntTag("y", $this->y);
180  $this->namedtag->z = new IntTag("z", $this->z);
181  }

◆ scheduleUpdate()

scheduleUpdate ( )
final
197  {
198  $this->level->updateTiles[$this->id] = $this;
199  }

Field Documentation

◆ $attach

$attach

◆ $chunk

$chunk

◆ $closed

$closed = false

◆ $id

$id

◆ $lastUpdate

$lastUpdate
protected

◆ $metadata

$metadata

◆ $name

$name

◆ $namedtag

$namedtag

◆ $server

$server
protected

◆ $tickTimer

$tickTimer

◆ $tileCount

$tileCount = 1
static

◆ $timings

$timings
protected

◆ $x

$x

◆ $y

$y

◆ $z

$z

◆ BEACON

const BEACON = "Beacon"

◆ BED

const BED = "Bed"

◆ BREWING_STAND

const BREWING_STAND = "BrewingStand"

◆ CAULDRON

const CAULDRON = "Cauldron"

◆ CHEST

const CHEST = "Chest"

◆ DAY_LIGHT_DETECTOR

const DAY_LIGHT_DETECTOR = "DLDetector"

◆ DISPENSER

const DISPENSER = "Dispenser"

◆ DL_DETECTOR

const DL_DETECTOR = "DayLightDetector"

◆ DROPPER

const DROPPER = "Dropper"

◆ ENCHANT_TABLE

const ENCHANT_TABLE = "EnchantTable"

◆ ENDER_CHEST

const ENDER_CHEST = "EnderChest"

◆ FLOWER_POT

const FLOWER_POT = "FlowerPot"

◆ FURNACE

const FURNACE = "Furnace"

◆ HOPPER

const HOPPER = "Hopper"

◆ ITEM_FRAME

const ITEM_FRAME = "ItemFrame"

◆ MOB_SPAWNER

const MOB_SPAWNER = "MobSpawner"

◆ SIGN

const SIGN = "Sign"

◆ SKULL

const SKULL = "Skull"

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