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

Public Member Functions

 setHealth ($amount)
 
 saveNBT ()
 
 getName ()
 
 hasLineOfSight (Entity $entity)
 
 heal ($amount, EntityRegainHealthEvent $source)
 
 attack ($damage, EntityDamageEvent $source)
 
 knockBack (Entity $attacker, $damage, $x, $z, $base=0.4)
 
 kill ()
 
 entityBaseTick ($tickDiff=1, $EnchantL=0)
 
 getDrops ()
 
 getLineOfSight ($maxDistance, $maxLength=0, array $transparent=[])
 
 getTargetBlock ($maxDistance, array $transparent=[])
 
- Public Member Functions inherited from Entity
 __construct (Level $level, CompoundTag $nbt)
 
 getHeight ()
 
 getWidth ()
 
 getLength ()
 
 setScale ($scale)
 
 getScale ()
 
 getDropExpMin ()
 
 getDropExpMax ()
 
 getNameTag ()
 
 isNameTagVisible ()
 
 isNameTagAlwaysVisible ()
 
 setNameTag ($name)
 
 setNameTagVisible ($value=true)
 
 setNameTagAlwaysVisible ($value=true)
 
 isSneaking ()
 
 setSneaking ($value=true)
 
 isSprinting ()
 
 setSprinting ($value=true)
 
 isGliding ()
 
 setGliding ($value=true)
 
 isImmobile ()
 
 setImmobile ($value=true)
 
 canClimb ()
 
 setCanClimb (bool $value)
 
 canClimbWalls ()
 
 setCanClimbWalls (bool $value=true)
 
 getOwningEntityId ()
 
 getOwningEntity ()
 
 setOwningEntity (Entity $owner)
 
 getEffects ()
 
 removeAllEffects ()
 
 removeEffect ($effectId)
 
 getEffect ($effectId)
 
 hasEffect ($effectId)
 
 addEffect (Effect $effect)
 
 getSaveId ()
 
 saveNBT ()
 
 getViewers ()
 
 spawnTo (Player $player)
 
 sendPotionEffects (Player $player)
 
 sendData ($player, array $data=null)
 
 despawnFrom (Player $player, bool $send=true)
 
 attack ($damage, EntityDamageEvent $source)
 
 heal ($amount, EntityRegainHealthEvent $source)
 
 getHealth ()
 
 isAlive ()
 
 setHealth ($amount)
 
 setLastDamageCause (EntityDamageEvent $type)
 
 getLastDamageCause ()
 
 getAttributeMap ()
 
 getMaxHealth ()
 
 setMaxHealth ($amount)
 
 canCollideWith (Entity $entity)
 
 entityBaseTick ($tickDiff=1)
 
 getDirectionVector ()
 
 getDirectionPlane ()
 
 onUpdate ($currentTick)
 
 scheduleUpdate ()
 
 isOnFire ()
 
 setOnFire ($seconds)
 
 isFireProof ()
 
 getDirection ()
 
 extinguish ()
 
 canTriggerWalking ()
 
 resetFallDistance ()
 
 getBoundingBox ()
 
 fall ($fallDistance)
 
 handleLavaMovement ()
 
 getEyeHeight ()
 
 moveFlying ()
 
 onCollideWithPlayer (Human $entityPlayer)
 
 getPosition ()
 
 getLocation ()
 
 isInsideOfPortal ()
 
 isInsideOfWater ()
 
 isInsideOfSolid ()
 
 isInsideOfFire ()
 
 fastMove ($dx, $dy, $dz)
 
 move ($dx, $dy, $dz)
 
 getBlocksAround ()
 
 setPositionAndRotation (Vector3 $pos, $yaw, $pitch)
 
 setRotation ($yaw, $pitch)
 
 setLocation (Location $pos)
 
 setPosition (Vector3 $pos)
 
 getMotion ()
 
 setMotion (Vector3 $motion)
 
 isOnGround ()
 
 kill ()
 
 teleport (Vector3 $pos, $yaw=null, $pitch=null)
 
 getId ()
 
 respawnToAll ()
 
 spawnToAll ()
 
 despawnFromAll ()
 
 close ()
 
 setDataProperty ($id, $type, $value)
 
 linkEntity (Entity $entity)
 
 sendLinkedData ()
 
 setLinked ($type=0, Entity $entity)
 
 getLinkedEntity ()
 
 getLinkedType ()
 
 getDataProperty ($id)
 
 getDataPropertyType ($id)
 
 setDataFlag ($propertyId, $id, $value=true, $type=self::DATA_TYPE_LONG)
 
 getDataFlag ($propertyId, $id)
 
 __destruct ()
 
 setMetadata ($metadataKey, MetadataValue $metadataValue)
 
 getMetadata ($metadataKey)
 
 hasMetadata ($metadataKey)
 
 removeMetadata ($metadataKey, Plugin $plugin)
 
 __toString ()
 
