Interface IItemCompressionSequence
- All Known Implementing Classes:
FinishableMapItemCompressionSequence,IItemCompressionSequence.EmptyItemCompressionSequence,NoItemCompressionSequence
public interface IItemCompressionSequence
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordstatic class -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionAn ordered list ofIItemCompressions, with thecountsrelative to the Item before (i.e.List<net.minecraft.world.item.ItemStack> Get the ordered list of all Item (Stacks) in this sequence.Get the least-compressed Item which is a BlockItem.net.minecraft.world.item.ItemStackGet a copy of the least-compressed Item (Stack) in the sequence.default org.apache.commons.lang3.math.FractiongetEquivalentBaseItems(int item) org.apache.commons.lang3.math.FractiongetEquivalentBaseItems(net.minecraft.world.item.ItemStack stack) Get the number ofbase Itemsequivalent to the given Item Stack.doublegetEquivalentBaseItems(net.minecraft.world.item.ItemStack stack, double count) Get the number ofbase Itemsa given amount of the given Item.default List<BigItemStack> getFewestStacks(long baseItemCount) Divide a number ofbase Itemsinto the biggest possible compressed forms, producing the smallest total number of Item Stacks.default booleanisEmpty()default intsize()The number ofItemsin this sequence.
-
Field Details
-
EMPTY
-
-
Method Details
-
getBaseItem
net.minecraft.world.item.ItemStack getBaseItem()Get a copy of the least-compressed Item (Stack) in the sequence.- Returns:
- ItemStack of count
1
-
getAllItems
List<net.minecraft.world.item.ItemStack> getAllItems()Get the ordered list of all Item (Stacks) in this sequence.- Returns:
- Non-
nulllist of ItemStacks of count1
-
size
default int size()The number ofItemsin this sequence.- Returns:
- Positive number
-
getAllCompressions
List<IItemCompression> getAllCompressions()An ordered list ofIItemCompressions, with thecountsrelative to the Item before (i.e. not relative to thebase Item, except for the first compression).- Returns:
- Non-
nulllist ofIItemCompressions
-
getEquivalentBaseItems
org.apache.commons.lang3.math.Fraction getEquivalentBaseItems(net.minecraft.world.item.ItemStack stack) Get the number ofbase Itemsequivalent to the given Item Stack.- Parameters:
stack- The count of the Stack is considered- Returns:
nullif the Item (considering its Components) are not part of this sequence- See Also:
-
getEquivalentBaseItems
double getEquivalentBaseItems(net.minecraft.world.item.ItemStack stack, double count) Get the number ofbase Itemsa given amount of the given Item.- Parameters:
stack- The count of this Stack is ignoredcount-- Returns:
0if the Item (considering its Components) are not part of this sequence
-
getEquivalentBaseItems
default org.apache.commons.lang3.math.Fraction getEquivalentBaseItems(int item) - Parameters:
item-- Returns:
nullifitemis outside the bounds of the number of Items in this sequence.- See Also:
-
getBaseBlock
Optional<IItemCompressionSequence.CompressedBlock> getBaseBlock()Get the least-compressed Item which is a BlockItem.- Returns:
- Empty Optional if there are no BlockItems in this sequence, or an Optional containing a
IItemCompressionSequence.CompressedBlockcontaining the Block and the ItemStack pertaining to it (which is guaranteed to beinthis sequence)
-
isEmpty
default boolean isEmpty() -
getFewestStacks
Divide a number ofbase Itemsinto the biggest possible compressed forms, producing the smallest total number of Item Stacks.- Parameters:
baseItemCount-
-