Record Class WrittenBookHelpers.BookTextRenderer

java.lang.Object
java.lang.Record
com.hammy275.immersivemc.client.immersive.book.WrittenBookHelpers.BookTextRenderer
All Implemented Interfaces:
BookRenderable
Enclosing class:
WrittenBookHelpers

public static record WrittenBookHelpers.BookTextRenderer(Function<Boolean,net.minecraft.network.chat.FormattedText> textSupplier, float textStackScaleSize, net.minecraft.world.phys.Vec3 offset) extends Record implements BookRenderable
  • Constructor Summary

    Constructors
    Constructor
    Description
    BookTextRenderer(Function<Boolean,net.minecraft.network.chat.FormattedText> textSupplier, float textStackScaleSize, net.minecraft.world.phys.Vec3 offset)
    Creates an instance of a BookTextRenderer record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    net.minecraft.world.phys.Vec3
    getStartOffset(ClientBookData data, boolean leftPage, PosRot bookPosRot)
    Called to get the offset on the page to start rendering from.
    final int
    Returns a hash code value for this object.
    net.minecraft.world.phys.Vec3
    Returns the value of the offset record component.
    void
    render(com.mojang.blaze3d.vertex.PoseStack stack, ClientBookData data, boolean leftPage, int light, PosRot bookPosRot)
    Called to render this.
    float
    Returns the value of the textStackScaleSize record component.
    Function<Boolean,net.minecraft.network.chat.FormattedText>
    Returns the value of the textSupplier record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

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

    • BookTextRenderer

      public BookTextRenderer(Function<Boolean,net.minecraft.network.chat.FormattedText> textSupplier, float textStackScaleSize, net.minecraft.world.phys.Vec3 offset)
      Creates an instance of a BookTextRenderer record class.
      Parameters:
      textSupplier - the value for the textSupplier record component
      textStackScaleSize - the value for the textStackScaleSize record component
      offset - the value for the offset record component
  • Method Details

    • render

      public void render(com.mojang.blaze3d.vertex.PoseStack stack, ClientBookData data, boolean leftPage, int light, PosRot bookPosRot)
      Description copied from interface: BookRenderable
      Called to render this.
      Specified by:
      render in interface BookRenderable
      Parameters:
      stack - The PoseStack to use with rendering. This is already centered on the page and rotated appropriately.
      data - The book data being rendered.
      leftPage - Whether this is rendering on the left page or the right.
      light - Light value.
      bookPosRot - The book's position and rotation.
    • getStartOffset

      public net.minecraft.world.phys.Vec3 getStartOffset(ClientBookData data, boolean leftPage, PosRot bookPosRot)
      Description copied from interface: BookRenderable
      Called to get the offset on the page to start rendering from. +X is towards the book center, +Y is towards the top of the page, and +Z is towards the player's face if they're looking directly at the book.
      The coordinate system is described by example below. The rest should be pretty inferrable.
      • The center of the page is located at (0, 0, 0)
      • (1, 0, 0) is the very center of the book
      • (0, 1, 0) is the top-center of the page
      • (0, 0, 1) is an arbitrary unit closer to the player's face.
      Specified by:
      getStartOffset in interface BookRenderable
      Parameters:
      data - The book data being rendered.
      leftPage - Whether this is rendering on the left page or the right.
      bookPosRot - The book's position and rotation.
      Returns:
      The offset to use as described above.
    • 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 '=='.
      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.
    • textSupplier

      public Function<Boolean,net.minecraft.network.chat.FormattedText> textSupplier()
      Returns the value of the textSupplier record component.
      Returns:
      the value of the textSupplier record component
    • textStackScaleSize

      public float textStackScaleSize()
      Returns the value of the textStackScaleSize record component.
      Returns:
      the value of the textStackScaleSize record component
    • offset

      public net.minecraft.world.phys.Vec3 offset()
      Returns the value of the offset record component.
      Returns:
      the value of the offset record component