Class VariantBlockStateBuilder
java.lang.Object
net.minecraftforge.client.model.generators.VariantBlockStateBuilder
- All Implemented Interfaces:
- IGeneratedBlockState
Builder for variant-type blockstates, i.e. non-multipart blockstates. Should
 not be manually instantiated, instead use
 
BlockStateProvider.getVariantBuilder(Block).
 
 Variants can either be set via
 setModels(PartialBlockstate, ConfiguredModel...) or
 addModels(PartialBlockstate, ConfiguredModel...), where model(s) can
 be assigned directly to partial states, or builder
 style via partialState() and its subsequent methods.
 
 This class also provides the convenience methods
 forAllStates(Function) and
 forAllStatesExcept(Function, Property...) for cases where the model
 for each variant can be decided dynamically based on the state's property
 values.
- See Also:
- 
Nested Class SummaryNested Classes
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprivate final Set<BlockState>private final Map<VariantBlockStateBuilder.PartialBlockstate,BlockStateProvider.ConfiguredModelList> private final Block
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionaddModels(VariantBlockStateBuilder.PartialBlockstate state, ConfiguredModel... models) Assign some models to a givenpartial state.private booleanforAllStates(Function<BlockState, ConfiguredModel[]> mapper) forAllStatesExcept(Function<BlockState, ConfiguredModel[]> mapper, Property<?>... ignored) getOwner()setModels(VariantBlockStateBuilder.PartialBlockstate state, ConfiguredModel... model) Assign some models to a givenpartial state, throwing an exception if the state has already been configured.com.google.gson.JsonObjecttoJson()
- 
Field Details- 
owner
- 
modelsprivate final Map<VariantBlockStateBuilder.PartialBlockstate,BlockStateProvider.ConfiguredModelList> models
- 
coveredStates
 
- 
- 
Constructor Details- 
VariantBlockStateBuilderVariantBlockStateBuilder(Block owner) 
 
- 
- 
Method Details- 
getModelspublic Map<VariantBlockStateBuilder.PartialBlockstate,BlockStateProvider.ConfiguredModelList> getModels()
- 
getOwner
- 
toJsonpublic com.google.gson.JsonObject toJson()- Specified by:
- toJsonin interface- IGeneratedBlockState
 
- 
addModelspublic VariantBlockStateBuilder addModels(VariantBlockStateBuilder.PartialBlockstate state, ConfiguredModel... models) Assign some models to a givenpartial state.- Parameters:
- state- The- partial statefor which to add the models
- models- A set of models to add to this state
- Returns:
- this builder
- Throws:
- NullPointerException- if- stateis- null
- IllegalArgumentException- if- modelsis empty
- IllegalArgumentException- if- state's owning block differs from the builder's
- IllegalArgumentException- if- statepartially matches another state which has already been configured
 
- 
setModelspublic VariantBlockStateBuilder setModels(VariantBlockStateBuilder.PartialBlockstate state, ConfiguredModel... model) Assign some models to a givenpartial state, throwing an exception if the state has already been configured. Otherwise, simply callsaddModels(PartialBlockstate, ConfiguredModel...).- Parameters:
- state- The- partial statefor which to set the models
- model- A set of models to assign to this state
- Returns:
- this builder
- Throws:
- IllegalArgumentException- if- statehas already been configured
- See Also:
 
- 
disjointToAll
- 
partialState
- 
forAllStates
- 
forAllStatesExceptpublic VariantBlockStateBuilder forAllStatesExcept(Function<BlockState, ConfiguredModel[]> mapper, Property<?>... ignored) 
 
-