- Public Member Functions inherited from Location
 __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 ()
 

Protected Member Functions

 initEntity ()
 
- Protected Member Functions inherited from Entity
 recalculateEffectColor ()
 
 initEntity ()
 
 addAttributes ()
 
 checkObstruction ($x, $y, $z)
 
 updateMovement ()
 
 updateFallState ($distanceThisTick, $onGround)
 
 switchLevel (Level $targetLevel)
 
 checkGroundState ($movX, $movY, $movZ, $dx, $dy, $dz)
 
 checkBlockCollision ()
 
 checkChunks ()
 

Protected Attributes

 $gravity = 0.08
 
 $drag = 0.02
 
 $attackTime = 0
 
 $invisible = false
 
- Protected Attributes inherited from Entity
 $hasSpawned = []
 
 $effects = []
 
 $id
 
 $dataFlags = 0
 
 $dataProperties
 
 $lastDamageCause = null
 
 $age = 0
 
 $ySize = 0
 
 $stepHeight = 0
 
 $isStatic = false
 
 $justCreated
 
 $attributeMap
 
 $gravity
 
 $drag
 
 $server
 
 $timings
 
 $isPlayer = false
 
 $linkedEntity = null
 
 $linkedType = null
 
 $riding = null
 
 $activatedPressurePlates = []
 

Additional Inherited Members

- Static Public Member Functions inherited from Entity
static init ()
 
static createEntity ($type, Level $level, CompoundTag $nbt,... $args)
 
static registerEntity ($className, $force=false)
 
- Static Public Member Functions inherited from Location
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 inherited from Entity
const NETWORK_ID = -1
 
const DATA_TYPE_BYTE = 0
 
const DATA_TYPE_SHORT = 1
 
const DATA_TYPE_INT = 2
 
const DATA_TYPE_FLOAT = 3
 
const DATA_TYPE_STRING = 4
 
const DATA_TYPE_SLOT = 5
 
const DATA_TYPE_POS = 6
 
const DATA_TYPE_LONG = 7
 
const DATA_TYPE_VECTOR3F = 8
 
const DATA_FLAGS = 0
 
const DATA_HEALTH = 1
 
const DATA_VARIANT = 2
 
const DATA_COLOR = 3
 
const DATA_COLOUR = 3
 
const DATA_NAMETAG = 4
 
const DATA_OWNER_EID = 5
 
const DATA_TARGET_EID = 6
 
const DATA_AIR = 7
 
const DATA_POTION_COLOR = 8
 
const DATA_POTION_AMBIENT = 9
 
const DATA_HURT_TIME = 11
 
const DATA_HURT_DIRECTION = 12
 
const DATA_PADDLE_TIME_LEFT = 13
 
const DATA_PADDLE_TIME_RIGHT = 14
 
const DATA_EXPERIENCE_VALUE = 15
 
const DATA_MINECART_DISPLAY_BLOCK = 16
 
const DATA_MINECART_DISPLAY_OFFSET = 17
 
const DATA_MINECART_HAS_DISPLAY = 18
 
const DATA_ENDERMAN_HELD_ITEM_ID = 23
 
const DATA_ENDERMAN_HELD_ITEM_DAMAGE = 24
 
const DATA_ENTITY_AGE = 25
 
const DATA_FIREBALL_POWER_X = 30
 
const DATA_FIREBALL_POWER_Y = 31
 
const DATA_FIREBALL_POWER_Z = 32
 
const DATA_POTION_AUX_VALUE = 37
 
const DATA_LEAD_HOLDER_EID = 38
 
const DATA_SCALE = 39
 
const DATA_INTERACTIVE_TAG = 40
 
const DATA_NPC_SKIN_ID = 41
 
const DATA_URL_TAG = 42
 
const DATA_MAX_AIR = 43
 
const DATA_MARK_VARIANT = 44
 
const DATA_BLOCK_TARGET = 48
 
const DATA_WITHER_INVULNERABLE_TICKS = 49
 
const DATA_WITHER_TARGET_1 = 50
 
const DATA_WITHER_TARGET_2 = 51
 
const DATA_WITHER_TARGET_3 = 52
 
const DATA_BOUNDING_BOX_WIDTH = 54
 
const DATA_BOUNDING_BOX_HEIGHT = 55
 
const DATA_FUSE_LENGTH = 56
 
const DATA_RIDER_SEAT_POSITION = 57
 
