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.
  • Field Details

  • Constructor Details

    • CompositeModelData

      public CompositeModelData()
  • Method Details

    • get

      public static 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, String name)
      Helper to get child data from an unknown IModelData instance.
      Parameters:
      modelData - The undetermined instance to get data from
      name - 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(String name)
    • putSubmodelData

      public void putSubmodelData(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 is null. 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 return null even if this method returns true.

      Specified by:
      hasProperty in interface IModelData
      Overrides:
      hasProperty in class ModelDataMap
      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 interface IModelData
      Overrides:
      getData in class ModelDataMap
    • setData

      @Nullable public <T> T setData(ModelProperty<T> prop, T data)
      Specified by:
      setData in interface IModelData
      Overrides:
      setData in class ModelDataMap