Class SlotWidget

java.lang.Object
emi.dev.emi.emi.api.widget.Widget
emi.dev.emi.emi.api.widget.SlotWidget
All Implemented Interfaces:
Drawable
Direct Known Subclasses:
EmiIngredientRecipe.PageSlotWidget, GeneratedSlotWidget

public class SlotWidget extends Widget
  • Field Details

    • stack

      protected final EmiIngredient stack
    • x

      protected final int x
    • y

      protected final int y
    • textureId

      protected ResourceLocation textureId
    • u

      protected int u
    • v

      protected int v
    • customWidth

      protected int customWidth
    • customHeight

      protected int customHeight
    • drawBack

      protected boolean drawBack
    • output

      protected boolean output
    • catalyst

      protected boolean catalyst
    • custom

      protected boolean custom
    • drawStack

      protected boolean drawStack
    • tooltipSuppliers

      protected List<Supplier<TooltipComponent>> tooltipSuppliers
    • bounds

      protected Bounds bounds
  • Constructor Details

    • SlotWidget

      public SlotWidget(EmiIngredient stack, int x, int y)
  • Method Details

    • getStack

      public EmiIngredient getStack()
    • getRecipe

      @Internal public EmiRecipe getRecipe()
    • drawBack

      public SlotWidget drawBack(boolean drawBack)
      Whether to draw the background texture of a slot.
    • large

      public SlotWidget large(boolean large)
      Whether to the slot as the large 26x26 or small 18x18 slot. This is a purely visual change.
    • drawStack

      public SlotWidget drawStack(boolean drawStack)
      Whether to the stack in the slot should be rendered. Does not affect the tooltip.
    • catalyst

      public SlotWidget catalyst(boolean catalyst)
      Whether to draw a catalyst icon on the slot.
    • appendTooltip

      public SlotWidget appendTooltip(Function<EmiIngredient,TooltipComponent> function)
      Provides a function for appending TooltipComponents to the slot's tooltip.
    • appendTooltip

      public SlotWidget appendTooltip(Supplier<TooltipComponent> supplier)
      Provides a defaultSupplier for appending TooltipComponents to the slot's tooltip.
    • appendTooltip

      public SlotWidget appendTooltip(Text text)
      Provides a shorthand for appending text to the slot's tooltip.
    • recipeContext

      public SlotWidget recipeContext(EmiRecipe recipe)
      Provides EMI context that the slot contains the provided recipe's output. This is used for resolving recipes in the recipe tree, displaying extra information in tooltips, adding recipe context to favorites, and more.
    • backgroundTexture

      public SlotWidget backgroundTexture(ResourceLocation id, int u, int v)
      Sets the slot to use a custom texture. The size of the texture drawn is 18x18, or 26x26 if the slot is large, which is set by large(boolean) ()}. customBackground(ResourceLocation, int, int, int, int) ()} is an alternative for custom sizing.
    • customBackground

      public SlotWidget customBackground(ResourceLocation id, int u, int v, int width, int height)
      Sets the slot to use a custom texture and custom sizing
      Parameters:
      id - The texture identifier to use to draw the background
    • getBounds

      public Bounds getBounds()
      Specified by:
      getBounds in class Widget
    • render

      public void render(DrawContext draw, int mouseX, int mouseY, float delta)
      Specified by:
      render in interface Drawable
      Specified by:
      render in class Widget
    • drawBackground

      public void drawBackground(DrawContext draw, int mouseX, int mouseY, float delta)
    • drawStack

      public void drawStack(DrawContext draw, int mouseX, int mouseY, float delta)
    • drawOverlay

      public void drawOverlay(DrawContext draw, int mouseX, int mouseY, float delta)
    • shouldDrawSlotHighlight

      public boolean shouldDrawSlotHighlight(int mouseX, int mouseY)
    • drawSlotHighlight

      public void drawSlotHighlight(DrawContext draw, Bounds bounds)
    • getTooltip

      public List<TooltipComponent> getTooltip(int mouseX, int mouseY)
      Overrides:
      getTooltip in class Widget
    • addSlotTooltip

      protected void addSlotTooltip(List<TooltipComponent> list)
    • mouseClicked

      public boolean mouseClicked(int mouseX, int mouseY, int button)
      Overrides:
      mouseClicked in class Widget
    • keyPressed

      public boolean keyPressed(int keyCode, int scanCode, int modifiers)
      Overrides:
      keyPressed in class Widget