Interface RuleBasedStateProvider
- All Superinterfaces:
BlockStateProvider, Wrapper
A provider that provides a block and block state depending
on the block that currently exists in the world using a series of rules.
- Since:
- 3.0.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classA builder forRuleBasedStateProvider.static final recordA rule. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates a new builder.fallback()The block to use when no rules' predicates match.static RuleBasedStateProviderof(@Nullable BlockStateProvider fallback, List<RuleBasedStateProvider.Rule> rules) Creates a new rule-based block state provider.static RuleBasedStateProvider.Rulerule(BlockPredicate ifTrue, BlockStateProvider then) Creates a new builder.rules()Rules of the block to use.default RuleBasedStateProvider.BuilderConverts this object back to a builder.Methods inherited from interface Wrapper
asHandle, toMinecraft, unwrap
-
Method Details
-
fallback
The block to use when no rules' predicates match. If unspecified and no rules' predicates match, then no block is placed.- Returns:
- the fallback block state provider
- Since:
- 3.0.0
-
rules
Rules of the block to use. This can be empty.- Returns:
- the list of rules
- Since:
- 3.0.0
-
toBuilder
Converts this object back to a builder.- Returns:
- a builder with the same values as this object
- Since:
- 3.0.0
-
of
@AsOf("3.0.0") static RuleBasedStateProvider of(@Nullable BlockStateProvider fallback, List<RuleBasedStateProvider.Rule> rules) Creates a new rule-based block state provider.- Parameters:
fallback- the fallback block state provider, or null to have no fallbackrules- the rules of the block state provider- Returns:
- a new rule-based block state provider
- Since:
- 3.0.0
-
builder
Creates a new builder.- Returns:
- a new builder
- Since:
- 3.0.0
-
rule
@AsOf("3.0.0") static RuleBasedStateProvider.Rule rule(BlockPredicate ifTrue, BlockStateProvider then) Creates a new builder.- Parameters:
ifTrue- The block predicate of this rule.then- The block to use when the predicate is passed.- Returns:
- a new rule
-