GuiTextRenderState.java

net.minecraft.client.renderer.state.gui.GuiTextRenderState

信息

  • 全限定名:net.minecraft.client.renderer.state.gui.GuiTextRenderState
  • 类型:public final class
  • 包:net.minecraft.client.renderer.state.gui
  • 源码路径:src/main/java/net/minecraft/client/renderer/state/gui/GuiTextRenderState.java
  • 起始行号:L12
  • 实现:ScreenArea
  • 职责:

    TODO

字段/常量

  • font

    • 类型: Font
    • 修饰符: public final
    • 源码定位: L13
    • 说明:

      TODO

  • text

    • 类型: FormattedCharSequence
    • 修饰符: public final
    • 源码定位: L14
    • 说明:

      TODO

  • pose

    • 类型: Matrix3x2fc
    • 修饰符: public final
    • 源码定位: L15
    • 说明:

      TODO

  • x

    • 类型: int
    • 修饰符: public final
    • 源码定位: L16
    • 说明:

      TODO

  • y

    • 类型: int
    • 修饰符: public final
    • 源码定位: L17
    • 说明:

      TODO

  • color

    • 类型: int
    • 修饰符: public final
    • 源码定位: L18
    • 说明:

      TODO

  • backgroundColor

    • 类型: int
    • 修饰符: public final
    • 源码定位: L19
    • 说明:

      TODO

  • dropShadow

    • 类型: boolean
    • 修饰符: public final
    • 源码定位: L20
    • 说明:

      TODO

  • includeEmpty

    • 类型: boolean
    • 修饰符: final
    • 源码定位: L21
    • 说明:

      TODO

  • scissor

    • 类型: ScreenRectangle
    • 修饰符: public final
    • 源码定位: L22
    • 说明:

      TODO

  • preparedText

    • 类型: Font.PreparedText
    • 修饰符: private
    • 源码定位: L23
    • 说明:

      TODO

  • bounds

    • 类型: ScreenRectangle
    • 修饰符: private
    • 源码定位: L24
    • 说明:

      TODO

内部类/嵌套类型

构造器

public GuiTextRenderState(Font font, FormattedCharSequence text, Matrix3x2fc pose, int x, int y, int color, int backgroundColor, boolean dropShadow, boolean includeEmpty, ScreenRectangle scissor) @ L26

  • 构造器名:GuiTextRenderState
  • 源码定位:L26
  • 修饰符:public

参数:

  • font: Font
  • text: FormattedCharSequence
  • pose: Matrix3x2fc
  • x: int
  • y: int
  • color: int
  • backgroundColor: int
  • dropShadow: boolean
  • includeEmpty: boolean
  • scissor: ScreenRectangle

说明:

TODO

方法

下面的方法块按源码顺序生成。

public Font.PreparedText ensurePrepared() @ L50

  • 方法名:ensurePrepared
  • 源码定位:L50
  • 返回类型:Font.PreparedText
  • 修饰符:public

参数:

说明:

TODO

public ScreenRectangle bounds() @ L63

  • 方法名:bounds
  • 源码定位:L63
  • 返回类型:ScreenRectangle
  • 修饰符:public

参数:

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public final class GuiTextRenderState implements ScreenArea {
    public final Font font;
    public final FormattedCharSequence text;
    public final Matrix3x2fc pose;
    public final int x;
    public final int y;
    public final int color;
    public final int backgroundColor;
    public final boolean dropShadow;
    final boolean includeEmpty;
    public final @Nullable ScreenRectangle scissor;
    private Font.@Nullable PreparedText preparedText;
    private @Nullable ScreenRectangle bounds;
 
    public GuiTextRenderState(
        Font font,
        FormattedCharSequence text,
        Matrix3x2fc pose,
        int x,
        int y,
        int color,
        int backgroundColor,
        boolean dropShadow,
        boolean includeEmpty,
        @Nullable ScreenRectangle scissor
    ) {
        this.font = font;
        this.text = text;
        this.pose = pose;
        this.x = x;
        this.y = y;
        this.color = color;
        this.backgroundColor = backgroundColor;
        this.dropShadow = dropShadow;
        this.includeEmpty = includeEmpty;
        this.scissor = scissor;
    }
 
    public Font.PreparedText ensurePrepared() {
        if (this.preparedText == null) {
            this.preparedText = this.font.prepareText(this.text, this.x, this.y, this.color, this.dropShadow, this.includeEmpty, this.backgroundColor);
            ScreenRectangle bounds = this.preparedText.bounds();
            if (bounds != null) {
                bounds = bounds.transformMaxBounds(this.pose);
                this.bounds = this.scissor != null ? this.scissor.intersection(bounds) : bounds;
            }
        }
 
        return this.preparedText;
    }
 
    @Override
    public @Nullable ScreenRectangle bounds() {
        this.ensurePrepared();
        return this.bounds;
    }
}

引用的其他类