Class TerminalStorageTabIngredientComponentClient<T,M>
java.lang.Object
org.cyclops.integratedterminals.core.terminalstorage.TerminalStorageTabIngredientComponentClient<T,M>
- Type Parameters:
T- The instance type.M- The matching condition parameter.
- All Implemented Interfaces:
ITerminalStorageTabClient<TerminalStorageSlotIngredient<T,M>>
- Direct Known Subclasses:
TerminalStorageTabIngredientComponentItemStackCraftingClient
public class TerminalStorageTabIngredientComponentClient<T,M>
extends Object
implements ITerminalStorageTabClient<TerminalStorageSlotIngredient<T,M>>
A client-side storage terminal ingredient tab.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class -
Field Summary
FieldsFields inherited from interface org.cyclops.integratedterminals.api.terminalstorage.ITerminalStorageTabClient
DEFAULT_SLOT_OFFSET_X, DEFAULT_SLOT_OFFSET_Y, DEFAULT_SLOT_ROW_LENGTH, DEFAULT_SLOT_VISIBLE_ROWS -
Constructor Summary
ConstructorsConstructorDescriptionTerminalStorageTabIngredientComponentClient(ContainerTerminalStorageBase container, net.minecraft.resources.ResourceLocation name, org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?, ?> ingredientComponent) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCraftingOptions(int channel, List<HandlerWrappedTerminalCraftingOption<T>> craftingOptions, boolean reset, boolean firstChannel) intcomputeDraggingQuantity(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.protected intfindActiveSlotId(int channel, T instance) intintList<ITerminalButton<?,?, ?>> int[]getCraftingOptions(int channel) getFilteredIngredientsView(int channel) net.minecraft.world.item.ItemStackgetIcon()getInstanceFilter(int channel) Get the currently active filter.intlonggetMaxQuantity(int channel) Get the total maximum allowed quantity in the given channel.net.minecraft.resources.ResourceLocationgetName()getRawUnfilteredIngredientsView(int channel) getSlot(int channel, int index) intgetSlotCount(int channel) Get the total number of slots in the given channelgetSlotInstance(int channel, int index) getSlots(int channel, int offset, int limit) Get a subset of slots.getStatus(int channel) List<net.minecraft.network.chat.Component>longgetTotalQuantity(int channel) Get the total instance quantities in the given channel.getUnfilteredIngredientsView(int channel) protected Collection<T>getUniqueCraftingOptionOutputs(ITerminalCraftingOption<T> craftingOption) protected IIngredientComponentTerminalStorageHandler<T,M> voidhandleActiveIngredientUpdate(int channel, T activeInstance) Called by the server when a (remainder) active storage ingredient needs to be set.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.protected voidloadButtons(List<ITerminalButton<?, ?, ?>> buttons) voidonChange(int channel, org.cyclops.integrateddynamics.api.ingredient.IIngredientComponentStorageObservable.Change changeType, org.cyclops.cyclopscore.ingredient.collection.IngredientArrayList<T, M> ingredients, boolean enabled) Receiver an ingredients change event.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.static voidonToolTip(net.minecraftforge.event.entity.player.ItemTooltipEvent event) voidUnselect the active storage slot.voidresetFilteredIngredientsViews(int channel) voidvoidsetActiveSlotQuantity(int quantity) Set the active quantity.voidsetInstanceFilter(int channel, String filter) Set a filter for instances in slots.voidsetMaxQuantity(int channel, long maxQuantity) Set the max quantity in the given channel.transformIngredientsView(Stream<TerminalStorageTabIngredientComponentClient.InstanceWithMetadata<T>> ingredientStream) protected voidupdateActiveInstance(Optional<T> lastInstance, int channel) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.cyclops.integratedterminals.api.terminalstorage.ITerminalStorageTabClient
getBackgroundTexture, getPlayerInventoryOffsetX, getPlayerInventoryOffsetY, getSlotOffsetX, getSlotOffsetY, getSlotRowLength, getSlotVisibleRows, getTabSettingsName, onTabBackgroundRender
-
Field Details
-
ingredientComponent
-
container
-
-
Constructor Details
-
TerminalStorageTabIngredientComponentClient
public TerminalStorageTabIngredientComponentClient(ContainerTerminalStorageBase container, net.minecraft.resources.ResourceLocation name, org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?, ?> ingredientComponent)
-
-
Method Details
-
onToolTip
public static void onToolTip(net.minecraftforge.event.entity.player.ItemTooltipEvent event) -
loadButtons
-
getIngredientComponent
-
onSelect
public void onSelect(int channel) Description copied from interface:ITerminalStorageTabClientWhen this tab is selected by the player.- Specified by:
onSelectin interfaceITerminalStorageTabClient<T>- Parameters:
channel- The channel.
-
onDeselect
public void onDeselect(int channel) Description copied from interface:ITerminalStorageTabClientWhen this tab is deselected by the player.- Specified by:
onDeselectin interfaceITerminalStorageTabClient<T>- Parameters:
channel- The channel.
-
getName
public net.minecraft.resources.ResourceLocation getName()- Specified by:
getNamein interfaceITerminalStorageTabClient<T>- Returns:
- The unique tab name, as inherited from
ITerminalStorageTab.getName().
-
getIcon
public net.minecraft.world.item.ItemStack getIcon()- Specified by:
getIconin interfaceITerminalStorageTabClient<T>- Returns:
- An icon for the tab.
-
getTooltip
- Specified by:
getTooltipin interfaceITerminalStorageTabClient<T>- Returns:
- A tooltip when hovering over the icon.
-
getInstanceFilter
Description copied from interface:ITerminalStorageTabClientGet the currently active filter.- Specified by:
getInstanceFilterin interfaceITerminalStorageTabClient<T>- Parameters:
channel- The channel to get the filter for.- Returns:
- The active filter.
-
getInstanceFilterMetadata
public Predicate<TerminalStorageTabIngredientComponentClient.InstanceWithMetadata<T>> getInstanceFilterMetadata() -
resetFilteredIngredientsViews
public void resetFilteredIngredientsViews(int channel) -
setInstanceFilter
Description copied from interface:ITerminalStorageTabClientSet a filter for instances in slots.- Specified by:
setInstanceFilterin interfaceITerminalStorageTabClient<T>- Parameters:
channel- The channel to filter in.filter- A string-based filter, which could be a regex.
-
getRawUnfilteredIngredientsView
public List<TerminalStorageTabIngredientComponentClient.InstanceWithMetadata<T>> getRawUnfilteredIngredientsView(int channel) -
getCraftingOptions
@Nullable public Collection<HandlerWrappedTerminalCraftingOption<T>> getCraftingOptions(int channel) -
getUnfilteredIngredientsView
public List<TerminalStorageTabIngredientComponentClient.InstanceWithMetadata<T>> getUnfilteredIngredientsView(int channel) -
getUniqueCraftingOptionOutputs
-
getFilteredIngredientsView
protected List<TerminalStorageTabIngredientComponentClient.InstanceWithMetadata<T>> getFilteredIngredientsView(int channel) -
transformIngredientsView
protected Stream<TerminalStorageTabIngredientComponentClient.InstanceWithMetadata<T>> transformIngredientsView(Stream<TerminalStorageTabIngredientComponentClient.InstanceWithMetadata<T>> ingredientStream) -
getSlots
Description copied from interface:ITerminalStorageTabClientGet a subset of slots.- Specified by:
getSlotsin interfaceITerminalStorageTabClient<T>- Parameters:
channel- A channel id.offset- A slot offset.limit- A slot limit.- Returns:
- A list of slots, can be empty.
-
isEnabled
public boolean isEnabled()- Specified by:
isEnabledin interfaceITerminalStorageTabClient<T>- Returns:
- If this tab is enabled.
-
getSlotInstance
-
getSlot
-
getSlotCount
public int getSlotCount(int channel) Description copied from interface:ITerminalStorageTabClientGet the total number of slots in the given channel- Specified by:
getSlotCountin interfaceITerminalStorageTabClient<T>- Parameters:
channel- A channel id.- Returns:
- A slot count.
-
getStatus
- Specified by:
getStatusin interfaceITerminalStorageTabClient<T>- Parameters:
channel- A channel id.- Returns:
- A status string.
-
onChange
public void onChange(int channel, org.cyclops.integrateddynamics.api.ingredient.IIngredientComponentStorageObservable.Change changeType, org.cyclops.cyclopscore.ingredient.collection.IngredientArrayList<T, M> ingredients, boolean enabled) Receiver an ingredients change event.- Parameters:
channel- A channel id.changeType- A change type.ingredients- A list of changed ingredients.enabled- If this tab is enabled.
-
updateActiveInstance
-
addCraftingOptions
public void addCraftingOptions(int channel, List<HandlerWrappedTerminalCraftingOption<T>> craftingOptions, boolean reset, boolean firstChannel) -
findActiveSlotId
-
handleActiveIngredientUpdate
Called by the server when a (remainder) active storage ingredient needs to be set.- Parameters:
channel- The channel.activeInstance- The active instance.
-
getMaxQuantity
public long getMaxQuantity(int channel) Get the total maximum allowed quantity in the given channel.- Parameters:
channel- A channel id.- Returns:
- The max quantity.
-
setMaxQuantity
public void setMaxQuantity(int channel, long maxQuantity) Set the max quantity in the given channel.- Parameters:
channel- A channel id.maxQuantity- The new max quantity.
-
getTotalQuantity
public long getTotalQuantity(int channel) Get the total instance quantities in the given channel.- Parameters:
channel- A channel id.- Returns:
- The total quantity.
-
getChannels
public int[] getChannels()- Specified by:
getChannelsin interfaceITerminalStorageTabClient<T>- Returns:
- All available channels.
-
resetActiveSlot
public void resetActiveSlot()Description copied from interface:ITerminalStorageTabClientUnselect the active storage slot.- Specified by:
resetActiveSlotin interfaceITerminalStorageTabClient<T>
-
handleClick
public boolean handleClick(net.minecraft.world.inventory.AbstractContainerMenu container, int channel, int hoveringStorageSlot, int mouseButton, boolean hasClickedOutside, boolean hasClickedInStorage, int hoveredContainerSlot) Description copied from interface:ITerminalStorageTabClientCalled when a mouse click happens in a gui.- Specified by:
handleClickin interfaceITerminalStorageTabClient<T>- 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
public boolean handleScroll(net.minecraft.world.inventory.AbstractContainerMenu container, int channel, int hoveringStorageSlot, double delta, boolean hasClickedOutside, boolean hasClickedInStorage, int hoveredContainerSlot) Description copied from interface:ITerminalStorageTabClientCalled when a mouse scroll happens in a gui.- Specified by:
handleScrollin interfaceITerminalStorageTabClient<T>- 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
public int getActiveSlotId()- Specified by:
getActiveSlotIdin interfaceITerminalStorageTabClient<T>- Returns:
- The active storage slot id.
-
getActiveSlotQuantity
public int getActiveSlotQuantity()- Specified by:
getActiveSlotQuantityin interfaceITerminalStorageTabClient<T>- Returns:
- The active storage slot quantity.
-
setActiveSlotQuantity
public void setActiveSlotQuantity(int quantity) Description copied from interface:ITerminalStorageTabClientSet the active quantity.- Specified by:
setActiveSlotQuantityin interfaceITerminalStorageTabClient<T>- Parameters:
quantity- A quantity to set.
-
getButtons
- Specified by:
getButtonsin interfaceITerminalStorageTabClient<T>- Returns:
- Buttons that are available for this tab.
-
getInstanceSorter
-
getRowColumnProvider
- Specified by:
getRowColumnProviderin interfaceITerminalStorageTabClient<T>- Returns:
- The current provider of row and column count.
-
onCommonSlotRender
public 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) - Specified by:
onCommonSlotRenderin interfaceITerminalStorageTabClient<T>
-
getViewHandler
-
isSlotValidForDraggingInto
public boolean isSlotValidForDraggingInto(int channel, net.minecraft.world.inventory.Slot slot) Description copied from interface:ITerminalStorageTabClientCheck if we can drag over the current slot with an active instance.- Specified by:
isSlotValidForDraggingIntoin interfaceITerminalStorageTabClient<T>- Parameters:
channel- The active channel.slot- The slot to drag over.- Returns:
- If we can drag over the slot.
-
computeDraggingQuantity
public int computeDraggingQuantity(Set<net.minecraft.world.inventory.Slot> dragSlots, int dragMode, net.minecraft.world.item.ItemStack stack, int quantity) Description copied from interface:ITerminalStorageTabClientCalculate the quantity that will be added to the given stack based on the drag mode and the given list of slots.- Specified by:
computeDraggingQuantityin interfaceITerminalStorageTabClient<T>- 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
public int dragIntoSlot(net.minecraft.world.inventory.AbstractContainerMenu container, int channel, net.minecraft.world.inventory.Slot slot, int quantity, boolean simulate) Description copied from interface:ITerminalStorageTabClientDrag the given quantity into the given slot with the currently active instance.- Specified by:
dragIntoSlotin interfaceITerminalStorageTabClient<T>- 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.
-
resetScale
public void resetScale() -
getLastChangeId
public int getLastChangeId()
-