-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
…cing Processing pattern balancing
- Loading branch information
Showing
76 changed files
with
1,510 additions
and
981 deletions.
There are no files selected for viewing
23 changes: 9 additions & 14 deletions
23
...tocrafting-api/src/main/java/com/refinedmods/refinedstorage/api/autocrafting/Pattern.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 |
---|---|---|
@@ -1,26 +1,21 @@ | ||
package com.refinedmods.refinedstorage.api.autocrafting; | ||
|
||
import com.refinedmods.refinedstorage.api.core.CoreValidations; | ||
import com.refinedmods.refinedstorage.api.resource.ResourceAmount; | ||
|
||
import java.util.List; | ||
import java.util.UUID; | ||
|
||
import org.apiguardian.api.API; | ||
|
||
/** | ||
* Represents a unique pattern, with an ID. | ||
* | ||
* @param id the id | ||
* @param layout the (non-unique) layout | ||
*/ | ||
@API(status = API.Status.STABLE, since = "2.0.0-milestone.4.6") | ||
public record Pattern(UUID id, List<Ingredient> ingredients, List<ResourceAmount> outputs, PatternType type) { | ||
public Pattern(final UUID id, | ||
final List<Ingredient> ingredients, | ||
final List<ResourceAmount> outputs, | ||
final PatternType type) { | ||
public record Pattern(UUID id, PatternLayout layout) { | ||
public Pattern { | ||
CoreValidations.validateNotNull(id, "ID cannot be null"); | ||
CoreValidations.validateNotEmpty(ingredients, "Ingredients cannot be empty"); | ||
CoreValidations.validateNotEmpty(outputs, "Outputs cannot be empty"); | ||
CoreValidations.validateNotNull(type, "Type cannot be null"); | ||
this.id = id; | ||
this.ingredients = List.copyOf(ingredients); | ||
this.outputs = List.copyOf(outputs); | ||
this.type = type; | ||
CoreValidations.validateNotNull(layout, "Layout cannot be null"); | ||
} | ||
} |
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
29 changes: 29 additions & 0 deletions
29
...ting-api/src/main/java/com/refinedmods/refinedstorage/api/autocrafting/PatternLayout.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,29 @@ | ||
package com.refinedmods.refinedstorage.api.autocrafting; | ||
|
||
import com.refinedmods.refinedstorage.api.core.CoreValidations; | ||
import com.refinedmods.refinedstorage.api.resource.ResourceAmount; | ||
|
||
import java.util.List; | ||
|
||
import org.apiguardian.api.API; | ||
|
||
/** | ||
* Represents a pattern layout. Multiple {@link Pattern}s can share the same layout. | ||
* | ||
* @param ingredients the ingredients | ||
* @param outputs the outputs | ||
* @param type the type | ||
*/ | ||
@API(status = API.Status.STABLE, since = "2.0.0-milestone.4.12") | ||
public record PatternLayout(List<Ingredient> ingredients, List<ResourceAmount> outputs, PatternType type) { | ||
public PatternLayout(final List<Ingredient> ingredients, | ||
final List<ResourceAmount> outputs, | ||
final PatternType type) { | ||
CoreValidations.validateNotEmpty(ingredients, "Ingredients cannot be empty"); | ||
CoreValidations.validateNotEmpty(outputs, "Outputs cannot be empty"); | ||
CoreValidations.validateNotNull(type, "Type cannot be null"); | ||
this.ingredients = List.copyOf(ingredients); | ||
this.outputs = List.copyOf(outputs); | ||
this.type = 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
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
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
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
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
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
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
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
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
25 changes: 0 additions & 25 deletions
25
...n/java/com/refinedmods/refinedstorage/api/autocrafting/task/ExternalPatternInputSink.java
This file was deleted.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
...c/main/java/com/refinedmods/refinedstorage/api/autocrafting/task/ExternalPatternSink.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,44 @@ | ||
package com.refinedmods.refinedstorage.api.autocrafting.task; | ||
|
||
import com.refinedmods.refinedstorage.api.autocrafting.Pattern; | ||
import com.refinedmods.refinedstorage.api.core.Action; | ||
import com.refinedmods.refinedstorage.api.resource.ResourceAmount; | ||
|
||
import java.util.Collection; | ||
import javax.annotation.Nullable; | ||
|
||
import org.apiguardian.api.API; | ||
|
||
/** | ||
* Gives the ability to a {@link Task} to dump inputs of an external {@link Pattern} into the external target. | ||
*/ | ||
@API(status = API.Status.STABLE, since = "2.0.0-milestone.4.12") | ||
public interface ExternalPatternSink { | ||
/** | ||
* Accepts the given resources into the external target. | ||
* All resources MUST be able to be inserted for this method to return {@link Result#ACCEPTED}, | ||
* otherwise, it must return {@link Result#REJECTED}. | ||
* If the sink is locked, it must return {@link Result#LOCKED}. | ||
* If the resources are not applicable for this sink, it must return {@link Result#SKIPPED}. | ||
* | ||
* @param resources the resources | ||
* @param action the action | ||
* @return the result | ||
*/ | ||
Result accept(Collection<ResourceAmount> resources, Action action); | ||
|
||
/** | ||
* @return the key for this sink | ||
*/ | ||
@Nullable | ||
default ExternalPatternSinkKey getKey() { | ||
return null; | ||
} | ||
|
||
enum Result { | ||
ACCEPTED, | ||
REJECTED, | ||
SKIPPED, | ||
LOCKED | ||
} | ||
} |
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
21 changes: 21 additions & 0 deletions
21
...ava/com/refinedmods/refinedstorage/api/autocrafting/task/ExternalPatternSinkProvider.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,21 @@ | ||
package com.refinedmods.refinedstorage.api.autocrafting.task; | ||
|
||
import com.refinedmods.refinedstorage.api.autocrafting.PatternLayout; | ||
|
||
import java.util.List; | ||
|
||
import org.apiguardian.api.API; | ||
|
||
/** | ||
* Provides access to the {@link ExternalPatternSink} for a {@link PatternLayout}. | ||
* Used in autocrafting tasks. | ||
*/ | ||
@API(status = API.Status.STABLE, since = "2.0.0-milestone.4.12") | ||
@FunctionalInterface | ||
public interface ExternalPatternSinkProvider { | ||
/** | ||
* @param patternLayout the pattern layout | ||
* @return a list of sinks for a pattern | ||
*/ | ||
List<ExternalPatternSink> getSinksByPatternLayout(PatternLayout patternLayout); | ||
} |
Oops, something went wrong.