const DATA_RIDER_ROTATION_LOCKED = 58
 
const DATA_RIDER_MAX_ROTATION = 59
 
const DATA_RIDER_MIN_ROTATION = 60
 
const DATA_AREA_EFFECT_CLOUD_RADIUS = 61
 
const DATA_AREA_EFFECT_CLOUD_WAITING = 62
 
const DATA_AREA_EFFECT_CLOUD_PARTICLE_ID = 63
 
const DATA_SHULKER_ATTACH_FACE = 65
 
const DATA_SHULKER_ATTACH_POS = 67
 
const DATA_TRADING_PLAYER_EID = 68
 
const DATA_COMMAND_BLOCK_COMMAND = 71
 
const DATA_COMMAND_BLOCK_LAST_OUTPUT = 72
 
const DATA_COMMAND_BLOCK_TRACK_OUTPUT = 73
 
const DATA_CONTROLLING_RIDER_SEAT_NUMBER = 74
 
const DATA_STRENGTH = 75
 
const DATA_MAX_STRENGTH = 76
 
const DATA_FLAG_ONFIRE = 0
 
const DATA_FLAG_SNEAKING = 1
 
const DATA_FLAG_RIDING = 2
 
const DATA_FLAG_SPRINTING = 3
 
const DATA_FLAG_ACTION = 4
 
const DATA_FLAG_INVISIBLE = 5
 
const DATA_FLAG_TEMPTED = 6
 
const DATA_FLAG_INLOVE = 7
 
const DATA_FLAG_SADDLED = 8
 
const DATA_FLAG_POWERED = 9
 
const DATA_FLAG_IGNITED = 10
 
const DATA_FLAG_BABY = 11
 
const DATA_FLAG_CONVERTING = 12
 
const DATA_FLAG_CRITICAL = 13
 
const DATA_FLAG_CAN_SHOW_NAMETAG = 14
 
const DATA_FLAG_ALWAYS_SHOW_NAMETAG = 15
 
const DATA_FLAG_IMMOBILE = 16
 
const DATA_FLAG_NO_AI = 16
 
const DATA_FLAG_SILENT = 17
 
const DATA_FLAG_WALLCLIMBING = 18
 
const DATA_FLAG_CAN_CLIMB = 19
 
const DATA_FLAG_SWIMMER = 20
 
const DATA_FLAG_CAN_FLY = 21
 
const DATA_FLAG_RESTING = 22
 
const DATA_FLAG_SITTING = 23
 
const DATA_FLAG_ANGRY = 24
 
const DATA_FLAG_INTERESTED = 25
 
const DATA_FLAG_CHARGED = 26
 
const DATA_FLAG_TAMED = 27
 
const DATA_FLAG_LEASHED = 28
 
const DATA_FLAG_SHEARED = 29
 
const DATA_FLAG_GLIDING = 30
 
const DATA_FLAG_ELDER = 31
 
const DATA_FLAG_MOVING = 32
 
const DATA_FLAG_BREATHING = 33
 
const DATA_FLAG_CHESTED = 34
 
const DATA_FLAG_STACKABLE = 35
 
const DATA_FLAG_SHOWBASE = 36
 
const DATA_FLAG_REARING = 37
 
const DATA_FLAG_VIBRATING = 38
 
const DATA_FLAG_IDLING = 39
 
const DATA_FLAG_EVOKER_SPELL = 40
 
const DATA_FLAG_CHARGE_ATTACK = 41
 
const DATA_FLAG_LINGER = 45
 
const SOUTH = 0
 
const WEST = 1
 
const NORTH = 2
 
const EAST = 3
 
 $passenger = null
 
 $vehicle = null
 
 $chunk
 
 $lastX = null
 
 $lastY = null
 
 $lastZ = null
 
 $motionX
 
 $motionY
 
 $motionZ
 
 $temporalVector
 
 $lastMotionX
 
 $lastMotionY
 
 $lastMotionZ
 
 $lastYaw
 
 $lastPitch
 
 $boundingBox
 
 $onGround
 
 $inBlock = false
 
 $positionChanged
 
 $motionChanged
 
 $deadTicks = 0
 
 $height
 
 $eyeHeight = null
 
 $width
 
 $length
 
 $keepMovement = false
 
 $fallDistance = 0
 
 $ticksLived = 0
 
 $lastUpdate
 
 $maxFireTicks
 
 $fireTicks = 0
 
 $namedtag
 
 $canCollide = true
 
 $isCollided = false
 
 $isCollidedHorizontally = false
 
 $isCollidedVertically = false
 
 $noDamageTicks
 
 $closed = false
 
 $dropExp = [0, 0]
 
