ContainerScreen.java

net.minecraft.client.gui.screens.inventory.ContainerScreen

信息

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

    TODO

字段/常量

  • CONTAINER_BACKGROUND

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

      TODO

  • containerRows

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

      TODO

内部类/嵌套类型

构造器

public ContainerScreen(ChestMenu menu, Inventory inventory, Component title) @ L17

  • 构造器名:ContainerScreen
  • 源码定位:L17
  • 修饰符:public

参数:

  • menu: ChestMenu
  • inventory: Inventory
  • title: Component

说明:

TODO

方法

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

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

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

参数:

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

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class ContainerScreen extends AbstractContainerScreen<ChestMenu> {
    private static final Identifier CONTAINER_BACKGROUND = Identifier.withDefaultNamespace("textures/gui/container/generic_54.png");
    private final int containerRows;
 
    public ContainerScreen(ChestMenu menu, Inventory inventory, Component title) {
        super(menu, inventory, title, 176, 114 + menu.getRowCount() * 18);
        this.containerRows = menu.getRowCount();
        this.inventoryLabelY = this.imageHeight - 94;
    }
 
    @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, CONTAINER_BACKGROUND, xo, yo, 0.0F, 0.0F, this.imageWidth, this.containerRows * 18 + 17, 256, 256);
        graphics.blit(RenderPipelines.GUI_TEXTURED, CONTAINER_BACKGROUND, xo, yo + this.containerRows * 18 + 17, 0.0F, 126.0F, this.imageWidth, 96, 256, 256);
    }
}

引用的其他类