BrewingStandScreen.java

net.minecraft.client.gui.screens.inventory.BrewingStandScreen

信息

  • 全限定名:net.minecraft.client.gui.screens.inventory.BrewingStandScreen
  • 类型:public class
  • 包:net.minecraft.client.gui.screens.inventory
  • 源码路径:src/main/java/net/minecraft/client/gui/screens/inventory/BrewingStandScreen.java
  • 起始行号:L14
  • 继承:AbstractContainerScreen
  • 职责:

    TODO

字段/常量

  • FUEL_LENGTH_SPRITE

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

      TODO

  • BREW_PROGRESS_SPRITE

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

      TODO

  • BUBBLES_SPRITE

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

      TODO

  • BREWING_STAND_LOCATION

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

      TODO

  • BUBBLELENGTHS

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

      TODO

内部类/嵌套类型

构造器

public BrewingStandScreen(BrewingStandMenu menu, Inventory inventory, Component title) @ L21

  • 构造器名:BrewingStandScreen
  • 源码定位:L21
  • 修饰符:public

参数:

  • menu: BrewingStandMenu
  • inventory: Inventory
  • title: Component

说明:

TODO

方法

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

protected void init() @ L25

  • 方法名:init
  • 源码定位:L25
  • 返回类型:void
  • 修饰符:protected

参数:

说明:

TODO

public void extractBackground(GuiGraphicsExtractor graphics, int mouseX, int mouseY, float a) @ L31

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

参数:

  • graphics: GuiGraphicsExtractor
  • mouseX: int
  • mouseY: int
  • a: float

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class BrewingStandScreen extends AbstractContainerScreen<BrewingStandMenu> {
    private static final Identifier FUEL_LENGTH_SPRITE = Identifier.withDefaultNamespace("container/brewing_stand/fuel_length");
    private static final Identifier BREW_PROGRESS_SPRITE = Identifier.withDefaultNamespace("container/brewing_stand/brew_progress");
    private static final Identifier BUBBLES_SPRITE = Identifier.withDefaultNamespace("container/brewing_stand/bubbles");
    private static final Identifier BREWING_STAND_LOCATION = Identifier.withDefaultNamespace("textures/gui/container/brewing_stand.png");
    private static final int[] BUBBLELENGTHS = new int[]{29, 24, 20, 16, 11, 6, 0};
 
    public BrewingStandScreen(BrewingStandMenu menu, Inventory inventory, Component title) {
        super(menu, inventory, title);
    }
 
    @Override
    protected void init() {
        super.init();
        this.titleLabelX = (this.imageWidth - this.font.width(this.title)) / 2;
    }
 
    @Override
    public void extractBackground(GuiGraphicsExtractor graphics, int mouseX, int mouseY, float a) {
        super.extractBackground(graphics, mouseX, mouseY, a);
        int xo = (this.width - this.imageWidth) / 2;
        int yo = (this.height - this.imageHeight) / 2;
        graphics.blit(RenderPipelines.GUI_TEXTURED, BREWING_STAND_LOCATION, xo, yo, 0.0F, 0.0F, this.imageWidth, this.imageHeight, 256, 256);
        int fuel = this.menu.getFuel();
        int fuelLength = Mth.clamp((18 * fuel + 20 - 1) / 20, 0, 18);
        if (fuelLength > 0) {
            graphics.blitSprite(RenderPipelines.GUI_TEXTURED, FUEL_LENGTH_SPRITE, 18, 4, 0, 0, xo + 60, yo + 44, fuelLength, 4);
        }
 
        int tickCount = this.menu.getBrewingTicks();
        if (tickCount > 0) {
            int length = (int)(28.0F * (1.0F - tickCount / 400.0F));
            if (length > 0) {
                graphics.blitSprite(RenderPipelines.GUI_TEXTURED, BREW_PROGRESS_SPRITE, 9, 28, 0, 0, xo + 97, yo + 16, 9, length);
            }
 
            length = BUBBLELENGTHS[tickCount / 2 % 7];
            if (length > 0) {
                graphics.blitSprite(RenderPipelines.GUI_TEXTURED, BUBBLES_SPRITE, 12, 29, 0, 29 - length, xo + 63, yo + 14 + 29 - length, 12, length);
            }
        }
    }
}

引用的其他类