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
ConstructorsConstructorDescriptionBookTextRenderer(Function<Boolean, net.minecraft.network.chat.FormattedText> textSupplier, float textStackScaleSize, net.minecraft.world.phys.Vec3 offset) Creates an instance of aBookTextRendererrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.net.minecraft.world.phys.Vec3getStartOffset(ClientBookData data, boolean leftPage, PosRot bookPosRot) Called to get the offset on the page to start rendering from.final inthashCode()Returns a hash code value for this object.net.minecraft.world.phys.Vec3offset()Returns the value of theoffsetrecord component.voidrender(com.mojang.blaze3d.vertex.PoseStack stack, ClientBookData data, boolean leftPage, int light, PosRot bookPosRot) Called to render this.floatReturns the value of thetextStackScaleSizerecord component.Returns the value of thetextSupplierrecord component.final StringtoString()Returns a string representation of this record class.
-
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 aBookTextRendererrecord class.- Parameters:
textSupplier- the value for thetextSupplierrecord componenttextStackScaleSize- the value for thetextStackScaleSizerecord componentoffset- the value for theoffsetrecord 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:BookRenderableCalled to render this.- Specified by:
renderin interfaceBookRenderable- 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:BookRenderableCalled 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:
getStartOffsetin interfaceBookRenderable- 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
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
textSupplier
Returns the value of thetextSupplierrecord component.- Returns:
- the value of the
textSupplierrecord component
-
textStackScaleSize
public float textStackScaleSize()Returns the value of thetextStackScaleSizerecord component.- Returns:
- the value of the
textStackScaleSizerecord component
-
offset
public net.minecraft.world.phys.Vec3 offset()Returns the value of theoffsetrecord component.- Returns:
- the value of the
offsetrecord component
-