CraftingScreen.java

net.minecraft.client.gui.screens.inventory.CraftingScreen

信息

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

    TODO

字段/常量

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

      TODO

内部类/嵌套类型

构造器

public CraftingScreen(CraftingMenu menu, Inventory inventory, Component title) @ L18

  • 构造器名:CraftingScreen
  • 源码定位:L18
  • 修饰符:public

参数:

  • menu: CraftingMenu
  • inventory: Inventory
  • title: Component

说明:

TODO

方法

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

protected void init() @ L22

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

参数:

说明:

TODO

protected ScreenPosition getRecipeBookButtonPosition() @ L28

  • 方法名:getRecipeBookButtonPosition
  • 源码定位:L28
  • 返回类型:ScreenPosition
  • 修饰符:protected

参数:

说明:

TODO

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

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

参数:

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

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class CraftingScreen extends AbstractRecipeBookScreen<CraftingMenu> {
    private static final Identifier CRAFTING_TABLE_LOCATION = Identifier.withDefaultNamespace("textures/gui/container/crafting_table.png");
 
    public CraftingScreen(CraftingMenu menu, Inventory inventory, Component title) {
        super(menu, new CraftingRecipeBookComponent(menu), inventory, title);
    }
 
    @Override
    protected void init() {
        super.init();
        this.titleLabelX = 29;
    }
 
    @Override
    protected ScreenPosition getRecipeBookButtonPosition() {
        return new ScreenPosition(this.leftPos + 5, this.height / 2 - 49);
    }
 
    @Override
    public void extractBackground(GuiGraphicsExtractor graphics, int mouseX, int mouseY, float a) {
        super.extractBackground(graphics, mouseX, mouseY, a);
        int xo = this.leftPos;
        int yo = (this.height - this.imageHeight) / 2;
        graphics.blit(RenderPipelines.GUI_TEXTURED, CRAFTING_TABLE_LOCATION, xo, yo, 0.0F, 0.0F, this.imageWidth, this.imageHeight, 256, 256);
    }
}

引用的其他类