[All] Feat: Delegates listeners · Issue #57 · lambda-client/lambda · GitHub
Skip to content

[All] Feat: Delegates listeners #57

Description

@emyfops

Feature

Delegates on listeners allow for single self-destroyable listeners to exist.
The following code will return the closest entity to the player once the back input key is pressed.

val closestEntity by receiveNext<MovementEvent.InputUpdate, Entity>(
    transform = { getClosestEntity<Entity>(player.eyePos, 7.0) },
) { it.input.pressingBack }

It also allows to listen incoming events in an unorthodox way.
There are no practical uses outside of unsynchronized multi-threading where value loss is acceptable.

val events by listener<TickEvent.Pre>()

Additional Information

No response

Pull Request

  • I will be submitting a pull request

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

featureSuggests or adds a new feature

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions