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

Public Member Functions

 __construct (Level $level, CompoundTag $nbt)
 
 getLightByTime ()
 
 isActivated ()
 
 getSpawnCompound ()
 
- Public Member Functions inherited from Spawnable
 spawnTo (Player $player)
 
 __construct (Level $level, CompoundTag $nbt)
 
 spawnToAll ()
 
 getSpawnCompound ()
 
 updateCompoundTag (CompoundTag $nbt, Player $player)
 
- Public Member Functions inherited from Tile
 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 ()
 

Additional Inherited Members

- Static Public Member Functions inherited from Tile
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 inherited from Tile
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 inherited from Tile
static $tileCount = 1
 
- Protected Member Functions inherited from Spawnable
 onChanged ()
 
- Protected Attributes inherited from Tile
 $lastUpdate
 
 $server
 
 $timings
 

Constructor & Destructor Documentation

◆ __construct()

__construct ( Level  $level,
CompoundTag  $nbt 
)

DLDetector constructor.

Parameters
Level$level
CompoundTag$nbt
40  {
41  parent::__construct($level, $nbt);
42  $this->scheduleUpdate();
43  }

Member Function Documentation

◆ getLightByTime()

getLightByTime ( )
Returns
int
48  {
49  /* $strength = 1;
50  $time = $this->getLevel()->getTime();
51  if(WeatherManager::isRegistered($this->getLevel())) $weather = $this->getLevel()->getWeather()->getWeather();
52  else $weather = Weather::SUNNY;
53  switch($weather){
54  case Weather::SUNNY:
55  if($time <= 22340 and $time >= 13680) $strength = 1;
56  if($time <= 22800 and $time >= 13220) $strength = 2;
57  if($time <= 23080 and $time >= 12940) $strength = 3;
58  if($time <= 23300 and $time >= 12720) $strength = 4;
59  if($time <= 23540 and $time >= 12480) $strength = 5;
60  if($time <= 23780 and $time >= 12240) $strength = 6;
61  if($time <= 23960 and $time >= 12040) $strength = 7;
62  if($time >= 180 and $time <= 11840) $strength = 8;
63  if($time >= 540 and $time <= 11480) $strength = 9;
64  if($time >= 940 and $time <= 11080) $strength = 10;
65  if($time >= 1380 and $time <= 10640) $strength = 11;
66  if($time >= 1880 and $time <= 10140) $strength = 12;
67  if($time >= 2460 and $time <= 9560) $strength = 13;
68  if($time >= 3180 and $time <= 8840) $strength = 14;
69  if($time >= 4300 and $time <= 7720) $strength = 15;
70  break;
71  case Weather::RAINY_THUNDER:
72  case Weather::RAINY:
73  if($time <= 22340 and $time >= 13680) $strength = 1;
74  if($time <= 22800 and $time >= 13220) $strength = 2;
75  if($time <= 23240 and $time >= 12780) $strength = 3;
76  if($time <= 23520 and $time >= 12500) $strength = 4;
77  if($time <= 23760 and $time >= 12260) $strength = 5;
78  if($time >= 0 and $time <= 12020) $strength = 6;
79  if($time >= 400 and $time <= 11620) $strength = 7;
80  if($time >= 900 and $time <= 11120) $strength = 8;
81  if($time >= 1440 and $time <= 10580) $strength = 9;
82  if($time >= 2080 and $time <= 9940) $strength = 10;
83  if($time >= 2880 and $time <= 9140) $strength = 11;
84  if($time >= 4120 and $time <= 7990) $strength = 12;
85  break;
86  }
87  return $strength;*/
88  $time = $this->getLevel()->getTime();
89  if(($time >= Level::TIME_DAY and $time <= Level::TIME_SUNSET) or
90  ($time >= Level::TIME_SUNRISE and $time <= Level::TIME_FULL)
91  ) return 15;
92  return 0;
93  }

◆ getSpawnCompound()

getSpawnCompound ( )
Returns
CompoundTag
137  {
138  return new CompoundTag("", [
140  new IntTag("x", (int) $this->x),
141  new IntTag("y", (int) $this->y),
142  new IntTag("z", (int) $this->z),
143  ]);
144  }

◆ isActivated()

isActivated ( )
Returns
bool
98  : bool{
99  if($this->getType() == Block::DAYLIGHT_SENSOR){
100  if($this->getLightByTime() == 15) return true;
101  return false;
102  }else{
103  if($this->getLightByTime() == 0) return true;
104  return false;
105  }
106  }

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