LogoRenderer.java

net.minecraft.client.gui.components.LogoRenderer

信息

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

    TODO

字段/常量

  • MINECRAFT_LOGO

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

      TODO

  • EASTER_EGG_LOGO

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

      TODO

  • MINECRAFT_EDITION

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

      TODO

  • LOGO_WIDTH

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

      TODO

  • LOGO_HEIGHT

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

      TODO

  • LOGO_TEXTURE_WIDTH

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

      TODO

  • LOGO_TEXTURE_HEIGHT

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

      TODO

  • EDITION_WIDTH

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

      TODO

  • EDITION_HEIGHT

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

      TODO

  • EDITION_TEXTURE_WIDTH

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

      TODO

  • EDITION_TEXTURE_HEIGHT

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

      TODO

  • DEFAULT_HEIGHT_OFFSET

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

      TODO

  • EDITION_LOGO_OVERLAP

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

      TODO

  • showEasterEgg

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

      TODO

  • keepLogoThroughFade

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

      TODO

内部类/嵌套类型

构造器

public LogoRenderer(boolean keepLogoThroughFade) @ L29

  • 构造器名:LogoRenderer
  • 源码定位:L29
  • 修饰符:public

参数:

  • keepLogoThroughFade: boolean

说明:

TODO

方法

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

public void extractRenderState(GuiGraphicsExtractor graphics, int width, float alpha) @ L33

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

参数:

  • graphics: GuiGraphicsExtractor
  • width: int
  • alpha: float

说明:

TODO

public void extractRenderState(GuiGraphicsExtractor graphics, int width, float alpha, int heightOffset) @ L37

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

参数:

  • graphics: GuiGraphicsExtractor
  • width: int
  • alpha: float
  • heightOffset: int

说明:

TODO

public boolean keepLogoThroughFade() @ L49

  • 方法名:keepLogoThroughFade
  • 源码定位:L49
  • 返回类型:boolean
  • 修饰符:public

参数:

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class LogoRenderer {
    public static final Identifier MINECRAFT_LOGO = Identifier.withDefaultNamespace("textures/gui/title/minecraft.png");
    public static final Identifier EASTER_EGG_LOGO = Identifier.withDefaultNamespace("textures/gui/title/minceraft.png");
    public static final Identifier MINECRAFT_EDITION = Identifier.withDefaultNamespace("textures/gui/title/edition.png");
    public static final int LOGO_WIDTH = 256;
    public static final int LOGO_HEIGHT = 44;
    private static final int LOGO_TEXTURE_WIDTH = 256;
    private static final int LOGO_TEXTURE_HEIGHT = 64;
    private static final int EDITION_WIDTH = 128;
    private static final int EDITION_HEIGHT = 14;
    private static final int EDITION_TEXTURE_WIDTH = 128;
    private static final int EDITION_TEXTURE_HEIGHT = 16;
    public static final int DEFAULT_HEIGHT_OFFSET = 30;
    private static final int EDITION_LOGO_OVERLAP = 7;
    private final boolean showEasterEgg = RandomSource.createThreadLocalInstance().nextFloat() < 1.0E-4;
    private final boolean keepLogoThroughFade;
 
    public LogoRenderer(boolean keepLogoThroughFade) {
        this.keepLogoThroughFade = keepLogoThroughFade;
    }
 
    public void extractRenderState(GuiGraphicsExtractor graphics, int width, float alpha) {
        this.extractRenderState(graphics, width, alpha, 30);
    }
 
    public void extractRenderState(GuiGraphicsExtractor graphics, int width, float alpha, int heightOffset) {
        int logoX = width / 2 - 128;
        float effectiveAlpha = this.keepLogoThroughFade ? 1.0F : alpha;
        int color = ARGB.white(effectiveAlpha);
        graphics.blit(
            RenderPipelines.GUI_TEXTURED, this.showEasterEgg ? EASTER_EGG_LOGO : MINECRAFT_LOGO, logoX, heightOffset, 0.0F, 0.0F, 256, 44, 256, 64, color
        );
        int editionX = width / 2 - 64;
        int y = heightOffset + 44 - 7;
        graphics.blit(RenderPipelines.GUI_TEXTURED, MINECRAFT_EDITION, editionX, y, 0.0F, 0.0F, 128, 14, 128, 16, color);
    }
 
    public boolean keepLogoThroughFade() {
        return this.keepLogoThroughFade;
    }
}

引用的其他类

  • GuiGraphicsExtractor

    • 引用位置: 参数
  • Identifier

    • 引用位置: 字段/方法调用
    • 关联成员: Identifier.withDefaultNamespace()
  • ARGB

    • 引用位置: 方法调用
    • 关联成员: ARGB.white()
  • RandomSource

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