Yet-Another-World-Protector icon indicating copy to clipboard operation
Yet-Another-World-Protector copied to clipboard

[Description WIP] Implement an API for other mods to manage regions

Open Z0rdak opened this issue 3 years ago • 4 comments

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

Z0rdak avatar Aug 13 '22 11:08 Z0rdak

~~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.

Z0rdak avatar Jun 11 '23 12:06 Z0rdak

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

Z0rdak avatar Jan 18 '24 15:01 Z0rdak

  • [x] Note: FlagBuilder to easily create Flag instances

Z0rdak avatar May 30 '24 20:05 Z0rdak

First iteration: https://github.com/Z0rdak/Yet-Another-World-Protector/tree/fabric/1.20.1-api/src/main/java/de/z0rdak/yawp/api

Z0rdak avatar Sep 27 '24 20:09 Z0rdak