PocketMine
Entity Class Reference
Inheritance diagram for Entity:
Location Metadatable Position Vector3 FallingSand Hanging Item Living PrimedTNT Projectile Vehicle Painting Creature Slime Arrow Egg Snowball Minecart Animal Human Monster Villager WaterAnimal Chicken Cow Ozelot Pig Sheep Wolf Player Creeper Enderman Silverfish Skeleton Spider Zombie Squid

Public Member Functions

 __construct (FullChunk $chunk, Compound $nbt)
 
 getNameTag ()
 
 isNameTagVisible ()
 
 setNameTag ($name)
 
 setNameTagVisible ($value=true)
 
 isSneaking ()
 
 setSneaking ($value=true)
 
 isSprinting ()
 
 setSprinting ($value=true)
 
 getEffects ()
 
 removeAllEffects ()
 
 removeEffect ($effectId)
 
 getEffect ($effectId)
 
 hasEffect ($effectId)
 
 addEffect (Effect $effect)
 
 getSaveId ()
 
 saveNBT ()
 
 getViewers ()
 
 spawnTo (Player $player)
 
 sendPotionEffects (Player $player)
 
 sendMetadata ($player)
 
 sendData ($player, array $data=null)
 
 despawnFrom (Player $player)
 
 attack ($damage, EntityDamageEvent $source)
 
 heal ($amount, EntityRegainHealthEvent $source)
 
 getHealth ()
 
 isAlive ()
 
 setHealth ($amount)
 
 setLastDamageCause (EntityDamageEvent $type)
 
 getLastDamageCause ()
 
 getMaxHealth ()
 
 setMaxHealth ($amount)
 
 canCollideWith (Entity $entity)
 
 entityBaseTick ($tickDiff=1)
 
 getDirectionVector ()
 
 getDirectionPlane ()
 
 onUpdate ($currentTick)
 
 scheduleUpdate ()
 
 isOnFire ()
 
 setOnFire ($seconds)
 
 getDirection ()
 
 extinguish ()
 
 canTriggerWalking ()
 
 resetFallDistance ()
 
 getBoundingBox ()
 
 fall ($fallDistance)
 
 handleLavaMovement ()
 
 getEyeHeight ()
 
 moveFlying ()
 
 onCollideWithPlayer (Human $entityPlayer)
 
 getPosition ()
 
 getLocation ()
 
 isInsideOfWater ()
 
 isInsideOfSolid ()
 
 fastMove ($dx, $dy, $dz)
 
 move ($dx, $dy, $dz)
 
 getBlocksAround ()
 
 setPositionAndRotation (Vector3 $pos, $yaw, $pitch)
 
 setRotation ($yaw, $pitch)
 
 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)
 
 getDataProperty ($id)
 
 getDataPropertyType ($id)
 
 setDataFlag ($propertyId, $id, $value=true, $type=self::DATA_TYPE_BYTE)
 
 getDataFlag ($propertyId, $id)
 
 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)
 
 getYaw ()
 
 getPitch ()
 
 __toString ()
 
- Public Member Functions inherited from Position
 __construct ($x=0, $y=0, $z=0, Level $level=null)
 
 getLevel ()
 
 setLevel (Level $level)
 
 isValid ()
 
 setStrong ()
 
 setWeak ()
 
 getSide ($side, $step=1)
 
 __toString ()
 
 setComponents ($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)
 
 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)
 
 __toString ()
 

Static Public Member Functions

static createEntity ($type, FullChunk $chunk, Compound $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)
 

Data Fields

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_ROTATION = 7
 
const DATA_TYPE_LONG = 8
 
const DATA_FLAGS = 0
 
const DATA_AIR = 1
 
const DATA_NAMETAG = 2
 
const DATA_SHOW_NAMETAG = 3
 
const DATA_SILENT = 4
 
const DATA_POTION_COLOR = 7
 
const DATA_POTION_AMBIENT = 8
 
const DATA_NO_AI = 15
 
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
 
 $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
 
- 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

static $entityCount = 1
 

