|
| | __construct (Level $level, CompoundTag $nbt) |
| |
| | getEntityId () |
| |
| | setEntityId (int $id) |
| |
| | getSpawnCount () |
| |
| | setSpawnCount (int $value) |
| |
| | getSpawnRange () |
| |
| | setSpawnRange (int $value) |
| |
| | getMinSpawnDelay () |
| |
| | setMinSpawnDelay (int $value) |
| |
| | getMaxSpawnDelay () |
| |
| | setMaxSpawnDelay (int $value) |
| |
| | getDelay () |
| |
| | setDelay (int $value) |
| |
| | getName () |
| |
| | canUpdate () |
| |
| | onUpdate () |
| |
| | getSpawnCompound () |
| |
| | spawnTo (Player $player) |
| |
| | __construct (Level $level, CompoundTag $nbt) |
| |
| | spawnToAll () |
| |
| | getSpawnCompound () |
| |
| | updateCompoundTag (CompoundTag $nbt, Player $player) |
| |
| | getSaveId () |
| |
| | __construct (Level $level, CompoundTag $nbt) |
| |
| | getId () |
| |
| | saveNBT () |
| |
| | getBlock () |
| |
| | onUpdate () |
| |
| | scheduleUpdate () |
| |
| | __destruct () |
| |
| | close () |
| |
| | getName () |
| |
| | __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) |
| |
| | __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 () |
| |
◆ __construct()
MobSpawner constructor.
- Parameters
-
| Level | $level | |
| CompoundTag | $nbt | |
47 if(!isset($nbt->EntityId) or !($nbt->EntityId instanceof
IntTag)){
48 $nbt->EntityId =
new IntTag(
"EntityId", 0);
50 if(!isset($nbt->SpawnCount) or !($nbt->SpawnCount instanceof IntTag)){
51 $nbt->SpawnCount =
new IntTag(
"SpawnCount", 4);
53 if(!isset($nbt->SpawnRange) or !($nbt->SpawnRange instanceof IntTag)){
54 $nbt->SpawnRange =
new IntTag(
"SpawnRange", 4);
56 if(!isset($nbt->MinSpawnDelay) or !($nbt->MinSpawnDelay instanceof IntTag)){
57 $nbt->MinSpawnDelay =
new IntTag(
"MinSpawnDelay", 200);
59 if(!isset($nbt->MaxSpawnDelay) or !($nbt->MaxSpawnDelay instanceof IntTag)){
60 $nbt->MaxSpawnDelay =
new IntTag(
"MaxSpawnDelay", 799);
62 if(!isset($nbt->Delay) or !($nbt->Delay instanceof IntTag)){
63 $nbt->Delay =
new IntTag(
"Delay", mt_rand($nbt->MinSpawnDelay->getValue(), $nbt->MaxSpawnDelay->getValue()));
65 parent::__construct(
$level, $nbt);
◆ canUpdate()
- Returns
- bool
171 foreach($this->
getLevel()->getEntities() as $e){
172 if($e instanceof Player){
173 if($e->distance($this->getBlock()) <= 15) $hasPlayer =
true;
179 if($hasPlayer and $count < 15){
◆ getDelay()
- Returns
- null
147 return $this->namedtag[
"Delay"];
◆ getEntityId()
- Returns
- null
75 return $this->namedtag[
"EntityId"];
◆ getMaxSpawnDelay()
- Returns
- null
133 return $this->namedtag[
"MaxSpawnDelay"];
◆ getMinSpawnDelay()
- Returns
- null
119 return $this->namedtag[
"MinSpawnDelay"];
◆ getName()
- Returns
- string
161 return "Monster Spawner";
◆ getSpawnCompound()
- Returns
- CompoundTag
249 new IntTag(
"x", (
int) $this->x),
250 new IntTag(
"y", (
int) $this->y),
251 new IntTag(
"z", (
int) $this->z),
◆ getSpawnCount()
- Returns
- null
91 return $this->namedtag[
"SpawnCount"];
◆ getSpawnRange()
- Returns
- null
105 return $this->namedtag[
"SpawnRange"];
◆ onUpdate()
- Returns
- bool
189 if($this->closed ===
true){
193 $this->timings->startTiming();
195 if(!($this->chunk instanceof Chunk)){
202 $pos = $this->
add(mt_rand() / mt_getrandmax() * $this->
getSpawnRange(), mt_rand(-1, 1), mt_rand() / mt_getrandmax() * $this->
getSpawnRange());
203 $target = $this->
getLevel()->getBlock($pos);
205 if($target->getId() ==
Item::AIR && $ground->isTopFacingSurfaceSolid()){
208 if(!$ev->isCancelled()){
211 new DoubleTag(
"", $pos->x),
212 new DoubleTag(
"", $pos->y),
213 new DoubleTag(
"", $pos->z)
215 "Motion" =>
new ListTag(
"Motion", [
216 new DoubleTag(
"", 0),
217 new DoubleTag(
"", 0),
220 "Rotation" =>
new ListTag(
"Rotation", [
221 new FloatTag(
"", mt_rand() / mt_getrandmax() * 360),
226 $entity->spawnToAll();
238 $this->timings->stopTiming();
◆ setDelay()
- Parameters
-
154 $this->namedtag->Delay->setValue($value);
◆ setEntityId()
- Parameters
-
82 $this->namedtag->EntityId->setValue(
$id);
◆ setMaxSpawnDelay()
| setMaxSpawnDelay |
( |
int |
$value | ) |
|
- Parameters
-
140 $this->namedtag->MaxSpawnDelay->setValue($value);
◆ setMinSpawnDelay()
| setMinSpawnDelay |
( |
int |
$value | ) |
|
- Parameters
-
126 $this->namedtag->MinSpawnDelay->setValue($value);
◆ setSpawnCount()
| setSpawnCount |
( |
int |
$value | ) |
|
- Parameters
-
98 $this->namedtag->SpawnCount->setValue($value);
◆ setSpawnRange()
| setSpawnRange |
( |
int |
$value | ) |
|
- Parameters
-
112 $this->namedtag->SpawnRange->setValue($value);
The documentation for this class was generated from the following file:
- src/pocketmine/tile/MobSpawner.php