|ObserverLib-1.16.5-1.5.3.jar release||147.28 KB||Jun 1, 2021||1.16.5||453,845||Download|
|ObserverLib-1.16.5-1.5.2.jar release||147.15 KB||May 23, 2021||1.16.5||139,702||Download|
|ObserverLib-1.16.4-1.5.1.jar release||147.09 KB||Jan 8, 2021||1.16.4||3,159,890||Download|
|ObserverLib-1.16.4-1.5.0.jar release||146.98 KB||Jan 2, 2021||1.16.4||150,285||Download|
|ObserverLib-1.15.2-1.3.2.jar release||139.63 KB||Nov 20, 2020||1.15.2||143,627||Download|
|ObserverLib-1.15.2-1.3.1.jar release||139.57 KB||Nov 6, 2020||1.15.2||3,920||Download|
|ObserverLib-1.15.2-1.2.1.jar release||133.67 KB||Oct 22, 2020||1.15.2||9,969||Download|
|ObserverLib-1.15.2-1.2.0.jar release||133.63 KB||Jul 18, 2020||1.15.2||155,721||Download|
|ObserverLib-1.14.3-1.1.0.jar release||79.42 KB||Jul 5, 2019||1.14.3||159||Download|
|ObserverLib-1.13.2-1.0.0.jar release||55.86 KB||May 30, 2019||1.13.2||310||Download|
|ObserverLib-1.16.4-1.4.4.jar beta||143.94 KB||Nov 25, 2020||1.16.4||554,501||Download|
|ObserverLib-1.16.4-1.4.3.jar beta||143.94 KB||Nov 20, 2020||1.16.4||39,436||Download|
ObserverLib is a library mod, usable to reliably observe block changes in a potentially large area with very little performance implications.
The library is publicly usable and is primarily focused to be used in Astral Sorcery from 1.13+.
In essence this mod allows you to register an Observer - whatever it observes in the end is up to the implementation – for a specific area. Changes that happen in the world in its observed area are passed onto the Observer. The observer can then decide on its own what these changes mean; if they invalidate or validate the observer's state. So for example if the structure is now complete or not.
The actual call to check if things are valid or not is to query the ChangeSubscriber at the relevant position and then ask if its current state is valid or not.
What makes this better than generally just repeatedly checking a large area? What happens if the area you want to observe is larger than a chunk? What happens if the other chunk you have to check becomes unloaded? In order to be sure nothing has changed and the structure is intact, a mod would have to load said chunk and check the block. Potentially an issue if this causes a lot of chunk loading and unloading. The Implementation of ObserverLib makes sure you can relax and the changes passed onto your implementation of notifyChange contain all necessary information to make sure whatever you're observing is still valid or not.
One exemplary implementation for checking if a structure is built correctly or not can be seen here. Instead of always checking everything of the structure's components, the check makes sure to track the positions that are incorrect/mismatching and only works based off of mismatches to what the matcher expects.
If you're interested in using it for your own projects, you can grab it from maven here: https://maven.hellfiredev.net/hellfirepvp/observerlib/observerlib/
For further explanations and details, feel free to ask on the AstralSorcery discord: https://discord.gg/q37VRcT