Class FinishableMapItemCompressionSequence
java.lang.Object
com.petrolpark.core.recipe.compression.FinishableMapItemCompressionSequence
- All Implemented Interfaces:
IItemCompressionSequence
public class FinishableMapItemCompressionSequence
extends Object
implements IItemCompressionSequence
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.petrolpark.core.recipe.compression.IItemCompressionSequence
IItemCompressionSequence.CompressedBlock, IItemCompressionSequence.EmptyItemCompressionSequence -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final List<net.minecraft.world.item.ItemStack> protected Optional<IItemCompressionSequence.CompressedBlock> protected final net.minecraft.world.item.ItemStackprotected final List<IItemCompression> protected booleanprotected final List<org.apache.commons.lang3.math.Fraction> protected final Map<net.minecraft.world.item.ItemStack, org.apache.commons.lang3.math.Fraction> Fields inherited from interface com.petrolpark.core.recipe.compression.IItemCompressionSequence
EMPTY -
Constructor Summary
ConstructorsConstructorDescriptionFinishableMapItemCompressionSequence(net.minecraft.world.item.ItemStack baseItem) -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(IItemCompression compression) protected voidcheckToAddBaseBlock(net.minecraft.world.item.ItemStack stack) finish()An 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.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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.petrolpark.core.recipe.compression.IItemCompressionSequence
getFewestStacks, isEmpty, size
-
Field Details
-
finished
protected boolean finished -
baseItem
protected final net.minecraft.world.item.ItemStack baseItem -
fractionsByStack
protected final Map<net.minecraft.world.item.ItemStack,org.apache.commons.lang3.math.Fraction> fractionsByStack -
fractionsByIndex
-
allItems
-
compressions
-
baseBlock
-
-
Constructor Details
-
FinishableMapItemCompressionSequence
public FinishableMapItemCompressionSequence(net.minecraft.world.item.ItemStack baseItem)
-
-
Method Details
-
add
- Parameters:
compression-- Returns:
- Whether the Compression could be successfully added (didn't introduce a circular sequence)
-
getBaseItem
public net.minecraft.world.item.ItemStack getBaseItem()Description copied from interface:IItemCompressionSequenceGet a copy of the least-compressed Item (Stack) in the sequence.- Specified by:
getBaseItemin interfaceIItemCompressionSequence- Returns:
- ItemStack of count
1
-
getAllItems
Description copied from interface:IItemCompressionSequenceGet the ordered list of all Item (Stacks) in this sequence.- Specified by:
getAllItemsin interfaceIItemCompressionSequence- Returns:
- Non-
nulllist of ItemStacks of count1
-
getAllCompressions
Description copied from interface:IItemCompressionSequenceAn ordered list ofIItemCompressions, with thecountsrelative to the Item before (i.e. not relative to thebase Item, except for the first compression).- Specified by:
getAllCompressionsin interfaceIItemCompressionSequence- Returns:
- Non-
nulllist ofIItemCompressions
-
getEquivalentBaseItems
public org.apache.commons.lang3.math.Fraction getEquivalentBaseItems(net.minecraft.world.item.ItemStack stack) Description copied from interface:IItemCompressionSequenceGet the number ofbase Itemsequivalent to the given Item Stack.- Specified by:
getEquivalentBaseItemsin interfaceIItemCompressionSequence- 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
public double getEquivalentBaseItems(net.minecraft.world.item.ItemStack stack, double count) Description copied from interface:IItemCompressionSequenceGet the number ofbase Itemsa given amount of the given Item.- Specified by:
getEquivalentBaseItemsin interfaceIItemCompressionSequence- Parameters:
stack- The count of this Stack is ignoredcount-- Returns:
0if the Item (considering its Components) are not part of this sequence
-
getEquivalentBaseItems
public org.apache.commons.lang3.math.Fraction getEquivalentBaseItems(int item) Description copied from interface:IItemCompressionSequence- Specified by:
getEquivalentBaseItemsin interfaceIItemCompressionSequence- Parameters:
item-- Returns:
nullifitemis outside the bounds of the number of Items in this sequence.- See Also:
-
getBaseBlock
Description copied from interface:IItemCompressionSequenceGet the least-compressed Item which is a BlockItem.- Specified by:
getBaseBlockin interfaceIItemCompressionSequence- 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)
-
checkToAddBaseBlock
protected void checkToAddBaseBlock(net.minecraft.world.item.ItemStack stack) -
finish
-