Interface IIngredientComponentStorageObservable<T,M>
- Type Parameters:
T
- The instance type.M
- The matching condition parameter, may be Void. Instances MUST properly implement the equals method.
- All Known Subinterfaces:
IEnergyNetwork
,IPositionedAddonsNetworkIngredients<T,
M>
- All Known Implementing Classes:
EnergyNetwork
,PositionedAddonsNetworkIngredients
public interface IIngredientComponentStorageObservable<T,M>
An observable ingredient component storage.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
A type of change.static interface
An observer for listening to storage changes.static class
A storage change event. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add an observer for listing to index change events.getChannelIndex
(int channel) Get the last indexed storage at the given channel.boolean
isObservationForcedPending
(int channel) void
Remove the given index change observer.void
Manually run observer synchronously (even if async is allowed), if it should observe.void
Indicate that this network should observe starting somewhere in the future.void
scheduleObservationForced
(int channel, PartPos pos) Indicate that this network should observe starting in the next tick.boolean
-
Method Details
-
getComponent
- Returns:
- The ingredient component type this storage applies to.
-
addObserver
Add an observer for listing to index change events.- Parameters:
observer
- An index change observer.
-
removeObserver
Remove the given index change observer. This will silently fail if the given observer was not registered.- Parameters:
observer
- An index change observer.
-
scheduleObservation
void scheduleObservation()Indicate that this network should observe starting somewhere in the future. This should be called when observer diffs are needed, but are not urgent. This is a more efficient variant ofscheduleObservationForced(int, PartPos)
. This should be called each time that observations are needed, as this observable will reset the internal flag after each observation. -
scheduleObservationForced
Indicate that this network should observe starting in the next tick. This is a stricter variant ofscheduleObservation()
, and can only be done for a single position and channel. This should be called when observer diffs are needed in the next tick for the given position.- Parameters:
channel
- The channel to force an observation in.pos
- The position to force an observation for.
-
shouldObserve
boolean shouldObserve()- Returns:
- If an observation should happen.
-
isObservationForcedPending
boolean isObservationForcedPending(int channel) - Parameters:
channel
- The channel to check for a forced observation in.- Returns:
- If the given channel contains a forced observation scheduling that has not been processed yet.
-
runObserverSync
void runObserverSync()Manually run observer synchronously (even if async is allowed), if it should observe. -
getChannelIndex
Get the last indexed storage at the given channel.- Parameters:
channel
- A channel id.- Returns:
- A channel index.
-