- Data Fields inherited from Location
 $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
 
- Static Public Attributes inherited from Entity
static $entityCount = 1
 

Member Function Documentation

◆ attack()

attack (   $damage,
EntityDamageEvent  $source 
)
Parameters
float$damage
EntityDamageEvent$source
Returns
bool|void
119  {
120  if($this->attackTime > 0 or $this->noDamageTicks > 0){
121  $lastCause = $this->getLastDamageCause();
122  if($lastCause !== null and $lastCause->getDamage() >= $damage){
123  $source->setCancelled();
124  }
125  }
126 
127  parent::attack($damage, $source);
128 
129  if($source->isCancelled()){
130  return;
131  }
132 
133  if($source instanceof EntityDamageByEntityEvent){
134  $e = $source->getDamager();
135  if($source instanceof EntityDamageByChildEntityEvent){
136  $e = $source->getChild();
137  }
138 
139  if($e->isOnFire() > 0 and !($e instanceof Player)){
140  $this->setOnFire(2 * $this->server->getDifficulty());
141  }
142 
143  $deltaX = $this->x - $e->x;
144  $deltaZ = $this->z - $e->z;
145  $this->knockBack($e, $damage, $deltaX, $deltaZ, $source->getKnockBack());
146  if($e instanceof Husk){
147  $this->addEffect(Effect::getEffect(Effect::HUNGER)->setDuration(7 * 20 * $this->server->getDifficulty()));
148  }
149  }
150 
151  $pk = new EntityEventPacket();
152  $pk->eid = $this->getId();
154  $this->server->broadcastPacket($this->hasSpawned, $pk);
155 
156  $this->attackTime = 10; //0.5 seconds cooldown
157  }

◆ entityBaseTick()

entityBaseTick (   $tickDiff = 1,
  $EnchantL = 0 
)
Parameters
int$tickDiff
int$EnchantL
Returns
bool
207  {
209  $this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_BREATHING, !$this->isInsideOfWater());
210 
211  $hasUpdate = parent::entityBaseTick($tickDiff);
212 
213  if($this->isAlive()){
214  if($this->isInsideOfSolid()){
215  $hasUpdate = true;
216  $ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_SUFFOCATION, 1);
217  $this->attack($ev->getFinalDamage(), $ev);
218  }
219  $maxAir = 400 + $EnchantL * 300;
220  $this->setDataProperty(self::DATA_MAX_AIR, self::DATA_TYPE_SHORT, $maxAir);
221  if(!$this->hasEffect(Effect::WATER_BREATHING) and $this->isInsideOfWater()){
222  if($this instanceof WaterAnimal){
223  $this->setDataProperty(self::DATA_AIR, self::DATA_TYPE_SHORT, 400);
224  }else{
225  $hasUpdate = true;
226  $airTicks = $this->getDataProperty(self::DATA_AIR) - $tickDiff;
227  if($airTicks <= -80){
228  $airTicks = 0;
229 
230  $ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_DROWNING, 2);
231  $this->attack($ev->getFinalDamage(), $ev);
232  }
233  $this->setDataProperty(self::DATA_AIR, self::DATA_TYPE_SHORT, min($airTicks, $maxAir));
234  }
235  }else{
236  if($this instanceof WaterAnimal){
237  $hasUpdate = true;
238  $airTicks = $this->getDataProperty(self::DATA_AIR) - $tickDiff;
239  if($airTicks <= -80){
240  $airTicks = 0;
241 
242  $ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_SUFFOCATION, 2);
243  $this->attack($ev->getFinalDamage(), $ev);
244  }
245  $this->setDataProperty(self::DATA_AIR, self::DATA_TYPE_SHORT, $airTicks);
246  }else{
247  $this->setDataProperty(self::DATA_AIR, self::DATA_TYPE_SHORT, $maxAir);
248  }
249  }
250  }
251 
252  if($this->attackTime > 0){
253  $this->attackTime -= $tickDiff;
254  }
255 
257 
258  return $hasUpdate;
259  }

◆ getDrops()

getDrops ( )
Returns
ItemItem[]
264  {
265  return [];
266  }

◆ getLineOfSight()

