Class TransformCopyingModel<S,D>

java.lang.Object
net.minecraft.client.model.Model<com.mojang.datafixers.util.Pair<S,D>>
net.fabricmc.fabric.api.client.rendering.v1.TransformCopyingModel<S,D>
Type Parameters:
S - type of the source model state
D - type of the delegate model state
All Implemented Interfaces:
FabricModel<com.mojang.datafixers.util.Pair<S,D>>, net.fabricmc.fabric.impl.client.rendering.ModelExtensions

public final class TransformCopyingModel<S,D> extends net.minecraft.client.model.Model<com.mojang.datafixers.util.Pair<S,D>> implements net.fabricmc.fabric.impl.client.rendering.ModelExtensions
A model that copies transforms from a source model to a delegate model.

Useful in cases where an overlay model may not be a subclass of its base model.

  • Nested Class Summary

    Nested classes/interfaces inherited from class net.minecraft.client.model.Model

    net.minecraft.client.model.Model.Simple
  • Field Summary

    Fields inherited from class net.minecraft.client.model.Model

    renderType, root
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    copyTransforms(net.minecraft.client.model.Model<?> model)
    Copies transforms of child model parts of the model to child model parts of this model whose names match.
    static <S,D> TransformCopyingModel<S,D>
    create(net.minecraft.client.model.Model<? super S> source, net.minecraft.client.model.Model<? super D> delegate, boolean setDelegateAngles)
     
    void
    fabric$calculateChildParts(net.minecraft.client.model.geom.ModelPart root)
     
    @Nullable net.minecraft.client.model.geom.ModelPart
    Returns a child model part of the given name, or null if one is not found.
    void
    setupAnim(com.mojang.datafixers.util.Pair<S,D> state)
     

    Methods inherited from class net.minecraft.client.model.Model

    allParts, renderToBuffer, renderToBuffer, renderType, renderType, resetPose, root

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • create

      public static <S,D> TransformCopyingModel<S,D> create(net.minecraft.client.model.Model<? super S> source, net.minecraft.client.model.Model<? super D> delegate, boolean setDelegateAngles)
      Parameters:
      source - the model whose transforms will be copied
      delegate - the model that will be rendered with transforms copied from the source model
      setDelegateAngles - true if the Model.setupAnim(Object) method should be called for the delegate model after it is called for the source model
    • setupAnim

      public void setupAnim(com.mojang.datafixers.util.Pair<S,D> state)
      Overrides:
      setupAnim in class net.minecraft.client.model.Model<com.mojang.datafixers.util.Pair<S,D>>
    • fabric$calculateChildParts

      public void fabric$calculateChildParts(net.minecraft.client.model.geom.ModelPart root)
      Specified by:
      fabric$calculateChildParts in interface net.fabricmc.fabric.impl.client.rendering.ModelExtensions
    • getChildPart

      public @Nullable net.minecraft.client.model.geom.ModelPart getChildPart(String name)
      Description copied from interface: FabricModel
      Returns a child model part of the given name, or null if one is not found.
      Specified by:
      getChildPart in interface FabricModel<S>
      Parameters:
      name - the name of the child model part
      Returns:
      the child model part that corresponds to the name parameter, or null if it is not found.
    • copyTransforms

      public void copyTransforms(net.minecraft.client.model.Model<?> model)
      Description copied from interface: FabricModel
      Copies transforms of child model parts of the model to child model parts of this model whose names match.
      Specified by:
      copyTransforms in interface FabricModel<S>
      Parameters:
      model - the model to copy transforms from