T - The instance type.M - The matching condition parameter.public class TerminalStorageTabIngredientComponentClient<T,M> extends java.lang.Object implements ITerminalStorageTabClient<TerminalStorageSlotIngredient<T,M>>
| Modifier and Type | Class and Description |
|---|---|
static class |
TerminalStorageTabIngredientComponentClient.InstanceWithMetadata<T> |
| Modifier and Type | Field and Description |
|---|---|
protected ContainerTerminalStorage |
container |
protected org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T,M> |
ingredientComponent |
DEFAULT_SLOT_OFFSET_X, DEFAULT_SLOT_OFFSET_Y, DEFAULT_SLOT_ROW_LENGTH, DEFAULT_SLOT_VISIBLE_ROWS| Constructor and Description |
|---|
TerminalStorageTabIngredientComponentClient(ContainerTerminalStorage container,
net.minecraft.util.ResourceLocation name,
org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?> ingredientComponent) |
| Modifier and Type | Method and Description |
|---|---|
void |
addCraftingOptions(int channel,
java.util.List<HandlerWrappedTerminalCraftingOption<T>> craftingOptions,
boolean reset,
boolean firstChannel) |
int |
computeDraggingQuantity(java.util.Set<net.minecraft.inventory.Slot> dragSlots,
int dragMode,
net.minecraft.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.
|
int |
dragIntoSlot(net.minecraft.inventory.Container container,
int channel,
net.minecraft.inventory.Slot slot,
int quantity,
boolean simulate)
Drag the given quantity into the given slot with the currently active instance.
|
protected int |
findActiveSlotId(int channel,
T instance) |
int |
getActiveSlotId() |
int |
getActiveSlotQuantity() |
java.util.List<ITerminalButton<?,?,?>> |
getButtons() |
int[] |
getChannels() |
java.util.Collection<HandlerWrappedTerminalCraftingOption<T>> |
getCraftingOptions(int channel) |
protected java.util.List<TerminalStorageTabIngredientComponentClient.InstanceWithMetadata<T>> |
getFilteredIngredientsView(int channel) |
net.minecraft.item.ItemStack |
getIcon() |
org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T,M> |
getIngredientComponent() |
java.lang.String |
getInstanceFilter(int channel)
Get the currently active filter.
|
java.util.function.Predicate<TerminalStorageTabIngredientComponentClient.InstanceWithMetadata<T>> |
getInstanceFilterMetadata() |
java.util.Comparator<T> |
getInstanceSorter() |
long |
getMaxQuantity(int channel)
Get the total maximum allowed quantity in the given channel.
|
net.minecraft.util.ResourceLocation |
getName() |
java.util.List<TerminalStorageTabIngredientComponentClient.InstanceWithMetadata<T>> |
getRawUnfilteredIngredientsView(int channel) |
java.util.Optional<TerminalStorageSlotIngredient<T,M>> |
getSlot(int channel,
int index) |
int |
getSlotCount(int channel)
Get the total number of slots in the given channel
|
java.util.Optional<T> |
getSlotInstance(int channel,
int index) |
java.util.List<TerminalStorageSlotIngredient<T,M>> |
getSlots(int channel,
int offset,
int limit)
Get a subset of slots.
|
java.lang.String |
getStatus(int channel) |
java.util.List<java.lang.String> |
getTooltip() |
long |
getTotalQuantity(int channel)
Get the total instance quantities in the given channel.
|
java.util.List<TerminalStorageTabIngredientComponentClient.InstanceWithMetadata<T>> |
getUnfilteredIngredientsView(int channel) |
protected java.util.Collection<T> |
getUniqueCraftingOptionOutputs(ITerminalCraftingOption<T> craftingOption) |
protected IIngredientComponentTerminalStorageHandler<T,M> |
getViewHandler() |
void |
handleActiveIngredientUpdate(int channel,
T activeInstance)
Called by the server when a (remainder) active storage ingredient needs to be set.
|
boolean |
handleClick(net.minecraft.inventory.Container container,
int channel,
int hoveringStorageSlot,
int mouseButton,
boolean hasClickedOutside,
boolean hasClickedInStorage,
int hoveredContainerSlot)
Called when a mouse click happens in a gui.
|
boolean |
isEnabled() |
boolean |
isSlotValidForDraggingInto(int channel,
net.minecraft.inventory.Slot slot)
Check if we can drag over the current slot with an active instance.
|
protected void |
loadButtons(java.util.List<ITerminalButton<?,?,?>> buttons) |
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.
|
void |
onCommonSlotRender(net.minecraft.client.gui.inventory.GuiContainer gui,
GuiTerminalStorage.DrawLayer layer,
float partialTick,
int x,
int y,
int mouseX,
int mouseY,
int slot,
ITerminalStorageTabCommon tabCommon) |
static void |
onToolTip(net.minecraftforge.event.entity.player.ItemTooltipEvent event) |
void |
resetActiveSlot()
Unselect the active storage slot.
|
void |
resetFilteredIngredientsViews(int channel) |
void |
setActiveSlotQuantity(int quantity)
Set the active quantity.
|
void |
setInstanceFilter(int channel,
java.lang.String filter)
Set a filter for instances in slots.
|
void |
setMaxQuantity(int channel,
long maxQuantity)
Set the max quantity in the given channel.
|
protected java.util.stream.Stream<TerminalStorageTabIngredientComponentClient.InstanceWithMetadata<T>> |
transformIngredientsView(java.util.stream.Stream<TerminalStorageTabIngredientComponentClient.InstanceWithMetadata<T>> ingredientStream) |
protected void |
updateActiveInstance(java.util.Optional<T> lastInstance,
int channel) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetBackgroundTexture, getSlotOffsetX, getSlotOffsetY, getSlotRowLength, getSlotVisibleRowsprotected final org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T,M> ingredientComponent
protected final ContainerTerminalStorage container
public TerminalStorageTabIngredientComponentClient(ContainerTerminalStorage container, net.minecraft.util.ResourceLocation name, org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?> ingredientComponent)
public static void onToolTip(net.minecraftforge.event.entity.player.ItemTooltipEvent event)
protected void loadButtons(java.util.List<ITerminalButton<?,?,?>> buttons)
public org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T,M> getIngredientComponent()
public net.minecraft.util.ResourceLocation getName()
getName in interface ITerminalStorageTabClient<TerminalStorageSlotIngredient<T,M>>ITerminalStorageTab.getName().public net.minecraft.item.ItemStack getIcon()
getIcon in interface ITerminalStorageTabClient<TerminalStorageSlotIngredient<T,M>>public java.util.List<java.lang.String> getTooltip()
getTooltip in interface ITerminalStorageTabClient<TerminalStorageSlotIngredient<T,M>>public java.lang.String getInstanceFilter(int channel)
ITerminalStorageTabClientgetInstanceFilter in interface ITerminalStorageTabClient<TerminalStorageSlotIngredient<T,M>>channel - The channel to get the filter for.public java.util.function.Predicate<TerminalStorageTabIngredientComponentClient.InstanceWithMetadata<T>> getInstanceFilterMetadata()
public void resetFilteredIngredientsViews(int channel)
public void setInstanceFilter(int channel,
java.lang.String filter)
ITerminalStorageTabClientsetInstanceFilter in interface ITerminalStorageTabClient<TerminalStorageSlotIngredient<T,M>>channel - The channel to filter in.filter - A string-based filter, which could be a regex.public java.util.List<TerminalStorageTabIngredientComponentClient.InstanceWithMetadata<T>> getRawUnfilteredIngredientsView(int channel)
@Nullable public java.util.Collection<HandlerWrappedTerminalCraftingOption<T>> getCraftingOptions(int channel)
public java.util.List<TerminalStorageTabIngredientComponentClient.InstanceWithMetadata<T>> getUnfilteredIngredientsView(int channel)
protected java.util.Collection<T> getUniqueCraftingOptionOutputs(ITerminalCraftingOption<T> craftingOption)
protected java.util.List<TerminalStorageTabIngredientComponentClient.InstanceWithMetadata<T>> getFilteredIngredientsView(int channel)
protected java.util.stream.Stream<TerminalStorageTabIngredientComponentClient.InstanceWithMetadata<T>> transformIngredientsView(java.util.stream.Stream<TerminalStorageTabIngredientComponentClient.InstanceWithMetadata<T>> ingredientStream)
public java.util.List<TerminalStorageSlotIngredient<T,M>> getSlots(int channel, int offset, int limit)
ITerminalStorageTabClientgetSlots in interface ITerminalStorageTabClient<TerminalStorageSlotIngredient<T,M>>channel - A channel id.offset - A slot offset.limit - A slot limit.public boolean isEnabled()
isEnabled in interface ITerminalStorageTabClient<TerminalStorageSlotIngredient<T,M>>public java.util.Optional<T> getSlotInstance(int channel, int index)
public java.util.Optional<TerminalStorageSlotIngredient<T,M>> getSlot(int channel, int index)
public int getSlotCount(int channel)
ITerminalStorageTabClientgetSlotCount in interface ITerminalStorageTabClient<TerminalStorageSlotIngredient<T,M>>channel - A channel id.public java.lang.String getStatus(int channel)
getStatus in interface ITerminalStorageTabClient<TerminalStorageSlotIngredient<T,M>>channel - A channel id.public void onChange(int channel,
org.cyclops.integrateddynamics.api.ingredient.IIngredientComponentStorageObservable.Change changeType,
org.cyclops.cyclopscore.ingredient.collection.IngredientArrayList<T,M> ingredients,
boolean enabled)
channel - A channel id.changeType - A change type.ingredients - A list of changed ingredients.enabled - If this tab is enabled.protected void updateActiveInstance(java.util.Optional<T> lastInstance, int channel)
public void addCraftingOptions(int channel,
java.util.List<HandlerWrappedTerminalCraftingOption<T>> craftingOptions,
boolean reset,
boolean firstChannel)
protected int findActiveSlotId(int channel,
T instance)
public void handleActiveIngredientUpdate(int channel,
T activeInstance)
channel - The channel.activeInstance - The active instance.public long getMaxQuantity(int channel)
channel - A channel id.public void setMaxQuantity(int channel,
long maxQuantity)
channel - A channel id.maxQuantity - The new max quantity.public long getTotalQuantity(int channel)
channel - A channel id.public int[] getChannels()
getChannels in interface ITerminalStorageTabClient<TerminalStorageSlotIngredient<T,M>>public void resetActiveSlot()
ITerminalStorageTabClientresetActiveSlot in interface ITerminalStorageTabClient<TerminalStorageSlotIngredient<T,M>>public boolean handleClick(net.minecraft.inventory.Container container,
int channel,
int hoveringStorageSlot,
int mouseButton,
boolean hasClickedOutside,
boolean hasClickedInStorage,
int hoveredContainerSlot)
ITerminalStorageTabClienthandleClick in interface ITerminalStorageTabClient<TerminalStorageSlotIngredient<T,M>>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.public int getActiveSlotId()
getActiveSlotId in interface ITerminalStorageTabClient<TerminalStorageSlotIngredient<T,M>>public int getActiveSlotQuantity()
getActiveSlotQuantity in interface ITerminalStorageTabClient<TerminalStorageSlotIngredient<T,M>>public void setActiveSlotQuantity(int quantity)
ITerminalStorageTabClientsetActiveSlotQuantity in interface ITerminalStorageTabClient<TerminalStorageSlotIngredient<T,M>>quantity - A quantity to set.public java.util.List<ITerminalButton<?,?,?>> getButtons()
getButtons in interface ITerminalStorageTabClient<TerminalStorageSlotIngredient<T,M>>@Nullable public java.util.Comparator<T> getInstanceSorter()
public void onCommonSlotRender(net.minecraft.client.gui.inventory.GuiContainer gui,
GuiTerminalStorage.DrawLayer layer,
float partialTick,
int x,
int y,
int mouseX,
int mouseY,
int slot,
ITerminalStorageTabCommon tabCommon)
onCommonSlotRender in interface ITerminalStorageTabClient<TerminalStorageSlotIngredient<T,M>>protected IIngredientComponentTerminalStorageHandler<T,M> getViewHandler()
public boolean isSlotValidForDraggingInto(int channel,
net.minecraft.inventory.Slot slot)
ITerminalStorageTabClientisSlotValidForDraggingInto in interface ITerminalStorageTabClient<TerminalStorageSlotIngredient<T,M>>channel - The active channel.slot - The slot to drag over.public int computeDraggingQuantity(java.util.Set<net.minecraft.inventory.Slot> dragSlots,
int dragMode,
net.minecraft.item.ItemStack stack,
int quantity)
ITerminalStorageTabClientcomputeDraggingQuantity in interface ITerminalStorageTabClient<TerminalStorageSlotIngredient<T,M>>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.public int dragIntoSlot(net.minecraft.inventory.Container container,
int channel,
net.minecraft.inventory.Slot slot,
int quantity,
boolean simulate)
ITerminalStorageTabClientdragIntoSlot in interface ITerminalStorageTabClient<TerminalStorageSlotIngredient<T,M>>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.