Record Class ObjProp

java.lang.Object
java.lang.Record
net.ixdarklord.coolcatcanvas.api.client.armature.ObjProp
Record Components:
part - only this part of the file (an o, g or usemtl name); null for all of it

public record ObjProp(String point, net.minecraft.resources.Identifier model, net.minecraft.resources.Identifier texture, ArmatureMaterial material, org.joml.Vector3fc offset, org.joml.Vector3fc rotation, float scale, @Nullable String part) extends Record
An .obj model carried by an armature: a sword in a hand, a lantern on a belt, a detailed head on a simple body. It sits on a joint or point and moves with it, and is hidden, tinted and lit up with its joint. Use one for shapes Blockbench's cubes do badly: smooth, high-detail or sculpted parts.

Give them in the armature's .armature.json, for every animator:

"props": [
  { "point": "right_hand", "model": "mymod:models/obj/sword.obj", "texture": "mymod:textures/obj/sword.png",
    "offset": [0, -1, 0], "rotation": [90, 0, 0], "scale": 0.8, "material": "cutout" }
]
or in code, for one animator (Animator.prop(ObjProp)), such as the item an entity holds:
animator.prop(ObjProp.of("right_hand", MyMod.id("models/obj/torch.obj"), MyMod.id("textures/obj/torch.png")).scale(0.5F));
Positions are in pixels from the point and turns in degrees, on the point's own axes (Blockbench's: Y up). The model's units are its file's, one to a block, before scale.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ObjProp(String point, net.minecraft.resources.Identifier model, net.minecraft.resources.Identifier texture, ArmatureMaterial material, org.joml.Vector3fc offset, org.joml.Vector3fc rotation, float scale, @Nullable String part)
    Creates an instance of a ObjProp record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    boolean
    Whether the model file can be read (logged once if not; ObjModels explains).
    Returns the value of the material record component.
     
    net.minecraft.resources.Identifier
    Returns the value of the model record component.
    static ObjProp
    of(String point, net.minecraft.resources.Identifier model, net.minecraft.resources.Identifier texture)
     
    org.joml.Vector3fc
    Returns the value of the offset record component.
    offset(float x, float y, float z)
     
    @Nullable String
    Returns the value of the part record component.
    part(@Nullable String part)
     
    Returns the value of the point record component.
    rotate(float x, float y, float z)
     
    org.joml.Vector3fc
    Returns the value of the rotation record component.
    float
    Returns the value of the scale record component.
    scale(float scale)
     
    net.minecraft.resources.Identifier
    Returns the value of the texture record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ObjProp

      public ObjProp(String point, net.minecraft.resources.Identifier model, net.minecraft.resources.Identifier texture, ArmatureMaterial material, org.joml.Vector3fc offset, org.joml.Vector3fc rotation, float scale, @Nullable @Nullable String part)
      Creates an instance of a ObjProp record class.
      Parameters:
      point - the value for the point record component
      model - the value for the model record component
      texture - the value for the texture record component
      material - the value for the material record component
      offset - the value for the offset record component
      rotation - the value for the rotation record component
      scale - the value for the scale record component
      part - the value for the part record component
  • Method Details

    • of

      public static ObjProp of(String point, net.minecraft.resources.Identifier model, net.minecraft.resources.Identifier texture)
    • offset

      public ObjProp offset(float x, float y, float z)
    • rotate

      public ObjProp rotate(float x, float y, float z)
    • scale

      public ObjProp scale(float scale)
    • material

      public ObjProp material(ArmatureMaterial material)
    • part

      public ObjProp part(@Nullable @Nullable String part)
    • loaded

      public boolean loaded()
      Whether the model file can be read (logged once if not; ObjModels explains).
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • point

      public String point()
      Returns the value of the point record component.
      Returns:
      the value of the point record component
    • model

      public net.minecraft.resources.Identifier model()
      Returns the value of the model record component.
      Returns:
      the value of the model record component
    • texture

      public net.minecraft.resources.Identifier texture()
      Returns the value of the texture record component.
      Returns:
      the value of the texture record component
    • material

      public ArmatureMaterial material()
      Returns the value of the material record component.
      Returns:
      the value of the material record component
    • offset

      public org.joml.Vector3fc offset()
      Returns the value of the offset record component.
      Returns:
      the value of the offset record component
    • rotation

      public org.joml.Vector3fc rotation()
      Returns the value of the rotation record component.
      Returns:
      the value of the rotation record component
    • scale

      public float scale()
      Returns the value of the scale record component.
      Returns:
      the value of the scale record component
    • part

      @Nullable public @Nullable String part()
      Returns the value of the part record component.
      Returns:
      the value of the part record component