SplashRenderer.java

net.minecraft.client.gui.components.SplashRenderer

信息

  • 全限定名:net.minecraft.client.gui.components.SplashRenderer
  • 类型:public class
  • 包:net.minecraft.client.gui.components
  • 源码路径:src/main/java/net/minecraft/client/gui/components/SplashRenderer.java
  • 起始行号:L16
  • 职责:

    TODO

字段/常量

  • CHRISTMAS

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

      TODO

  • NEW_YEAR

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

      TODO

  • HALLOWEEN

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

      TODO

  • WIDTH_OFFSET

    • 类型: int
    • 修饰符: private static final
    • 源码定位: L20
    • 说明:

      TODO

  • HEIGH_OFFSET

    • 类型: int
    • 修饰符: private static final
    • 源码定位: L21
    • 说明:

      TODO

  • TEXT_ANGLE

    • 类型: float
    • 修饰符: private static final
    • 源码定位: L22
    • 说明:

      TODO

  • splash

    • 类型: Component
    • 修饰符: private final
    • 源码定位: L23
    • 说明:

      TODO

内部类/嵌套类型

构造器

public SplashRenderer(Component splash) @ L25

  • 构造器名:SplashRenderer
  • 源码定位:L25
  • 修饰符:public

参数:

  • splash: Component

说明:

TODO

方法

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

public void extractRenderState(GuiGraphicsExtractor graphics, int screenWidth, Font font, float alpha) @ L29

  • 方法名:extractRenderState
  • 源码定位:L29
  • 返回类型:void
  • 修饰符:public

参数:

  • graphics: GuiGraphicsExtractor
  • screenWidth: int
  • font: Font
  • alpha: float

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class SplashRenderer {
    public static final SplashRenderer CHRISTMAS = new SplashRenderer(SplashManager.CHRISTMAS);
    public static final SplashRenderer NEW_YEAR = new SplashRenderer(SplashManager.NEW_YEAR);
    public static final SplashRenderer HALLOWEEN = new SplashRenderer(SplashManager.HALLOWEEN);
    private static final int WIDTH_OFFSET = 123;
    private static final int HEIGH_OFFSET = 69;
    private static final float TEXT_ANGLE = (float) (-Math.PI / 9);
    private final Component splash;
 
    public SplashRenderer(Component splash) {
        this.splash = splash;
    }
 
    public void extractRenderState(GuiGraphicsExtractor graphics, int screenWidth, Font font, float alpha) {
        int textWidth = font.width(this.splash);
        ActiveTextCollector textRenderer = graphics.textRenderer();
        float textPhase = 1.8F - Mth.abs(Mth.sin((float)(Util.getMillis() % 1000L) / 1000.0F * (float) (Math.PI * 2)) * 0.1F);
        float textScale = textPhase * 100.0F / (textWidth + 32);
        Matrix3x2f transform = new Matrix3x2f(textRenderer.defaultParameters().pose())
            .translate(screenWidth / 2.0F + 123.0F, 69.0F)
            .rotate((float) (-Math.PI / 9))
            .scale(textScale);
        ActiveTextCollector.Parameters renderParameters = textRenderer.defaultParameters().withOpacity(alpha).withPose(transform);
        textRenderer.accept(TextAlignment.LEFT, -textWidth / 2, -8, renderParameters, this.splash);
    }
}

引用的其他类

  • Font

    • 引用位置: 参数
  • GuiGraphicsExtractor

    • 引用位置: 参数
  • Component

    • 引用位置: 参数/字段
  • Mth

    • 引用位置: 方法调用
    • 关联成员: Mth.abs(), Mth.sin()
  • Util

    • 引用位置: 方法调用
    • 关联成员: Util.getMillis()