Interface ITerminalStorageTabClient<S extends ITerminalStorageSlot>
- All Known Implementing Classes:
TerminalStorageTabIngredientComponentClient,TerminalStorageTabIngredientComponentItemStackCraftingClient
public interface ITerminalStorageTabClient<S extends ITerminalStorageSlot>
A client-side terminal storage tab.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final int -
Method Summary
Modifier and TypeMethodDescriptionintcomputeDraggingQuantity(Set<net.minecraft.world.inventory.Slot> dragSlots, int dragMode, net.minecraft.world.item.ItemStack stack, int quantity) Calculate the quantity that will be added to the given stack based on the drag mode and the given list of slots.intdragIntoSlot(net.minecraft.world.inventory.AbstractContainerMenu container, int channel, net.minecraft.world.inventory.Slot slot, int quantity, boolean simulate) Drag the given quantity into the given slot with the currently active instance.intintdefault net.minecraft.resources.ResourceLocationList<ITerminalButton<?,?, ?>> int[]net.minecraft.world.item.ItemStackgetIcon()getInstanceFilter(int channel) Get the currently active filter.net.minecraft.resources.ResourceLocationgetName()default intdefault intintgetSlotCount(int channel) Get the total number of slots in the given channeldefault intdefault intdefault intgetSlots(int channel, int offset, int limit) Get a subset of slots.default intgetStatus(int channel) default net.minecraft.resources.ResourceLocationList<net.minecraft.network.chat.Component>booleanhandleClick(net.minecraft.world.inventory.AbstractContainerMenu container, int channel, int hoveringStorageSlot, int mouseButton, boolean hasClickedOutside, boolean hasClickedInStorage, int hoveredContainerSlot) Called when a mouse click happens in a gui.booleanhandleScroll(net.minecraft.world.inventory.AbstractContainerMenu container, int channel, int hoveringStorageSlot, double delta, boolean hasClickedOutside, boolean hasClickedInStorage, int hoveredContainerSlot) Called when a mouse scroll happens in a gui.booleanbooleanisSlotValidForDraggingInto(int channel, net.minecraft.world.inventory.Slot slot) Check if we can drag over the current slot with an active instance.default voidonCommonSlotRender(net.minecraft.client.gui.screens.inventory.AbstractContainerScreen gui, com.mojang.blaze3d.vertex.PoseStack matrixStack, ContainerScreenTerminalStorage.DrawLayer layer, float partialTick, int x, int y, int mouseX, int mouseY, int slot, ITerminalStorageTabCommon tabCommon) voidonDeselect(int channel) When this tab is deselected by the player.voidonSelect(int channel) When this tab is selected by the player.default voidonTabBackgroundRender(ContainerScreenTerminalStorage<?, ?> screen, com.mojang.blaze3d.vertex.PoseStack matrixStack, float f, int mouseX, int mouseY) voidUnselect the active storage slot.voidsetActiveSlotQuantity(int quantity) Set the active quantity.voidsetInstanceFilter(int channel, String filter) Set a filter for instances in slots.
-
Field Details
-
DEFAULT_SLOT_OFFSET_X
static final int DEFAULT_SLOT_OFFSET_X- See Also:
-
DEFAULT_SLOT_OFFSET_Y
static final int DEFAULT_SLOT_OFFSET_Y- See Also:
-
DEFAULT_SLOT_VISIBLE_ROWS
static final int DEFAULT_SLOT_VISIBLE_ROWS- See Also:
-
DEFAULT_SLOT_ROW_LENGTH
static final int DEFAULT_SLOT_ROW_LENGTH- See Also:
-
-
Method Details
-
onSelect
void onSelect(int channel) When this tab is selected by the player.- Parameters:
channel- The channel.
-
onDeselect
void onDeselect(int channel) When this tab is deselected by the player.- Parameters:
channel- The channel.
-
getName
net.minecraft.resources.ResourceLocation getName()- Returns:
- The unique tab name, as inherited from
ITerminalStorageTab.getName().
-
getTabSettingsName
default net.minecraft.resources.ResourceLocation getTabSettingsName()- Returns:
- The tab name that will be used to store
TerminalStorageStatesettings inside a tab. This can be used to modify in what tab certain settings are stored.
-
getIcon
net.minecraft.world.item.ItemStack getIcon()- Returns:
- An icon for the tab.
-
getTooltip
List<net.minecraft.network.chat.Component> getTooltip()- Returns:
- A tooltip when hovering over the icon.
-
getInstanceFilter
Get the currently active filter.- Parameters:
channel- The channel to get the filter for.- Returns:
- The active filter.
-
setInstanceFilter
Set a filter for instances in slots.- Parameters:
filter- A string-based filter, which could be a regex.channel- The channel to filter in.
-
getSlots
Get a subset of slots.- Parameters:
channel- A channel id.offset- A slot offset.limit- A slot limit.- Returns:
- A list of slots, can be empty.
-
getRowColumnProvider
ITerminalRowColumnProvider getRowColumnProvider()- Returns:
- The current provider of row and column count.
-
isEnabled
boolean isEnabled()- Returns:
- If this tab is enabled.
-
getSlotCount
int getSlotCount(int channel) Get the total number of slots in the given channel- Parameters:
channel- A channel id.- Returns:
- A slot count.
-
getStatus
- Parameters:
channel- A channel id.- Returns:
- A status string.
-
getChannels
int[] getChannels()- Returns:
- All available channels.
-
resetActiveSlot
void resetActiveSlot()Unselect the active storage slot. -
handleClick
boolean handleClick(net.minecraft.world.inventory.AbstractContainerMenu container, int channel, int hoveringStorageSlot, int mouseButton, boolean hasClickedOutside, boolean hasClickedInStorage, int hoveredContainerSlot) Called when a mouse click happens in a gui.- Parameters:
container- The active container.channel- The active channel.hoveringStorageSlot- The storage slot id that is being hovered. -1 if none.mouseButton- The mouse button.hasClickedOutside- If the player has clicked outside the gui.hasClickedInStorage- If the player has clicked inside the storage space. This can be true even if the storage slot is -1.hoveredContainerSlot- The container slot id that is being hovered. -1 if none.- Returns:
- If further click processing should stop.
-
handleScroll
boolean handleScroll(net.minecraft.world.inventory.AbstractContainerMenu container, int channel, int hoveringStorageSlot, double delta, boolean hasClickedOutside, boolean hasClickedInStorage, int hoveredContainerSlot) Called when a mouse scroll happens in a gui.- Parameters:
container- The active container.channel- The active channel.hoveringStorageSlot- The storage slot id that is being hovered. -1 if none.delta- The scroll delta.hasClickedOutside- If the player has clicked outside the gui.hasClickedInStorage- If the player has clicked inside the storage space. This can be true even if the storage slot is -1.hoveredContainerSlot- The container slot id that is being hovered. -1 if none.- Returns:
- If further click processing should stop.
-
getActiveSlotId
int getActiveSlotId()- Returns:
- The active storage slot id.
-
getActiveSlotQuantity
int getActiveSlotQuantity()- Returns:
- The active storage slot quantity.
-
setActiveSlotQuantity
void setActiveSlotQuantity(int quantity) Set the active quantity.- Parameters:
quantity- A quantity to set.
-
getButtons
List<ITerminalButton<?,?, getButtons()?>> - Returns:
- Buttons that are available for this tab.
-
getSlotOffsetX
default int getSlotOffsetX() -
getSlotOffsetY
default int getSlotOffsetY() -
getSlotVisibleRows
default int getSlotVisibleRows() -
getSlotRowLength
default int getSlotRowLength() -
getPlayerInventoryOffsetX
default int getPlayerInventoryOffsetX() -
getPlayerInventoryOffsetY
default int getPlayerInventoryOffsetY() -
getBackgroundTexture
@Nullable default net.minecraft.resources.ResourceLocation getBackgroundTexture()- Returns:
- An optional alternative background texture that should be used when rendering the gui of the tab.
-
onTabBackgroundRender
default void onTabBackgroundRender(ContainerScreenTerminalStorage<?, ?> screen, com.mojang.blaze3d.vertex.PoseStack matrixStack, float f, int mouseX, int mouseY) -
onCommonSlotRender
default void onCommonSlotRender(net.minecraft.client.gui.screens.inventory.AbstractContainerScreen gui, com.mojang.blaze3d.vertex.PoseStack matrixStack, ContainerScreenTerminalStorage.DrawLayer layer, float partialTick, int x, int y, int mouseX, int mouseY, int slot, ITerminalStorageTabCommon tabCommon) -
isSlotValidForDraggingInto
boolean isSlotValidForDraggingInto(int channel, net.minecraft.world.inventory.Slot slot) Check if we can drag over the current slot with an active instance.- Parameters:
channel- The active channel.slot- The slot to drag over.- Returns:
- If we can drag over the slot.
-
computeDraggingQuantity
int computeDraggingQuantity(Set<net.minecraft.world.inventory.Slot> dragSlots, int dragMode, net.minecraft.world.item.ItemStack stack, int quantity) Calculate the quantity that will be added to the given stack based on the drag mode and the given list of slots.- Parameters:
dragSlots- The list of slots to drag over.dragMode- The drag mode.stack- The stack to calculate the quantity for.quantity- The available quantity to drag.- Returns:
- The quantity that will be added.
-
dragIntoSlot
int dragIntoSlot(net.minecraft.world.inventory.AbstractContainerMenu container, int channel, net.minecraft.world.inventory.Slot slot, int quantity, boolean simulate) Drag the given quantity into the given slot with the currently active instance.- Parameters:
container- The active container.channel- The active channel.slot- The slot to drag into.quantity- The quantity to insert.simulate- If insertion should only be simulated.- Returns:
- The quantity that was inserted.
-