Yet-Another-World-Protector
Yet-Another-World-Protector copied to clipboard
[Description WIP] Implement an API for other mods to manage regions
Description
To ease integration and interoperability with other mods, an API to manage the regions of YAWP would be of great value. Among other things, this would help make mod packs easier.
In the first iteration, this API should provide a programmatic abstraction for the functions already be covered by the commands.
To know whether an action was successful, it is important to return an appropriate value for feedback. Most of the time a boolean is just fine, but throwing an exception would also be fine. In this case, a custom Exception implementation would be great.
With this API in place, most of the logic in the command utilities could also be replaced with the corresponding API calls.
There is a draft at the discord server: https://discord.com/channels/1010986742905585759/1247085753016782929
~~Consider an "Endpoint" for providing region area information to display them on mini-map mods.~~
The regions can be queried through the API. Maybe a QoL abstraction could be added as well.
Events when adding and removing Flags for Regions. This could be usefull for internal thing but as well as for some custom logic for modpack making.
Example: Useful for spawning flags to clear all mobs in a region when a spawning flag is added. Currently this is hard-coded. A event could be used to decouple this logic
- [x] Note: FlagBuilder to easily create Flag instances
First iteration: https://github.com/Z0rdak/Yet-Another-World-Protector/tree/fabric/1.20.1-api/src/main/java/de/z0rdak/yawp/api