cMonster


Index:
Articles
Classes
Hooks

Quick navigation:
BannerPattern
BossBarColor
BossBarDivisionType
cArrowEntity
cBeaconEntity
cBedEntity
cBlockArea
cBlockEntity
cBlockEntityWithItems
cBlockInfo
cBoat
cBoundingBox
cBrewingstandEntity
cChatColor
cChestEntity
cChunkDesc
cClientHandle
cColor
cCommandBlockEntity
cCompositeChat
cCraftingGrid
cCraftingRecipe
cCryptoHash
cCuboid
cDispenserEntity
cDropperEntity
cDropSpenserEntity
cEnchantments
cEnderCrystal
cEntity
cEntityEffect
cExpBottleEntity
cExpOrb
cFallingBlock
cFile
cFireChargeEntity
cFireworkEntity
cFloater
cFlowerPotEntity
cFurnaceEntity
cGhastFireballEntity
cHangingEntity
cHopperEntity
cIniFile
cInventory
cItem
cItemFrame
cItemGrid
cItems
cJson
cJukeboxEntity
cLeashKnot
cLineBlockTracer
cLuaWindow
cMap
cMapManager
cMobHeadEntity
cMobSpawnerEntity
cMojangAPI
cMonster
cNetwork
cNoteEntity
cObjective
cPainting
cPawn
cPickup
cPlayer
cPlugin
cPluginLua
cPluginManager
cProjectileEntity
cRankManager
cRoot
cScoreboard
cServer
cServerHandle
cSignEntity
cSplashPotionEntity
cStringCompression
cTCPLink
cTeam
cThrownEggEntity
cThrownEnderPearlEntity
cThrownSnowballEntity
cTNTEntity
cUDPEndpoint
cUrlClient
cUrlParser
CustomStatistic
cUUID
cWebAdmin
cWindow
cWitherSkullEntity
cWorld
EffectID
HTTPFormData
HTTPRequest
HTTPTemplateRequest
ItemCategory
lxp
SmokeDirection
sqlite3
StatisticsManager
TakeDamageInfo
tolua
Vector3d
Vector3f
Vector3i
Globals

Contents


cMonster class

This class is the base class for all computer-controlled mobs in the game.

To spawn a mob in a world, use the cWorld:SpawnMob() function.


Inheritance

This class inherits from the following parent classes:


Constants

Mobs are divided into families. The following constants are used for individual family types:

NameValueNotes
mfAmbient 2 Family: ambient (bat)
mfHostile 0 Family: hostile (blaze, cavespider, creeper, enderdragon, enderman, ghast, giant, magmacube, silverfish, skeleton, slime, spider, witch, wither, zombie, zombiepigman)
mfNoSpawn 4
mfPassive 1 Family: passive (chicken, cow, horse, irongolem, mooshroom, ocelot, pig, sheep, snowgolem, villager, wolf)
mfWater 3 Family: water (squid)


Constants inherited from cEntity

NameValueNotes
INVALID_ID 0 Special value of an entity ID, indicating a failure. Used primarily in functions that create entities when the entity cannot be created.

Functions

