Class IngredientObserver<T,M>
java.lang.Object
org.cyclops.integrateddynamics.core.network.IngredientObserver<T,M>
Instances of this class are able to watch ingredient positions and emit diffs.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add an observer for listing to index change events.protected void
emitEvent
(IIngredientComponentStorageObservable.StorageChangeEvent<T, M> event, boolean forceSync) protected int[]
protected int
getLastRemoved
(int channel) protected Set<PrioritizedPartPos>
getPositionsCopy
(int channel) boolean
isTickResetPending
(int channel) protected boolean
observe
(boolean forceSync) protected void
observe
(int channel, boolean forceSync) void
onPositionRemoved
(int channel, PrioritizedPartPos pos) void
Remove the given index change observer.void
resetTickInterval
(int channel, PartPos targetPos)
-
Constructor Details
-
IngredientObserver
-
-
Method Details
-
getNetwork
-
getLastRemoved
-
onPositionRemoved
-
addChangeObserver
public void addChangeObserver(IIngredientComponentStorageObservable.IIndexChangeObserver<T, M> observer) Add an observer for listing to index change events.- Parameters:
observer
- An index change observer.
-
removeChangeObserver
public void removeChangeObserver(IIngredientComponentStorageObservable.IIndexChangeObserver<T, M> observer) Remove the given index change observer. This will silently fail if the given observer was not registered.- Parameters:
observer
- An index change observer.
-
getCurrentTick
protected int getCurrentTick() -
emitEvent
protected void emitEvent(IIngredientComponentStorageObservable.StorageChangeEvent<T, M> event, boolean forceSync) -
getObserversCopy
-
getChannels
protected int[] getChannels() -
observe
protected boolean observe(boolean forceSync) - Parameters:
forceSync
- If observation should happen synchronously.- Returns:
- If an observation job was successfully started if it was needed.
-
getPositionsCopy
-
observe
protected void observe(int channel, boolean forceSync) -
resetTickInterval
-
isTickResetPending
public boolean isTickResetPending(int channel)
-