diff options
| author | shedaniel <daniel@shedaniel.me> | 2020-07-13 22:11:38 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2020-07-13 22:11:38 +0800 |
| commit | c531e830ba3a5c13ec05f086e81b6776cd075539 (patch) | |
| tree | 4dec7aa3a1a3aa423c80d20094d72a0aeed7bf80 /src/main/java/me/shedaniel/rei/api/AutoTransferHandler.java | |
| parent | ad005ad366c8238f8592e8595000742fe4d73a2e (diff) | |
| parent | 0df9f46a8b74ec6517eeb574633d436c066027f3 (diff) | |
| download | RoughlyEnoughItems-c531e830ba3a5c13ec05f086e81b6776cd075539.tar.gz RoughlyEnoughItems-c531e830ba3a5c13ec05f086e81b6776cd075539.tar.bz2 RoughlyEnoughItems-c531e830ba3a5c13ec05f086e81b6776cd075539.zip | |
Merge branch 'pull/379' into 4.x
Diffstat (limited to 'src/main/java/me/shedaniel/rei/api/AutoTransferHandler.java')
| -rw-r--r-- | src/main/java/me/shedaniel/rei/api/AutoTransferHandler.java | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/src/main/java/me/shedaniel/rei/api/AutoTransferHandler.java b/src/main/java/me/shedaniel/rei/api/AutoTransferHandler.java index 85eb02553..aff7a5e2b 100644 --- a/src/main/java/me/shedaniel/rei/api/AutoTransferHandler.java +++ b/src/main/java/me/shedaniel/rei/api/AutoTransferHandler.java @@ -47,7 +47,11 @@ public interface AutoTransferHandler { static Result createSuccessful() { return new ResultImpl(); } - + + static Result createSuccessfulReturningToScreen() { + return new ResultImpl(true, true, true); + } + static Result createNotApplicable() { return new ResultImpl(false); } @@ -71,6 +75,12 @@ public interface AutoTransferHandler { int getColor(); boolean isSuccessful(); + + /** + * Applicable if {@link #isSuccessful()} is true. Will return + * to the previous screen rather than staying open. + */ + boolean isReturningToScreen(); boolean isApplicable(); @@ -111,21 +121,25 @@ public interface AutoTransferHandler { @ApiStatus.Internal final class ResultImpl implements Result { - private boolean successful, applicable; + private boolean successful, applicable, returningToScreen; private String errorKey; private IntList integers = new IntArrayList(); private int color; private ResultImpl() { - this.successful = true; - this.applicable = true; + this(true, true, false); } public ResultImpl(boolean applicable) { - this.successful = false; + this(false, applicable, false); + } + + public ResultImpl(boolean successful, boolean applicable, boolean returningToScreen) { + this.successful = successful; this.applicable = applicable; + this.returningToScreen = returningToScreen; } - + public ResultImpl(String errorKey, IntList integers, int color) { this.successful = false; this.applicable = true; @@ -144,12 +158,17 @@ public interface AutoTransferHandler { public boolean isSuccessful() { return successful; } - + @Override public boolean isApplicable() { return applicable; } - + + @Override + public boolean isReturningToScreen() { + return returningToScreen; + } + @Override public String getErrorKey() { return errorKey; |
