| 18 | |
| 19 | namespace endstone::python { |
| 20 | void init_attribute(py::module_ &m) |
| 21 | { |
| 22 | py::class_<Attribute>(m, "Attribute", "All attribute types.") |
| 23 | .def_property_readonly_static( |
| 24 | "HEALTH", [](const py::object &) { return Attribute::Health; }, "Health of an entity.") |
| 25 | .def_property_readonly_static( |
| 26 | "FOLLOW_RANGE", [](const py::object &) { return Attribute::FollowRange; }, |
| 27 | "Range at which an entity will follow others.") |
| 28 | .def_property_readonly_static( |
| 29 | "KNOCKBACK_RESISTANCE", [](const py::object &) { return Attribute::KnockbackResistance; }, |
| 30 | "Resistance of an entity to knockback.") |
| 31 | .def_property_readonly_static( |
| 32 | "MOVEMENT_SPEED", [](const py::object &) { return Attribute::MovementSpeed; }, |
| 33 | "Movement speed of an entity.") |
| 34 | .def_property_readonly_static( |
| 35 | "UNDERWATER_MOVEMENT_SPEED", [](const py::object &) { return Attribute::UnderwaterMovementSpeed; }, |
| 36 | "Movement speed of an entity underwater.") |
| 37 | .def_property_readonly_static( |
| 38 | "LAVA_MOVEMENT_SPEED", [](const py::object &) { return Attribute::LavaMovementSpeed; }, |
| 39 | "Movement speed of an entity in lava.") |
| 40 | .def_property_readonly_static( |
| 41 | "ATTACK_DAMAGE", [](const py::object &) { return Attribute::AttackDamage; }, "Attack damage of an entity.") |
| 42 | .def_property_readonly_static( |
| 43 | "ABSORPTION", [](const py::object &) { return Attribute::Absorption; }, "Absorption of an entity.") |
| 44 | .def_property_readonly_static( |
| 45 | "LUCK", [](const py::object &) { return Attribute::Luck; }, "Luck bonus of an entity.") |
| 46 | .def_property_readonly_static( |
| 47 | "JUMP_STRENGTH", [](const py::object &) { return Attribute::JumpStrength; }, |
| 48 | "Strength with which an entity will jump.") |
| 49 | .def_property_readonly_static( |
| 50 | "PLAYER_HUNGER", [](const py::object &) { return Attribute::PlayerHunger; }, "Hunger level of a player.") |
| 51 | .def_property_readonly_static( |
| 52 | "PLAYER_SATURATION", [](const py::object &) { return Attribute::PlayerSaturation; }, |
| 53 | "Saturation level of a player.") |
| 54 | .def_property_readonly_static( |
| 55 | "PLAYER_EXHAUSTION", [](const py::object &) { return Attribute::PlayerExhaustion; }, |
| 56 | "Exhaustion level of a player.") |
| 57 | .def_property_readonly_static( |
| 58 | "PLAYER_LEVEL", [](const py::object &) { return Attribute::PlayerLevel; }, "Experience level of a player.") |
| 59 | .def_property_readonly_static( |
| 60 | "PLAYER_EXPERIENCE", [](const py::object &) { return Attribute::PlayerExperience; }, |
| 61 | "Progress toward the next experience level of a player.") |
| 62 | .def_property_readonly_static( |
| 63 | "ZOMBIE_SPAWN_REINFORCEMENTS", [](const py::object &) { return Attribute::ZombieSpawnReinforcements; }, |
| 64 | "Chance of a zombie to spawn reinforcements."); |
| 65 | |
| 66 | auto modifier = py::class_<AttributeModifier>(m, "AttributeModifier", "Represents an attribute modifier."); |
| 67 | |
| 68 | py::native_enum<AttributeModifier::Operation>(modifier, "Operation", "enum.Enum", "Operation to be applied.") |
| 69 | .value("ADD", AttributeModifier::Operation::Add, "Adds (or subtracts) the specified amount to the base value.") |
| 70 | .value("MULTIPLY_BASE", AttributeModifier::Operation::MultiplyBase, |
| 71 | "Multiplies the current value of the attribute by (1 + x), " |
| 72 | "where x is the sum of the modifiers' amounts.") |
| 73 | .value("MULTIPLY", AttributeModifier::Operation::Multiply, |
| 74 | "For every modifier, multiplies the current value of the attribute by (1 + x), " |
| 75 | "where x is the amount of the particular modifier.") |
| 76 | .export_values() |
| 77 | .finalize(); |
no test coverage detected