Molang Entity Functions
Type is ObjectValue<LivingEntity>.
| Name | Description | Usage | Must be called on |
|---|---|---|---|
uuid(): String |
Returns the UUID of the entity. | v.entity.uuid() |
|
damage(amount: Double) |
Deals damage equal to amount. Damage type is generic.
|
v.entity.damage(5) |
|
walk_to(x: Double, y: Double, z: Double, speedMultiplier: Double?) |
If the entity is a PathfinderMob then the mob will change its target to the x, y, and z. speedMultiplier is 0.35 by default.
|
v.entity.walk_to(0, 0, 0) |
|
has_walk_target(): Double |
Returns 1.0 if the entity is a PathfinderMob and has a walk target or is currently pathfinding. Otherwise returns 0.0.
|
v.entity.has_walk_target() |
|
is_sneaking(): Double |
Returns 1.0 if the entity is sneaking. Otherwise returns 0.0.
|
v.entity.is_sneaking() |
|
is_sprinting(): Double |
Returns 1.0 if the entity is sprinting. Otherwise returns 0.0.
|
v.entity.is_sprinting() |
|
is_flying(): Double |
Returns 1.0 if the entity is flying. Otherwise returns 0.0.
|
v.entity.is_flying() |
|
is_in_water(): Double |
Returns 1.0 if the entity is in water. Otherwise returns 0.0.
|
v.entity.is_in_water() |
|
is_touching_water_or_rain(): Double |
Returns 1.0 if the entity is touching water or rain. Otherwise returns 0.0.
|
v.entity.is_touching_water_or_rain() |
|
is_touching_water(): Double |
Returns 1.0 if the entity is touching water. Otherwise returns 0.0.
|
v.entity.is_touching_water() |
|
is_underwater(): Double |
Returns 1.0 if the entity is underwater. Otherwise returns 0.0.
|
v.entity.is_under_water() |
|
is_in_lava(): Double |
Returns 1.0 if the entity is in lava. Otherwise returns 0.0.
|
v.entity.is_in_lava() |
|
is_on_fire(): Double |
Returns 1.0 if the entity is on fire. Otherwise returns 0.0.
|
v.entity.is_on_fire() |
|
is_invisible(): Double |
Returns 1.0 if the entity is invisible. Otherwise returns 0.0.
|
v.entity.is_invisible() |
|
is_sleeping(): Double |
Returns 1.0 if the entity is sleeping. Otherwise returns 0.0.
|
v.entity.is_sleeping() |
|
is_riding(): Double |
Returns 1.0 if the entity is riding. Otherwise returns 0.0.
|
v.entity.is_riding() |
|
health(): Double |
Returns the current health of the entity. | v.entity.health() |
|
distance_to_pos(x: Double, y: Double, z: Double): Double |
Returns the distance from the entity to the position at x, y, and z. Pythagoras baby!
|
v.entity.distance_to_pos(0, 0, 0) |
|
max_health(): Double |
Returns the max health of the entity. | v.entity.max_health() |
|
name(): String |
Returns the name of the entity. | v.entity.name() |
|
type(): MoValue |
Returns the type of the entity as a string if it is registered. Otherwise returns 0.0.
|
v.entity.type() |
|
yaw(): Double |
Returns the yaw of the entity. | v.entity.yaw() |
|
pitch(): Double |
Returns the pitch of the entity. | v.entity.pitch() |
|
x(): Double |
Returns the x position of the entity. | v.entity.x() |
|
y(): Double |
Returns the y position of the entity. | v.entity.y() |
|
z(): Double |
Returns the z position of the entity. | v.entity.z() |
|
velocity_x(): Double |
Returns the x velocity of the entity. | v.entity.velocity_x() |
|
velocity_y(): Double |
Returns the y velocity of the entity. | v.entity.velocity_y() |
|
velocity_z(): Double |
Returns the z velocity of the entity. | v.entity.velocity_z() |
|
width(): Double |
Returns the width of the entity. | v.entity.width() |
|
height(): Double |
Returns the height of the entity. | v.entity.height() |
|
entity_size(): Double |
Returns the larger dimension between the xsize and the ysize of the entity. | v.entity.entity_size() |
|
entity_width(): Double |
Returns the width of the entity. | v.entity.entity_width() |
|
entity_height(): Double |
Returns the height of the entity. | v.entity.entity_height() |
|
id_modulo(modValue: Double): Double |
Returns the value of the entities' UUID mod modValue.
|
v.entity.id_modulo(32) |
|
horizontal_velocity(): Double |
Returns the horizontal velocity of the entity. | v.entity.horizontal_velocity() |
|
vertical_velocity(): Double |
Returns the vertical velocity of the entity. | v.entity.vertical_velocity() |
|
world(): ObjectValue<Holder<Level>> |
Returns the world that the entity is in as a ObjectValue<Holder<Level>>.
|
v.entity.world() |
|
biome(): ObjectValue<Holder<Biome>> |
Returns the biome that the entity is in as a ObjectValue<Holder<Biome>>.
|
v.entity.biome() |
|
is_passenger(): Double |
Returns 1.0 if the entity is invisible. Otherwise returns 0.0.
|
v.entity.is_passenger() |
|
is_healer_in_use(position: ArrayStruct<Int>): Double |
Returns if the healing machine at position is in use. Uses the entities' level. Returns 1.0.
|
v.entity.is_healer_in_use(0, 0, 0) |
|
find_nearby_block(identifier: String, range: Double?): MoValue |
Looks for a block within a cube with size range centered around the entity, with a default of 10 |
v.entity.find_nearby_block('cobblemon:restoration_tank') |
|
get_nearby_entities(distance: Double): ArrayStruct<MoValue> |
Get entities within a cube with size distance centered around the entity. Returns an ArrayStruct with the most specific type, such as ObjectValue<Player>, ObjectValue<NPCEntity>, or ObjectValue<LivingEntity>.
|
v.entity.get_nearby_entities(10) |
|
is_standing_on_blocks(depth: Int, blocks, ResourceLocation...): Double |
If the entity is standing on any of the supplied blocks then the funtion returns 1.0, othewise returns 0.0
|
v.entity.is_standing_on_blocks(2, 'dirt', 'cobblemon:apricorn_log') |
|
play_animation(animation: String, target: String?): DoubleValue |
Plays an animation on an entity by the name animation. If target is not specified or null then all nearby entities will get the animation packet. If target is either a player name or UUID then the packet will be sent to them only. Returns 1.0 if packet(s) are sent, otherwise returns 0.0.
|
v.entity.play_animation('sleep') |
PoseableEntities |
spawn_bedrock_particles(effect: String, locator: String, player: MoValue?) |
Sends bedrock particles of the resource effect and locator to players around the entity, or to player only. player can either be a UUID or a ObjectValue<Player>. Locator is required, even if unused on non-poseable entities.
|
q.entity.spawn_bedrock_particles('cobblemon:cherry_leaves_particle', 'middle') |