NameParametersReturn valueNotes
BurnsInDaylight
boolean
Returns whether the mob burns in daylight.
CanBeLeashed
boolean
Returns whether the mob can be leashed.
FamilyFromType
MobTypeeMonsterType
MobFamilyeFamily
(STATIC) Returns the mob family (mfXXX constants) based on the mob type (mtXXX constants)
GetAge
number
Returns the age of the monster
GetCustomName
string
Gets the custom name of the monster. If no custom name is set, the function returns an empty string.
GetLeashedTo
LeashedTocEntity
Returns the entity to where this mob is leashed, returns nil if it's not leashed
GetMobFamily
MobFamilyeFamily
Returns this mob's family (mfXXX constant)
GetMobType
MobTypeeMonsterType
Returns the type of this mob (mtXXX constant)
GetRelativeWalkSpeed
number
Returns the walk speed multiplier of this mob. Base is set in monsters.ini (will default to 1 if not set).
HasCustomName
boolean
Returns true if the monster has a custom name.
IsBaby
boolean
Returns true if the monster is a baby
IsCustomNameAlwaysVisible
boolean
Is the custom name of this monster always visible? If not, you only see the name when you sight the mob.
IsLeashed
boolean
Returns whether the monster is leashed to an entity.
LeashTo
EntitycEntity
Leash the monster to an entity.
MobTypeToString
MobTypeeMonsterType
string
(STATIC) Returns the string representing the given mob type (mtXXX constant), or empty string if unknown type.
MobTypeToVanillaName
MobTypeeMonsterType
string
(STATIC) Returns the vanilla name of the given mob type, or empty string if unknown type.
MoveToPosition
PositionVector3d
Start moving (using a pathfinder) towards the specified position
SetAge
Agenumber
Sets the age of the monster
SetBurnsInDaylight
BurnsInDaylightboolean
Sets whether the mob burns in daylight. Only evaluated at next burn-decision tick
SetCanBeLeashed
CanBeLeashedboolean
Sets whether the mob can be leashed, for extensibility in plugins
SetCustomName
CustomNamestring
Sets the custom name of the monster. You see the name over the monster. If you want to disable the custom name, simply set an empty string.
SetCustomNameAlwaysVisible
IsCustomNameAlwaysVisibleboolean
Sets the custom name visiblity of this monster. If it's false, you only see the name when you sight the mob. If it's true, you always see the custom name.
SetRelativeWalkSpeed
RelativeWalkSpeednumber
Sets the walk speed multiplier of this mob. Base is set in monsters.ini (will default to 1 if not set).
StringToMobType
MobTypeStringstring
MobTypeeMonsterType
(STATIC) Returns the mob type (mtXXX constant) parsed from the string type ("creeper"), or mtInvalidType if unrecognized.
Unleash
ShouldDropLeashPickupboolean
Unleash the monster.

Functions inherited from cPawn

NameParametersReturn valueNotes
AddEntityEffect
EffectTypeeType
EffectDurationTicksnumber
EffectIntensitynumber
DistanceModifiernumber
Applies an entity effect. Checks with plugins if they allow the addition. EffectIntensity is the level of the effect (0 = Potion I, 1 = Potion II, etc). DistanceModifier is the scalar multiplied to the potion duration (only applies to splash potions).
ClearEntityEffects Removes all currently applied entity effects
FindTeleportDestination
WorldcWorld
HeightRequirednumber
NumTriesnumber
DestinationVector3d
MinBoxCornerVector3i
MaxBoxCornerVector3i
Function to find suitable teleport destination in or below box. Returns true and places result in Destination if found, otherwise returns false. Details at: https://minecraft.wiki/w/Enderman.
FindTeleportDestination
WorldcWorld
HeightRequirednumber
NumTriesnumber
DestinationVector3d
BoundingBoxcBoundingBox
Function to find suitable teleport destination in or below box. Returns true and places result in Destination if found, otherwise returns false. Details at: https://minecraft.wiki/w/Enderman.
FindTeleportDestination
WorldcWorld
HeightRequirednumber
NumTriesnumber
CentreVector3i
HalfCubeWidthnumber
Function to find suitable teleport destination in or below box. Returns true and places result in Destination if found, otherwise returns false. Details at: https://minecraft.wiki/w/Enderman.
HasEntityEffect
EffectTypeeType
boolean
Returns true, if the supplied entity effect type is currently applied
RemoveEntityEffect
EffectTypeeType
Removes a currently applied entity effect

Functions inherited from cEntity