getLineOfSight (   $maxDistance,
  $maxLength = 0,
array  $transparent = [] 
)
Parameters
int$maxDistance
int$maxLength
array$transparent
Returns
Block[]
275  {
276  if($maxDistance > 120){
277  $maxDistance = 120;
278  }
279 
280  if(count($transparent) === 0){
281  $transparent = null;
282  }
283 
284  $blocks = [];
285  $nextIndex = 0;
286 
287  $itr = new BlockIterator($this->level, $this->getPosition(), $this->getDirectionVector(), $this->getEyeHeight(), $maxDistance);
288 
289  while($itr->valid()){
290  $itr->next();
291  $block = $itr->current();
292  $blocks[$nextIndex++] = $block;
293 
294  if($maxLength !== 0 and count($blocks) > $maxLength){
295  array_shift($blocks);
296  --$nextIndex;
297  }
298 
299  $id = $block->getId();
300 
301  if($transparent === null){
302  if($id !== 0){
303  break;
304  }
305  }else{
306  if(!isset($transparent[$id])){
307  break;
308  }
309  }
310  }
311 
312  return $blocks;
313  }

◆ getName()

getName ( )
abstract
Returns
mixed

◆ getTargetBlock()

getTargetBlock (   $maxDistance,
array  $transparent = [] 
)
Parameters
int$maxDistance
array$transparent
Returns
Block
321  {
322  try{
323  $block = $this->getLineOfSight($maxDistance, 1, $transparent)[0];
324  if($block instanceof Block){
325  return $block;
326  }
327  }catch(\ArrayOutOfBoundsException $e){
328 
329  }
330 
331  return null;
332  }

◆ hasLineOfSight()

hasLineOfSight ( Entity  $entity)
Parameters
Entity$entity
Returns
bool
94  {
95  //TODO: head height
96  return true;
97  //return $this->getLevel()->rayTraceBlocks(Vector3::createVector($this->x, $this->y + $this->height, $this->z), Vector3::createVector($entity->x, $entity->y + $entity->height, $entity->z)) === null;
98  }

◆ heal()

heal (   $amount,
EntityRegainHealthEvent  $source 
)
Parameters
float$amount
EntityRegainHealthEvent$source
104  {
105  parent::heal($amount, $source);
106  if($source->isCancelled()){
107  return;
108  }
109 
110  $this->attackTime = 0;
111  }

◆ initEntity()

initEntity ( )
protected
48  {
49  parent::initEntity();
50 
51  if(isset($this->namedtag->HealF)){
52  $this->namedtag->Health = new FloatTag("Health", (int) $this->namedtag["HealF"]);
53  unset($this->namedtag->HealF);
54  }
55 
56  if(!isset($this->namedtag->Health) or !($this->namedtag->Health instanceof FloatTag)){
57  $this->namedtag->Health = new FloatTag("Health", $this->getMaxHealth());
58  }
59 
60  if($this->namedtag["Health"] <= 0)
61  $this->setHealth(20.0);
62  else $this->setHealth($this->namedtag["Health"]);
63  }

◆ kill()

kill ( )
190  {
191  if(!$this->isAlive()){
192  return;
193  }
194  parent::kill();
195  $this->server->getPluginManager()->callEvent($ev = new EntityDeathEvent($this, $this->getDrops()));
196  foreach($ev->getDrops() as $item){
197  $this->getLevel()->dropItem($this, $item);
198  }
199  }

◆ knockBack()

knockBack ( Entity  $attacker,
  $damage,
  $x,
  $z,
  $base = 0.4 
)
Parameters
Entity$attacker
$damage
$x
$z
float$base
166  {
167  $f = sqrt($x * $x + $z * $z);
168  if($f <= 0){
169  return;
170  }
171 
172  $f = 1 / $f;
173 
174  $motion = new Vector3($this->motionX, $this->motionY, $this->motionZ);
175 
176  $motion->x /= 2;
177  $motion->y /= 2;
178  $motion->z /= 2;
179  $motion->x += $x * $f * $base;
180  $motion->y += $base;
181  $motion->z += $z * $f * $base;
182 
183  if($motion->y > $base){
184  $motion->y = $base;
185  }
186 
187  $this->setMotion($motion);
188  }

◆ saveNBT()

saveNBT ( )
79  {
80  parent::saveNBT();
81  $this->namedtag->Health = new FloatTag("Health", $this->getHealth());
82  }

◆ setHealth()

setHealth (   $amount)
Parameters
int$amount
68  {
69  $wasAlive = $this->isAlive();
70  parent::setHealth((float) $amount);
71  if($this->isAlive() and !$wasAlive){
72  $pk = new EntityEventPacket();
73  $pk->eid = $this->getId();
74  $pk->event = EntityEventPacket::RESPAWN;
75  $this->server->broadcastPacket($this->hasSpawned, $pk);
76  }
77  }

Field Documentation

◆ $attackTime

$attackTime = 0
protected

◆ $drag

$drag = 0.02
protected

◆ $gravity

$gravity = 0.08
protected

◆ $invisible

$invisible = false
protected

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