Protected Member Functions

 recalculateEffectColor ()
 
 initEntity ()
 
 checkObstruction ($x, $y, $z)
 
 updateMovement ()
 
 updateFallState ($distanceThisTick, $onGround)
 
 switchLevel (Level $targetLevel)
 
 checkGroundState ($movX, $movY, $movZ, $dx, $dy, $dz)
 
 checkBlockCollision ()
 
 checkChunks ()
 

Protected Attributes

 $hasSpawned = []
 
 $effects = []
 
 $id
 
 $dataFlags = 0
 
 $dataProperties
 
 $lastDamageCause = null
 
 $age = 0
 
 $ySize = 0
 
 $stepHeight = 0
 
 $isStatic = false
 
 $justCreated
 
 $fireProof
 
 $gravity
 
 $drag
 
 $server
 
 $timings
 
 $isPlayer = false
 

Member Function Documentation

attack (   $damage,
EntityDamageEvent  $source 
)
Parameters
float$damage
EntityDamageEvent$source
static createEntity (   $type,
FullChunk  $chunk,
Compound  $nbt,
  $args 
)
static
Parameters
int | string$type
FullChunk$chunk
Compound$nbt
$args
Returns
Entity
despawnFrom ( Player  $player)
Parameters
Player$player
getDataFlag (   $propertyId,
  $id 
)
Parameters
int$propertyId
int$id
Returns
bool
getDataProperty (   $id)
Parameters
int$id
Returns
mixed
getDataPropertyType (   $id)
Parameters
int$id
Returns
int
getDirectionVector ( )
Returns
Vector3
getEffects ( )
Returns
Effect[]
getHealth ( )
Returns
int
getLastDamageCause ( )
Returns
EntityDamageEvent|null
getMaxHealth ( )
Returns
int
getMetadata (   $metadataKey)

Returns a list of previously set metadata values from the implementing object's metadata store.

Parameters
string$metadataKey
Returns
MetadataValue[]

Implements Metadatable.

getNameTag ( )
Returns
string
getSaveId ( )

Returns the short save name

Returns
string
getViewers ( )
Returns
Player[]
hasMetadata (   $metadataKey)

Tests to see whether the implementing object contains the given metadata value in its metadata store.

Parameters
string$metadataKey
Returns
boolean

Implements Metadatable.

heal (   $amount,
EntityRegainHealthEvent  $source 
)
Parameters
float$amount
EntityRegainHealthEvent$source
isNameTagVisible ( )
Returns
bool
removeMetadata (   $metadataKey,
Plugin  $owningPlugin 
)

Removes the given metadata value from the implementing object's metadata store.

Parameters
string$metadataKey
Plugin$owningPlugin
Returns
void

Implements Metadatable.

sendData (   $player,
array  $data = null 
)
Parameters
Player[]|Player$player
array$dataProperly formatted entity data, defaults to everything
sendMetadata (   $player)
setDataFlag (   $propertyId,
  $id,
  $value = true,
  $type = self::DATA_TYPE_BYTE 
)
Parameters
int$propertyId
int$id
bool$value
setDataProperty (   $id,
  $type,
  $value 
)
Parameters
int$id
int$type
mixed$value
Returns
bool
setHealth (   $amount)

Sets the health of the Entity. This won't send any update to the players

Parameters
int$amount
setLastDamageCause ( EntityDamageEvent  $type)
Parameters
EntityDamageEvent$type
setMaxHealth (   $amount)
Parameters
int$amount
setMetadata (   $metadataKey,
MetadataValue  $newMetadataValue 
)

Sets a metadata value in the implementing object's metadata store.

Parameters
string$metadataKey
MetadataValue$newMetadataValue
Returns
void

Implements Metadatable.

setNameTag (   $name)
Parameters
string$name
setNameTagVisible (   $value = true)
Parameters
bool$value
spawnTo ( Player  $player)
Parameters
Player$player
teleport ( Vector3  $pos,
  $yaw = null,
  $pitch = null 
)
Parameters
Vector3 | Position | Location$pos
float$yaw
float$pitch
Returns
bool

Field Documentation

$dataProperties
protected
Initial value:
= [
self::DATA_FLAGS => [self::DATA_TYPE_BYTE, 0]

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