-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…eractions feat: portable grid interactions
- Loading branch information
Showing
30 changed files
with
561 additions
and
180 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
...src/main/java/com/refinedmods/refinedstorage2/api/grid/operations/NoopGridOperations.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.refinedmods.refinedstorage2.api.grid.operations; | ||
|
||
import com.refinedmods.refinedstorage2.api.storage.ExtractableStorage; | ||
import com.refinedmods.refinedstorage2.api.storage.InsertableStorage; | ||
|
||
public class NoopGridOperations<T> implements GridOperations<T> { | ||
@Override | ||
public boolean extract(final T resource, | ||
final GridExtractMode extractMode, | ||
final InsertableStorage<T> destination) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean insert(final T resource, | ||
final GridInsertMode insertMode, | ||
final ExtractableStorage<T> source) { | ||
return false; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...ain/java/com/refinedmods/refinedstorage2/api/grid/watcher/GridStorageChannelProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.refinedmods.refinedstorage2.api.grid.watcher; | ||
|
||
import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannel; | ||
import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannelType; | ||
|
||
import java.util.Set; | ||
|
||
import org.apiguardian.api.API; | ||
|
||
/** | ||
* Provides the {@link GridWatcherManagerImpl} with {@link StorageChannel}s. | ||
*/ | ||
@API(status = API.Status.STABLE, since = "2.0.0-milestone.3.3") | ||
public interface GridStorageChannelProvider { | ||
Set<StorageChannelType<?>> getStorageChannelTypes(); | ||
|
||
<T> StorageChannel<T> getStorageChannel(StorageChannelType<T> type); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...pi/src/main/java/com/refinedmods/refinedstorage2/api/grid/watcher/GridWatcherManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.refinedmods.refinedstorage2.api.grid.watcher; | ||
|
||
import com.refinedmods.refinedstorage2.api.storage.Actor; | ||
|
||
import org.apiguardian.api.API; | ||
|
||
/** | ||
* This manager helps with attaching and detaching listeners to | ||
* {@link com.refinedmods.refinedstorage2.api.storage.channel.StorageChannel}s. | ||
*/ | ||
@API(status = API.Status.STABLE, since = "2.0.0-milestone.3.3") | ||
public interface GridWatcherManager { | ||
void addWatcher( | ||
GridWatcher watcher, | ||
Class<? extends Actor> actorType, | ||
GridStorageChannelProvider storageChannelProvider | ||
); | ||
|
||
void attachAll(GridStorageChannelProvider storageChannelProvider); | ||
|
||
void removeWatcher(GridWatcher watcher, GridStorageChannelProvider storageChannelProvider); | ||
|
||
void detachAll(GridStorageChannelProvider storageChannelProvider); | ||
|
||
void activeChanged(boolean active); | ||
} |
74 changes: 39 additions & 35 deletions
74
.../network/impl/node/grid/GridWatchers.java → .../grid/watcher/GridWatcherManagerImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
...pl/node/grid/GridWatcherRegistration.java → ...grid/watcher/GridWatcherRegistration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...efinedstorage2/api/grid/package-info.java → ...orage2/api/grid/watcher/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.