Record Class CameraFocus

java.lang.Object
java.lang.Record
net.ixdarklord.coolcatcanvas.api.cutscene.CameraFocus
Record Components:
start - when it begins, in ticks from the cutscene's start
end - when it ends
blend - over how many ticks the camera turns towards the target at the start, and back to its path at the end
point - the point looked at, in the cutscene's own space
entity - the entity looked at, by its UUID; with neither a point nor an entity, it is the player

public record CameraFocus(float start, float end, float blend, Optional<net.minecraft.world.phys.Vec3> point, Optional<UUID> entity) extends Record
A stretch of a cutscene in which the camera keeps looking at something, whatever its keyframes' angles say: a point, an entity, or the player watching. The camera still follows its path; only where it looks changes, so an orbit stays on its subject and a fly-by tracks what it passes.
CameraFocus.onPoint(0, 200, altar)                 // the whole shot looks at the altar
CameraFocus.onEntity(40, 120, dragon).blend(15)    // turns to the dragon over 15 ticks, and away again after
CameraFocus.onPlayer(0, 60)
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.Codec<CameraFocus>
     
    static final float
    An end for a focus that lasts as long as the cutscene does.
  • Constructor Summary

    Constructors
    Constructor
    Description
    CameraFocus(float start, float end, float blend, Optional<net.minecraft.world.phys.Vec3> point, Optional<UUID> entity)
    Creates an instance of a CameraFocus record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    Returns the value of the blend record component.
    blend(float ticks)
     
    float
    end()
    Returns the value of the end record component.
    Returns the value of the entity record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    onEntity(float start, float end, UUID entity)
     
    onEntity(float start, float end, net.minecraft.world.entity.Entity entity)
     
    onPlayer(float start, float end)
    Looks at the player watching the cutscene.
    onPoint(float start, float end, net.minecraft.world.phys.Vec3 point)
     
    Optional<net.minecraft.world.phys.Vec3>
    Returns the value of the point record component.
    float
    Returns the value of the start record component.
    final String
    Returns a string representation of this record class.
    float
    weight(float time)
    How strongly the camera is held on the target at a time: 0 outside the stretch, 1 once fully turned.

    Methods inherited from class Object

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

    • UNTIL_END

      public static final float UNTIL_END
      An end for a focus that lasts as long as the cutscene does.
      See Also:
    • CODEC

      public static final com.mojang.serialization.Codec<CameraFocus> CODEC
  • Constructor Details

    • CameraFocus

      public CameraFocus(float start, float end, float blend, Optional<net.minecraft.world.phys.Vec3> point, Optional<UUID> entity)
      Creates an instance of a CameraFocus record class.
      Parameters:
      start - the value for the start record component
      end - the value for the end record component
      blend - the value for the blend record component
      point - the value for the point record component
      entity - the value for the entity record component
  • Method Details

    • onPoint

      public static CameraFocus onPoint(float start, float end, net.minecraft.world.phys.Vec3 point)
    • onEntity

      public static CameraFocus onEntity(float start, float end, net.minecraft.world.entity.Entity entity)
    • onEntity

      public static CameraFocus onEntity(float start, float end, UUID entity)
    • onPlayer

      public static CameraFocus onPlayer(float start, float end)
      Looks at the player watching the cutscene.
    • blend

      public CameraFocus blend(float ticks)
    • weight

      public float weight(float time)
      How strongly the camera is held on the target at a time: 0 outside the stretch, 1 once fully turned.
    • 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.
    • start

      public float start()
      Returns the value of the start record component.
      Returns:
      the value of the start record component
    • end

      public float end()
      Returns the value of the end record component.
      Returns:
      the value of the end record component
    • blend

      public float blend()
      Returns the value of the blend record component.
      Returns:
      the value of the blend record component
    • point

      public Optional<net.minecraft.world.phys.Vec3> point()
      Returns the value of the point record component.
      Returns:
      the value of the point record component
    • entity

      public Optional<UUID> entity()
      Returns the value of the entity record component.
      Returns:
      the value of the entity record component