AbstractMountInventoryScreen.java

net.minecraft.client.gui.screens.inventory.AbstractMountInventoryScreen

信息

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

    TODO

字段/常量

  • inventoryColumns

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

      TODO

  • xMouse

    • 类型: float
    • 修饰符: protected
    • 源码定位: L17
    • 说明:

      TODO

  • yMouse

    • 类型: float
    • 修饰符: protected
    • 源码定位: L18
    • 说明:

      TODO

  • mount

    • 类型: LivingEntity
    • 修饰符: protected final
    • 源码定位: L19
    • 说明:

      TODO

内部类/嵌套类型

构造器

public AbstractMountInventoryScreen(T menu, Inventory inventory, Component title, int inventoryColumns, LivingEntity mount) @ L21

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

参数:

  • menu: T
  • inventory: Inventory
  • title: Component
  • inventoryColumns: int
  • mount: LivingEntity

说明:

TODO

方法

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

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

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

参数:

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

说明:

TODO

protected void extractSlot(GuiGraphicsExtractor graphics, int x, int y) @ L50

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

参数:

  • graphics: GuiGraphicsExtractor
  • x: int
  • y: int

说明:

TODO

public void extractRenderState(GuiGraphicsExtractor graphics, int mouseX, int mouseY, float a) @ L54

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

参数:

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

说明:

TODO

protected abstract Identifier getBackgroundTextureLocation() @ L61

  • 方法名:getBackgroundTextureLocation
  • 源码定位:L61
  • 返回类型:Identifier
  • 修饰符:protected abstract

参数:

说明:

TODO

protected abstract Identifier getSlotSpriteLocation() @ L63

  • 方法名:getSlotSpriteLocation
  • 源码定位:L63
  • 返回类型:Identifier
  • 修饰符:protected abstract

参数:

说明:

TODO

protected abstract Identifier getChestSlotsSpriteLocation() @ L65

  • 方法名:getChestSlotsSpriteLocation
  • 源码定位:L65
  • 返回类型:Identifier
  • 修饰符:protected abstract

参数:

说明:

TODO

protected abstract boolean shouldRenderSaddleSlot() @ L67

  • 方法名:shouldRenderSaddleSlot
  • 源码定位:L67
  • 返回类型:boolean
  • 修饰符:protected abstract

参数:

说明:

TODO

protected abstract boolean shouldRenderArmorSlot() @ L69

  • 方法名:shouldRenderArmorSlot
  • 源码定位:L69
  • 返回类型:boolean
  • 修饰符:protected abstract

参数:

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public abstract class AbstractMountInventoryScreen<T extends AbstractMountInventoryMenu> extends AbstractContainerScreen<T> {
    protected final int inventoryColumns;
    protected float xMouse;
    protected float yMouse;
    protected final LivingEntity mount;
 
    public AbstractMountInventoryScreen(T menu, Inventory inventory, Component title, int inventoryColumns, LivingEntity mount) {
        super(menu, inventory, title);
        this.inventoryColumns = inventoryColumns;
        this.mount = mount;
    }
 
    @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, this.getBackgroundTextureLocation(), xo, yo, 0.0F, 0.0F, this.imageWidth, this.imageHeight, 256, 256);
        if (this.inventoryColumns > 0 && this.getChestSlotsSpriteLocation() != null) {
            graphics.blitSprite(
                RenderPipelines.GUI_TEXTURED, this.getChestSlotsSpriteLocation(), 90, 54, 0, 0, xo + 79, yo + 17, this.inventoryColumns * 18, 54
            );
        }
 
        if (this.shouldRenderSaddleSlot()) {
            this.extractSlot(graphics, xo + 7, yo + 35 - 18);
        }
 
        if (this.shouldRenderArmorSlot()) {
            this.extractSlot(graphics, xo + 7, yo + 35);
        }
 
        InventoryScreen.extractEntityInInventoryFollowsMouse(graphics, xo + 26, yo + 18, xo + 78, yo + 70, 17, 0.25F, this.xMouse, this.yMouse, this.mount);
    }
 
    protected void extractSlot(GuiGraphicsExtractor graphics, int x, int y) {
        graphics.blitSprite(RenderPipelines.GUI_TEXTURED, this.getSlotSpriteLocation(), x, y, 18, 18);
    }
 
    @Override
    public void extractRenderState(GuiGraphicsExtractor graphics, int mouseX, int mouseY, float a) {
        this.xMouse = mouseX;
        this.yMouse = mouseY;
        super.extractRenderState(graphics, mouseX, mouseY, a);
    }
 
    protected abstract Identifier getBackgroundTextureLocation();
 
    protected abstract Identifier getSlotSpriteLocation();
 
    protected abstract @Nullable Identifier getChestSlotsSpriteLocation();
 
    protected abstract boolean shouldRenderSaddleSlot();
 
    protected abstract boolean shouldRenderArmorSlot();
}

引用的其他类