NameParametersReturn valueNotes
AddPosX
OffsetXnumber
Moves the entity by the specified amount in the X axis direction
AddPosY
OffsetYnumber
Moves the entity by the specified amount in the Y axis direction
AddPosZ
OffsetZnumber
Moves the entity by the specified amount in the Z axis direction
AddPosition
OffsetVector3d
Moves the entity by the specified amount in each direction
AddPosition
OffsetXnumber
OffsetYnumber
OffsetZnumber
Moves the entity by the specified amount in each axis direction
AddSpeed
AddXnumber
AddYnumber
AddZnumber
Adds the specified amount of speed in each axis direction.
AddSpeed
AddVector3d
Adds the specified amount of speed in each axis direction.
AddSpeedX
AddXnumber
Adds the specified amount of speed in the X axis direction.
AddSpeedY
AddYnumber
Adds the specified amount of speed in the Y axis direction.
AddSpeedZ
AddZnumber
Adds the specified amount of speed in the Z axis direction.
ApplyArmorDamage
DamageBlockednumber
Lowers armor durability, as if the armor blocked the given amount of damage.
ArmorCoversAgainst
DamageTypeeDamageType
boolean
Returns whether armor will protect against the specified damage type
Destroy
ShouldBroadcast (DEPRECATED)boolean
Schedules the entity to be destroyed; broadcasts the DestroyEntity packet
DoesPreventBlockPlacement
boolean
Returns true if this entity doesn't allow blocks to be placed intersecting the entity.
GetAirDrag (undocumented)
GetAirLevel
number
Returns the air level (number of ticks of air left). Note, this function is only updated with mobs or players.
GetArmorCoverAgainst
AttackerEntitycEntity
DamageTypeeDamageType
RawDamagenumber
number
Returns the number of hitpoints out of RawDamage that the currently equipped armor would cover. See TakeDamageInfo for more information on attack damage.
GetBoundingBox
cBoundingBox
Returns the bounding box of the entity, which has width and height corresponding to the entity, and is aligned with the block grid.
GetChunkX
number
Returns the X-coord of the chunk in which the entity is placed
GetChunkZ
number
Returns the Z-coord of the chunk in which the entity is placed
GetClass
string
Returns the classname of the entity, such as "cSpider" or "cPickup"
GetClassStatic
string
(STATIC) Returns the entity classname that this class implements. Each descendant overrides this function.
GetEnchantmentBlastKnockbackReduction
number
Returns explosion knock back reduction percent from blast protection level.
GetEnchantmentCoverAgainst
AttackerEntitycEntity
DamageTypeeDamageType
RawDamagenumber
number
Returns the number of hitpoints out of RawDamage that the enchantments on the currently equipped armor would cover. See TakeDamageInfo for more information on attack damage.
GetEntityType
EntityTypeeEntityType
Returns the type of the entity, one of the etXXX constants. Note that to check specific entity type, you should use one of the IsXXX functions instead of comparing the value returned by this call.
GetEquippedBoots
cItem
Returns the boots that the entity has equipped. Returns an empty cItem if no boots equipped or not applicable.
GetEquippedChestplate
cItem
Returns the chestplate that the entity has equipped. Returns an empty cItem if no chestplate equipped or not applicable.
GetEquippedHelmet
cItem
Returns the helmet that the entity has equipped. Returns an empty cItem if no helmet equipped or not applicable.
GetEquippedLeggings
cItem
Returns the leggings that the entity has equipped. Returns an empty cItem if no leggings equipped or not applicable.
GetEquippedWeapon
cItem
Returns the weapon that the entity has equipped. Returns an empty cItem if no weapon equipped or not applicable.
GetGravity
number
Returns the number that is used as the gravity for physics simulation. 1G (9.78) by default.
GetHeadYaw
number
Returns the pitch of the entity's head (FIXME: Rename to GetHeadPitch() ).
GetHealth
number
Returns the current health of the entity.
GetHeight
number
Returns the height (Y size) of the entity
GetInvulnerableTicks
number
Returns the number of ticks that this entity will be invulnerable for. This is used for after-hit recovery - the entities are invulnerable for half a second after being hit.
GetKnockbackAmountAgainst
ReceiverEntitycEntity
number
Returns the amount of knockback that the currently equipped items would cause when attacking the ReceiverEntity.
GetLookVector
Vector3f
Returns the vector that defines the direction in which the entity is looking
GetMass
number
Returns the mass of the entity. Currently unused.
GetMaxHealth
number
Returns the maximum number of hitpoints this entity is allowed to have.
GetOffHandEquipedItem
cItem
Returns the item that the entity has equipped on off-hand. Returns an empty cItem if no item equipped or not applicable.
GetParentClass
string
Returns the name of the direct parent class for this entity
GetPitch
number
Returns the pitch (nose-down rotation) of the entity. Measured in degrees, normal values range from -90 to +90. +90 means looking down, 0 means looking straight ahead, -90 means looking up.
GetPosX
number
Returns the X-coord of the entity's pivot
GetPosY
number
Returns the Y-coord of the entity's pivot
GetPosZ
number
Returns the Z-coord of the entity's pivot
GetPosition
Vector3d
Returns the entity's pivot position as a 3D vector
GetRawDamageAgainst
ReceiverEntitycEntity
number
Returns the raw damage that this entity's equipment would cause when attacking the ReceiverEntity. This includes this entity's weapon enchantments, but excludes the receiver's armor or potion effects. See TakeDamageInfo for more information on attack damage.
GetRoll
number
Returns the roll (sideways rotation) of the entity. Currently unused.
GetSpeed
Vector3d
Returns the complete speed vector of the entity
GetSpeedX
number
Returns the X-part of the speed vector
GetSpeedY
number
Returns the Y-part of the speed vector
GetSpeedZ
number
Returns the Z-part of the speed vector
GetTicksAlive
number
Returns the number of ticks that this entity has been alive for.
GetUniqueID
number
Returns the ID that uniquely identifies the entity within the running server. Note that this ID is not persisted to the data files.
GetWidth
number
Returns the width (X and Z size) of the entity.
GetWorld
cWorld
Returns the world where the entity resides
GetYaw
number
Returns the yaw (direction) of the entity. Measured in degrees, values range from -180 to +180. 0 means ZP, 90 means XM, -180 means ZM, -90 means XP.
HandleSpeedFromAttachee
ForwardAmountnumber
SidewaysAmountnumber
Updates the entity's speed based on the attachee exerting the specified force forward and sideways. Used for entities being driven by other entities attached to them - usually players driving minecarts and boats.
Heal
Hitpointsnumber
Heals the specified number of hitpoints. Hitpoints is expected to be a positive number.
IsA
ClassNamestring
boolean
Returns true if the entity class is a descendant of the specified class name, or the specified class itself
IsArrow
boolean
Returns true if the entity is an arrow.
IsBoat
boolean
Returns true if the entity is a boat.
IsCrouched
boolean
Returns true if the entity is crouched. Always false for entities that don't support crouching.
IsDestroyed
boolean
(DEPRECATED) Please use cEntity:IsTicking().
IsElytraFlying
boolean
Returns true if the entity is flying with an elytra. Entities that cannot fly with an elytra return always false.
IsEnderCrystal
boolean
Returns true if the entity is an ender crystal.
IsExpOrb
boolean
Returns true if the entity represents an experience orb
IsFallingBlock
boolean
Returns true if the entity represents a cFallingBlock entity.
IsFireproof
boolean
Returns true if the entity takes no damage from being on fire.
IsFloater
boolean
Returns true if the entity represents a fishing rod floater
IsHeadInWater
boolean
Returns true if the entity's head is in a water block
IsInFire
boolean
Returns true if any part of the entity is in a fire block
IsInLava
boolean
Returns true if any part of the entity is in a lava block
IsInWater
boolean
Returns true if any part of the entity is in a water block
IsInvisible
boolean
Returns true if the entity is invisible.
IsItemFrame
boolean
Returns true if the entity is an item frame.
IsLeashKnot
boolean
Returns true if the entity is a leash knot.
IsMinecart
boolean
Returns true if the entity represents a minecart
IsMob
boolean
Returns true if the entity represents any mob.
IsOnFire
boolean
Returns true if the entity is on fire
IsOnGround
boolean
Returns true if the entity is on ground (not falling, not jumping, not flying)
IsPainting
boolean
Returns if this entity is a painting.
IsPawn
boolean
Returns true if the entity is a cPawn descendant.
IsPickup
boolean
Returns true if the entity represents a pickup.
IsPlayer
boolean
Returns true if the entity represents a player
IsProjectile
boolean
Returns true if the entity is a cProjectileEntity descendant.
IsRclking
boolean
Currently unimplemented
IsRiding
boolean
Returns true if the entity is attached to (riding) another entity.
IsSprinting
boolean
Returns true if the entity is sprinting. Entities that cannot sprint return always false
IsSubmerged
boolean
Returns true if the entity's head is in a water block Currently deprecated in favour of IsHeadInWater()
IsSwimming
boolean
Returns true if any part of the entity is in a water block. Note, this function is only updated with mobs or players. Currently deprecated in favour of IsInWater()
IsTNT
boolean
Returns true if the entity represents a TNT entity
IsTicking
boolean
Returns true if the entity is valid and ticking. Returns false if the entity is not ticking and is about to leave its current world either via teleportation or destruction. If this returns false, you must stop using the cEntity pointer you have.
Killed
VictimcEntity
This entity has killed another entity (the Victim). For players, adds the scoreboard statistics about the kill.
MoveToWorld
WorldNamestring
ShouldSendRespawnboolean
boolean
Removes the entity from this world and starts moving it to the specified world's spawn point. Note that to avoid deadlocks, the move is asynchronous - the entity is moved into a queue and will be moved from that queue into the destination world at some (unpredictable) time in the future. ShouldSendRespawn is used only for players, it specifies whether the player should be sent a Respawn packet upon leaving the world (The client handles respawns only between different dimensions).
MoveToWorld
WorldcWorld
ShouldSendRespawnboolean
boolean
Removes the entity from this world and starts moving it to the specified world's spawn point. Note that to avoid deadlocks, the move is asynchronous - the entity is moved into a queue and will be moved from that queue into the destination world at some (unpredictable) time in the future. ShouldSendRespawn is used only for players, it specifies whether the player should be sent a Respawn packet upon leaving the world (The client handles respawns only between different dimensions).
MoveToWorld
WorldcWorld
ShouldSendRespawnboolean
PositionVector3d
boolean
Removes the entity from this world and starts moving it to the specified world. Note that to avoid deadlocks, the move is asynchronous - the entity is moved into a queue and will be moved from that queue into the destination world at some (unpredictable) time in the future. ShouldSendRespawn is used only for players, it specifies whether the player should be sent a Respawn packet upon leaving the world (The client handles respawns only between different dimensions). The Position parameter specifies the location that the entity should be placed in, in the new world.
MoveToWorld
WorldcWorld
PositionVector3d
ShouldSetPortalCooldownboolean
ShouldSendRespawnboolean
boolean
Removes the entity from this world and starts moving it to the specified world. Note that to avoid deadlocks, the move is asynchronous - the entity is moved into a queue and will be moved from that queue into the destination world at some (unpredictable) time in the future. If ShouldSetPortalCooldown is false (default), doesn't set any portal cooldown, if it is true, the default portal cooldown is applied to the entity. ShouldSendRespawn is used only for players, it specifies whether the player should be sent a Respawn packet upon leaving the world (The client handles respawns only between different dimensions). The Position parameter specifies the location that the entity should be placed in, in the new world.
SetAirDrag (undocumented)
SetGravity
Gravitynumber
Sets the number that is used as the gravity for physics simulation. 1G (9.78) by default.
SetHeadYaw
HeadPitchnumber
Sets the head pitch (FIXME: Rename to SetHeadPitch() ).
SetHealth
Hitpointsnumber
Sets the entity's health to the specified amount of hitpoints. Doesn't broadcast any hurt animation. Doesn't kill the entity if health drops below zero. Use the TakeDamage() function instead for taking damage.
SetInvulnerableTicks
NumTicksnumber
Sets the amount of ticks for which the entity will not receive any damage from other entities.
SetIsFireproof
IsFireproofboolean
Sets whether the entity receives damage from being on fire.
SetMass
Massnumber
Sets the mass of the entity. Currently unused.
SetMaxHealth
MaxHitpointsnumber
Sets the maximum hitpoints of the entity. If current health is above MaxHitpoints, it is capped to MaxHitpoints.
SetPitch
Pitchnumber
Sets the pitch (nose-down rotation) of the entity
SetPitchFromSpeed Sets the entity pitch to match its speed (entity looking forwards as it moves)
SetPosX
PosXnumber
Sets the X-coord of the entity's pivot
SetPosY
PosYnumber
Sets the Y-coord of the entity's pivot
SetPosZ
PosZnumber
Sets the Z-coord of the entity's pivot
SetPosition
Vector3dVector3d
Sets all three coords of the entity's pivot
SetPosition
PosXnumber
PosYnumber
PosZnumber
Sets all three coords of the entity's pivot
SetRoll
Rollnumber
Sets the roll (sideways rotation) of the entity. Currently unused.
SetSpeed
SpeedVector3d
Sets the current speed of the entity
SetSpeed
SpeedXnumber
SpeedYnumber
SpeedZnumber
Sets the current speed of the entity
SetSpeedX
SpeedXnumber
Sets the X component of the entity speed
SetSpeedY
SpeedYnumber
Sets the Y component of the entity speed
SetSpeedZ
SpeedZnumber
Sets the Z component of the entity speed
SetYaw
Yawnumber
Sets the yaw (direction) of the entity.
SetYawFromSpeed Sets the entity's yaw to match its current speed (entity looking forwards as it moves).
StartBurning
NumTicksnumber
Sets the entity on fire for the specified number of ticks. If entity is on fire already, makes it burn for either NumTicks or the number of ticks left from the previous fire, whichever is larger.
SteerVehicle
ForwardAmountnumber
SidewaysAmountnumber
Applies the specified steering to the vehicle this entity is attached to. Ignored if not attached to any entity.
StopBurning Extinguishes the entity fire, cancels all fire timers.
TakeDamage
AttackerEntitycEntity
Causes this entity to take damage that AttackerEntity would inflict. Includes their weapon and this entity's armor.
TakeDamage
DamageTypeeDamageType
AttackerEntitycEntity
RawDamagenumber
FinalDamagenumber
KnockbackAmountnumber
Causes this entity to take damage of the specified type, from the specified attacker (may be nil). The values are wrapped into a TakeDamageInfo structure and applied directly.
TakeDamage
DamageTypeeDamageType
AttackerEntitycEntity
RawDamagenumber
KnockbackAmountnumber
Causes this entity to take damage of the specified type, from the specified attacker (may be nil). The final damage is calculated from RawDamage using the currently equipped armor.
TeleportToCoords
PosXnumber
PosYnumber
PosZnumber
Teleports the entity to the specified coords. Asks plugins if the teleport is allowed.
TeleportToEntity
DestEntitycEntity
Teleports this entity to the specified destination entity. Asks plugins if the teleport is allowed.
Generated by APIDump on 2024-11-21 00:44:11, Build ID 74, Commit c0f6c97dcea08feb7d5cd1deefc0f6f76eb2cdbd