Function API

Function API

1.4k Downloads

Create a more geneic ˋeventˋ class

Frontrider opened this issue · 7 comments

commented

Is your feature request related to a problem? Please describe.
As the engine supports event handlers other than commands (java included, javascript WIP) we should use something more generic than the ˋCommandSourceˋ.

Describe the solution you'd like
A new ˋEventˋ class that can better accomodate new script engines.

Requested fields:

  • position(vector3)
  • block (optional)
  • sourceEntity(optional)
  • Target for sending feedback
  • members: an array containin additional entities that are involved, for example the other animal during breeding, or the true source of damage.

Additionally:
It should also have an ˋexecuteˋ style command to switch into these members. The command context should not change, unless an ˋasˋ subcommand was called.

Describe alternatives you've considered
The current solution is to use the built-in ˋServerCommandSourceˋ class, as this is what commands use.

commented

We'd definitely need some way to either convert to a ServerCommandSource or wrap a ServerCommandSource in our EventSource.

commented

I'd probably mix into the ServerCommandSource to contain the required fields, the convert our Event to it. I'd like to remove minecraft classes from the core of the system.

commented
commented

I wanted to avoid parsing strings in the middle of my code. And I already have all the members at hand. No need to search for them again.

commented

Yeah yeah, these were meant for calling from JS code in obf environment.