Package net.minecraftforge.client.model
Class CompositeModel.CompositeModelData
- java.lang.Object
-
- net.minecraftforge.client.model.data.ModelDataMap
-
- net.minecraftforge.client.model.CompositeModel.CompositeModelData
-
- All Implemented Interfaces:
IModelData
- Enclosing class:
- CompositeModel
public static class CompositeModel.CompositeModelData extends ModelDataMap
A model data container which stores data for child components.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.minecraftforge.client.model.data.ModelDataMap
ModelDataMap.Builder
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,IModelData>
parts
static ModelProperty<CompositeModel.CompositeModelData>
SUBMODEL_DATA
-
Constructor Summary
Constructors Constructor Description CompositeModelData()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.util.Optional<CompositeModel.CompositeModelData>
get(IModelData modelData)
Helper to get the CompositeModelData from an unknown IModelData instance.static IModelData
get(IModelData modelData, java.lang.String name)
Helper to get child data from an unknown IModelData instance.<T> T
getData(ModelProperty<T> prop)
IModelData
getSubmodelData(java.lang.String name)
boolean
hasProperty(ModelProperty<?> prop)
Check if this data has a property, even if the value isnull
.void
putSubmodelData(java.lang.String name, IModelData data)
<T> T
setData(ModelProperty<T> prop, T data)
-
-
-
Field Detail
-
SUBMODEL_DATA
public static final ModelProperty<CompositeModel.CompositeModelData> SUBMODEL_DATA
-
parts
private final java.util.Map<java.lang.String,IModelData> parts
-
-
Method Detail
-
get
public static java.util.Optional<CompositeModel.CompositeModelData> get(IModelData modelData)
Helper to get the CompositeModelData from an unknown IModelData instance.- Parameters:
modelData
- The undetermined instance to get data from- Returns:
- An optional representing the composite data, if present.
-
get
public static IModelData get(IModelData modelData, java.lang.String name)
Helper to get child data from an unknown IModelData instance.- Parameters:
modelData
- The undetermined instance to get data fromname
- The name of the child part to get data for.- Returns:
- The data for the child, or empty if not available.
-
getSubmodelData
public IModelData getSubmodelData(java.lang.String name)
-
putSubmodelData
public void putSubmodelData(java.lang.String name, IModelData data)
-
hasProperty
public boolean hasProperty(ModelProperty<?> prop)
Description copied from interface:IModelData
Check if this data has a property, even if the value isnull
. Can be used by code that intends to fill in data for a render pipeline, such as the forge animation system.IMPORTANT:
IModelData.getData(ModelProperty)
can returnnull
even if this method returnstrue
.- Specified by:
hasProperty
in interfaceIModelData
- Overrides:
hasProperty
in classModelDataMap
- Parameters:
prop
- The property to check for inclusion in this model data- Returns:
true
if this data has the given property, even if no value is present
-
getData
@Nullable public <T> T getData(ModelProperty<T> prop)
- Specified by:
getData
in interfaceIModelData
- Overrides:
getData
in classModelDataMap
-
setData
@Nullable public <T> T setData(ModelProperty<T> prop, T data)
- Specified by:
setData
in interfaceIModelData
- Overrides:
setData
in classModelDataMap
-
-