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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd an observer for listing to index change events.protected voidemitEvent(IIngredientComponentStorageObservable.StorageChangeEvent<T, M> event, boolean forceSync) protected int[]protected intgetLastRemoved(int channel) protected Set<PrioritizedPartPos> getPositionsCopy(int channel) booleanisTickResetPending(int channel) protected booleanobserve(boolean forceSync) protected voidobserve(int channel, boolean forceSync) voidonPositionRemoved(int channel, PrioritizedPartPos pos) voidRemove the given index change observer.voidresetTickInterval(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)
-