Skip to main content

yog_event/entity/
actions.rs

1//! Entities: the host's actions.
2
3use crate::Point;
4use yog_core::EntityInfo;
5use yog_ids as ids;
6
7actions! {
8    /// Moves the entity in its dimension.
9    Teleport { uuid: String, pos: Point } -> bool = ids::service_entity::TELEPORT, "YogEntityActions.entityTeleport";
10    /// Moves the entity to `pos` in `dim`.
11    TeleportToDim { uuid: String, dim: String, pos: Point } -> bool = ids::service_entity::TELEPORT_TO_DIM, "YogEntityActions.entityTeleportToDim";
12    /// The entity's position.
13    Position { uuid: String } -> Option<Point> = ids::service_entity::POSITION, "YogQueries.entityPosition";
14    /// Which way the entity faces.
15    Rotation { uuid: String } -> Option<yog_core::Rotation> = ids::service_entity::ROTATION, "YogQueries.entityRotation";
16    /// The entity's velocity.
17    Velocity { uuid: String } -> Option<Point> = ids::service_entity::VELOCITY, "YogQueries.entityVelocity";
18    /// Sets the entity's velocity.
19    SetVelocity { uuid: String, velocity: Point } -> bool = ids::service_entity::SET_VELOCITY, "YogEntityActions.entitySetVelocity";
20    /// Adds to the entity's velocity.
21    AddVelocity { uuid: String, velocity: Point } -> bool = ids::service_entity::ADD_VELOCITY, "YogEntityActions.entityAddVelocity";
22    /// A living entity's health.
23    Health { uuid: String } -> Option<f64> = ids::service_entity::HEALTH, "YogEntityActions.entityHealth";
24    /// Sets a living entity's health.
25    SetHealth { uuid: String, health: f64 } -> bool = ids::service_entity::SET_HEALTH, "YogEntityActions.entitySetHealth";
26    /// Kills the entity.
27    Kill { uuid: String } -> bool = ids::service_entity::KILL, "YogEntityActions.entityKill";
28    /// Spawns an entity of `entity_type`; its uuid.
29    Spawn { entity_type: String, dim: String, pos: Point } -> Option<String> = ids::service_entity::SPAWN, "YogEntityActions.spawnEntity";
30    /// Gives the entity a mob effect.
31    AddEffect { uuid: String, effect: String, duration: i32, amplifier: u8, particles: bool } -> bool = ids::service_entity::ADD_EFFECT, "YogEntityActions.entityAddEffect";
32    /// Takes a mob effect off the entity.
33    RemoveEffect { uuid: String, effect: String } -> bool = ids::service_entity::REMOVE_EFFECT, "YogEntityActions.entityRemoveEffect";
34    /// Takes every mob effect off the entity.
35    ClearEffects { uuid: String } -> bool = ids::service_entity::CLEAR_EFFECTS, "YogEntityActions.entityClearEffects";
36    /// The entity's data as SNBT.
37    Nbt { uuid: String } -> Option<String> = ids::service_entity::NBT, "YogEntityActions.entityGetNbt";
38    /// Merges `snbt` into the entity's data.
39    SetNbt { uuid: String, snbt: String } -> bool = ids::service_entity::SET_NBT, "YogEntityActions.entitySetNbt";
40    /// An attribute's base value.
41    AttributeBase { uuid: String, attribute: String } -> Option<f64> = ids::service_entity::ATTRIBUTE_BASE, "YogEntityActions.entityAttributeGet";
42    /// Sets an attribute's base value.
43    SetAttributeBase { uuid: String, attribute: String, value: f64 } -> bool = ids::service_entity::SET_ATTRIBUTE_BASE, "YogEntityActions.entityAttributeSet";
44    /// An attribute's value with its modifiers.
45    AttributeValue { uuid: String, attribute: String } -> Option<f64> = ids::service_entity::ATTRIBUTE_VALUE, "YogEntityActions.entityAttributeValue";
46    /// The entity's state.
47    Info { uuid: String } -> Option<EntityInfo> = ids::service_entity::INFO, "YogQueries.entityInfo";
48    /// Hurts the entity.
49    Damage { uuid: String, amount: f32, damage_type: String, attacker: String } -> bool = ids::service_entity::DAMAGE, "YogEntityActions.entityDamage";
50    /// Sets the entity on fire for `ticks`.
51    SetFireTicks { uuid: String, ticks: i32 } -> bool = ids::service_entity::SET_FIRE_TICKS, "YogEntityActions.entitySetFireTicks";
52    /// The uuid of what the entity rides.
53    Vehicle { uuid: String } -> Option<String> = ids::service_entity::VEHICLE, "YogEntityActions.entityVehicle";
54    /// The uuids riding the entity.
55    Passengers { uuid: String } -> Vec<String> = ids::service_entity::PASSENGERS, "YogQueries.entityPassengers";
56    /// Makes `rider` ride `vehicle`.
57    Mount { rider: String, vehicle: String, force: bool } -> bool = ids::service_entity::MOUNT, "YogEntityActions.entityMount";
58    /// Gets the entity off what it rides.
59    Dismount { uuid: String } -> bool = ids::service_entity::DISMOUNT, "YogEntityActions.entityDismount";
60    /// Sets how far the entity has fallen.
61    SetFallDistance { uuid: String, distance: f32 } -> bool = ids::service_entity::SET_FALL_DISTANCE, "YogEntityActions.entitySetFallDistance";
62}