Package emi.dev.emi.emi.api.widget
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
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Boundsprotected booleanprotected booleanprotected intprotected intprotected booleanprotected booleanprotected booleanprotected final EmiIngredientprotected ResourceLocationprotected List<Supplier<TooltipComponent>>protected intprotected intprotected final intprotected final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddSlotTooltip(List<TooltipComponent> list) appendTooltip(Text text) Provides a shorthand for appending text to the slot's tooltip.appendTooltip(Function<EmiIngredient, TooltipComponent> function) Provides a function for appendingTooltipComponents to the slot's tooltip.appendTooltip(Supplier<TooltipComponent> supplier) Provides a defaultSupplier for appendingTooltipComponents to the slot's tooltip.backgroundTexture(ResourceLocation id, int u, int v) Sets the slot to use a custom texture.catalyst(boolean catalyst) Whether to draw a catalyst icon on the slot.customBackground(ResourceLocation id, int u, int v, int width, int height) Sets the slot to use a custom texture and custom sizingdrawBack(boolean drawBack) Whether to draw the background texture of a slot.voiddrawBackground(DrawContext draw, int mouseX, int mouseY, float delta) voiddrawOverlay(DrawContext draw, int mouseX, int mouseY, float delta) voiddrawSlotHighlight(DrawContext draw, Bounds bounds) drawStack(boolean drawStack) Whether to the stack in the slot should be rendered.voiddrawStack(DrawContext draw, int mouseX, int mouseY, float delta) getStack()getTooltip(int mouseX, int mouseY) booleankeyPressed(int keyCode, int scanCode, int modifiers) large(boolean large) Whether to the slot as the large 26x26 or small 18x18 slot.booleanmouseClicked(int mouseX, int mouseY, int button) recipeContext(EmiRecipe recipe) Provides EMI context that the slot contains the provided recipe's output.voidrender(DrawContext draw, int mouseX, int mouseY, float delta) booleanshouldDrawSlotHighlight(int mouseX, int mouseY)
-
Field Details
-
stack
-
x
protected final int x -
y
protected final int y -
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
-
bounds
-
-
Constructor Details
-
SlotWidget
-
-
Method Details
-
getStack
-
getRecipe
-
drawBack
Whether to draw the background texture of a slot. -
large
Whether to the slot as the large 26x26 or small 18x18 slot. This is a purely visual change. -
drawStack
Whether to the stack in the slot should be rendered. Does not affect the tooltip. -
catalyst
Whether to draw a catalyst icon on the slot. -
appendTooltip
Provides a function for appendingTooltipComponents to the slot's tooltip. -
appendTooltip
Provides a defaultSupplier for appendingTooltipComponents to the slot's tooltip. -
appendTooltip
Provides a shorthand for appending text to the slot's tooltip. -
recipeContext
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
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 bylarge(boolean)()}.customBackground(ResourceLocation, int, int, int, int)()} is an alternative for custom sizing. -
customBackground
Sets the slot to use a custom texture and custom sizing- Parameters:
id- The texture identifier to use to draw the background
-
getBounds
-
render
-
drawBackground
-
drawStack
-
drawOverlay
-
shouldDrawSlotHighlight
public boolean shouldDrawSlotHighlight(int mouseX, int mouseY) -
drawSlotHighlight
-
getTooltip
- Overrides:
getTooltipin classWidget
-
addSlotTooltip
-
mouseClicked
public boolean mouseClicked(int mouseX, int mouseY, int button) - Overrides:
mouseClickedin classWidget
-
keyPressed
public boolean keyPressed(int keyCode, int scanCode, int modifiers) - Overrides:
keyPressedin classWidget
-