Skip to content

Commit

Permalink
feat: add python binding for Mob::isGliding
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-vincent committed Jul 11, 2024
1 parent a6542c8 commit 7b60b1c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/endstone/actor/mob.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ class Mob : public Actor {
* @brief Checks to see if an actor is gliding, such as using an Elytra.
* @return True if this actor is gliding.
*/
virtual bool isGliding() const = 0;
[[nodiscard]] virtual bool isGliding() const = 0;
};
} // namespace endstone
5 changes: 5 additions & 0 deletions python/src/endstone/_internal/endstone_python.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,11 @@ class Mob(Actor):
"""
Represents a mobile entity (i.e. living entity), such as a monster or player.
"""
@property
def is_gliding(self) -> bool:
"""
Checks to see if an actor is gliding, such as using an Elytra.
"""
class Permissible:
"""
Represents an object that may become a server operator and can be assigned permissions.
Expand Down
3 changes: 2 additions & 1 deletion src/endstone_python/actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ void init_actor(py::module_ &m, py::class_<Actor, CommandSender> &actor)
py::return_value_policy::reference);

py::class_<Mob, Actor>(m, "Mob", "Represents a mobile entity (i.e. living entity), such as a monster or player.")
.def_property_readonly("is_gliding", &Mob::isGliding, "");
.def_property_readonly("is_gliding", &Mob::isGliding,
"Checks to see if an actor is gliding, such as using an Elytra.");
}

} // namespace endstone::detail

0 comments on commit 7b60b1c

Please sign in to comment.