Improve performance by reducing unnecessary lighting updates (#32)

Introduce 5 second delay on changing ambient lighting when a machine shuts off. IActiveState now has a concept of wasActiveRecently to enable rendering/block updates to have some wiggle room.
This commit is contained in:
Dave Smith authored and GitHub committed 2019-03-14 12:38:16 -06:00
1 parent 8c79baccf6
commit 2c6d666b89
7 files changed
+47 -49

No files matched your search

@@ -21,6 +21,16 @@ public interface IActiveState {
*/
void setActive(boolean active);
/**
* Determine if a machine/generator was "recently" active, where "recently" is up to the interface
* implementor. This is useful for reducing rendering calls, esp. when the entity can oscillate between
* active/inactive states rapidly.
*
* The default implementation just returns current active state.
*
*/
default boolean wasActiveRecently() { return getActive(); }
/**
* Whether or not this block has a visual effect when it is on it's active state. Used for rendering.
*