Download ObserverLib — Minecraft Mods — MetaMods

ObserverLib

Active

Downloads

15

Last update

2 years ago
Client
Fabric
Quilt
Forge
Neoforge
Libraries

ObserverLib - Library for Observing Block Changes

ObserverLib is a library mod that provides reliable tracking of block changes across large areas with minimal impact on game performance.

This library is publicly available and was primarily developed for integration with the Astral Sorcery mod starting from version 1.13.

The core functionality allows registering an observer for a specific area. The implementation determines exactly which changes will be tracked. When changes occur in the observed zone, they are passed to the observer, which independently analyzes their significance and determines whether they invalidate or confirm the current state's correctness. For example, you can track the completion of building a specific structure.

To verify the state's relevance, you need to query the change subscriber at the corresponding position and determine whether the current state is valid.

The key advantage of ObserverLib over regular periodic checking of large areas becomes apparent when working with territories exceeding chunk size. If the chunk needed for checking is unloaded, the standard approach would require loading it to check blocks, which could cause issues with frequent chunk loading and unloading. ObserverLib solves this problem by passing all necessary information about changes directly to your implementation, allowing precise determination of the observed object's validity preservation.

An example implementation for checking the correctness of a built structure demonstrates an efficient approach: instead of constantly checking all structure components, the system tracks only positions with mismatches and works exclusively with deviations from the expected state.

Project members
HellFirePvP

HellFirePvP

Created: 12 Aug 2023

ID: 14347