Refactor Multiblock Predicates to add XOR/AND predicate logic - #5131
Draft
ghzdude wants to merge 101 commits into
Draft
Refactor Multiblock Predicates to add XOR/AND predicate logic#5131ghzdude wants to merge 101 commits into
ghzdude wants to merge 101 commits into
Conversation
mass deletion fix last few references make MultiPredicate respect type improve MultiPredicate debug name implement MultiPredicate rename testing methods add helper methods to PatternState clean up PredicateContext implement rework improve rework merger predicate errors together start work on rework add useful methods to BlockInfo
merge debug names from BasePredicate for or/and
add contents method for between curly braces use better constructor for MultiPredicate
fix rebase spotless
make Custom class
replace custom with anonymous class move methods around improve MultiPredicate constructors allow MultiPredicates with a single predicate to function pre-calculate hasAir
use stream instead of stream supplier comment out tooltips
spotless
make logic nonnull make has air final
simplified indexed candidate list use logic to simplify combining add method to get inner predicate add simplify method add test global/slice min to BasePredicate fix wrong method in xor MultiPredicate no longer works with a single predicate simplified predicate cannot be simplified further
remove simplification methods improve logic run method comment out tooltip call
make isController mutable
Contributor
|
this is similar to the issue i opened for laser hatches |
try out new error string for XorLogic
rework how max count checks are performed (again) make predicate context in PatternState final add reset method to PredicateContext add boolean field for check flip simplify map comparator
utilize predicate builder in Predicates.java and other classes add predicate getter in BasePredicate new MultiPredicate constructor prefer using appendError() over error() fix slice errors a bit
keep errors from previous check for flipped check
simplify retaining errors make logic type a constructor field instead of method override improve MultiPredicate constructors fix typo
remove redundant predicate getter simplify XorLogic slice/global min methods update ExpandablePattern to match BlockPattern improve MultiPredicate errors
remove global/layer count getters replace layer "null" checks with boolean replace slice record with int
merge failure checks
delete logics and compacted predicate store MultiPredicate children directly in a list make MultiPredicate abstract to replace logics with subclasses make BasePredicate implement comparable spotless for good measure
replace anon class with TestablePredicate
dont iterate children in max count check improve XorPredicate's passed predicate
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Refactors Multiblock predicates for two new logic types:
The data hatch predicate for the Assembly Line Multiblock now uses XOR logic, meaning you can have either a data access hatch or an optical data reception hatch, but not both at the same time. The min global count of this predicate has also been set to zero, to allow you to have no data hatches.
Implementation Details
The testing functions in
PatternPredicateandBasePredicatereturns a boolean for pass/failerrors are added to a new class,
PredicateContextPatternStatehas aPredicateContextfield, and the context also has a reference back to the stateCurrently, the custom predicate tooltips through
PatternPredicate#addTooltips()are commented out, as they ultimately appeared to be unused.PatternPredicateis renamed toMultiPredicateMultiPredicateis an abstract class, with the various logic implementations extending itgetPredicateName()->getTypeName()predicates and blockInfo have
toString()implemented, making them easier to understand while debuggingmany of
BasePredicate's fields now have lombok getters/settersBasePredicates are constructed through the newPredicateBuilder, and the concrete implementation is throughTestablePredicatenew helper methods for constructing
PatternStringErrors andSinglePredicateErrorsAI Usage
Outcome
The data access hatch and optical data reception hatch are now mutually exclusive in the assembly line multiblock
furthur implementations are also possible
How Was This Tested
Tested in-game on the all multiblocks world
Additional Information