Class StackList
java.lang.Object
com.minecolonies.api.colony.requestsystem.requestable.StackList
- All Implemented Interfaces:
IConcreteDeliverable,IDeliverable,INonExhaustiveDeliverable,IRequestable,IRetryable
Deliverable that can only be fulfilled by a single stack with a given minimal amount of items matching one of a list of stacks.
-
Constructor Summary
ConstructorsConstructorDescriptionStackList(@NotNull List<net.minecraft.world.item.ItemStack> stacks, boolean matchMeta, boolean matchNBT, boolean matchOreDic, @NotNull net.minecraft.world.item.ItemStack result, String description, int count, int minCount, int leftOver) Create a Stacks deliverable.Create a Stacks deliverable.StackList(@NotNull List<net.minecraft.world.item.ItemStack> stacks, String description, int count, int minCount) Create a Stacks deliverable.StackList(@NotNull List<net.minecraft.world.item.ItemStack> stacks, String description, int count, int minCount, int leftOver) Create a Stacks deliverable.StackList(@NotNull net.minecraft.tags.TagKey<net.minecraft.world.item.Item> tag, @NotNull net.minecraft.server.level.ServerLevel level, String description, int count, int minCount, int leftOver) -
Method Summary
Modifier and TypeMethodDescriptioncopyWithCount(int newCount) Creates a new instance of this requestable with the given count.static StackListdeserialize(IFactoryController controller, net.minecraft.nbt.CompoundTag compound) Deserialize the deliverable.static StackListdeserialize(IFactoryController controller, net.minecraft.network.FriendlyByteBuf buffer) Deserialize the deliverable.booleanintgetCount()Method called to get the amount of items that need to be in the stack.Getter for the display description of the list.intGet the amount that is supposed to be kept left over at the warehouse.intMethod called to get the minimum amount required to fulfill this request.List<net.minecraft.world.item.ItemStack>Get a list of concrete items requested by this deliverable@NotNull net.minecraft.world.item.ItemStackMethod to get the result of the delivery.@NotNull List<net.minecraft.world.item.ItemStack>Set<com.google.common.reflect.TypeToken<?>>Get the super classes associated to this request type.inthashCode()booleanmatches(@NotNull net.minecraft.world.item.ItemStack stack) Method called to check if a given stack matches this deliverable.static net.minecraft.nbt.CompoundTagserialize(IFactoryController controller, StackList input) Serialize the deliverable.static voidserialize(IFactoryController controller, net.minecraft.network.FriendlyByteBuf buffer, StackList input) Serialize the deliverable.voidsetResult(@NotNull net.minecraft.world.item.ItemStack result) Method to set the result of a delivery.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.minecolonies.api.colony.requestsystem.requestable.IDeliverable
canBeResolvedByBuilding
-
Constructor Details
-
StackList
public StackList(@NotNull @NotNull List<net.minecraft.world.item.ItemStack> stacks, String description, int count) Create a Stacks deliverable.- Parameters:
stacks- the required stacks.description- the description.count- the count.
-
StackList
public StackList(@NotNull @NotNull List<net.minecraft.world.item.ItemStack> stacks, String description, int count, int minCount) Create a Stacks deliverable.- Parameters:
stacks- the required stacks.description- the description.count- the count.minCount- the min count.
-
StackList
public StackList(@NotNull @NotNull List<net.minecraft.world.item.ItemStack> stacks, String description, int count, int minCount, int leftOver) Create a Stacks deliverable.- Parameters:
stacks- the required stacks.description- the description.count- the count.minCount- the min count.leftOver- the amount to be left over.
-
StackList
public StackList(@NotNull @NotNull List<net.minecraft.world.item.ItemStack> stacks, boolean matchMeta, boolean matchNBT, boolean matchOreDic, @NotNull @NotNull net.minecraft.world.item.ItemStack result, String description, int count, int minCount, int leftOver) Create a Stacks deliverable.- Parameters:
stacks- the required stacks.matchMeta- if meta has to be matched.matchNBT- if NBT has to be matched.matchOreDic- if the oredict has to be matched.result- the result stack.description- the description.count- the count.minCount- the min count.leftOver- the left over amount.
-
StackList
public StackList(@NotNull @NotNull net.minecraft.tags.TagKey<net.minecraft.world.item.Item> tag, @NotNull @NotNull net.minecraft.server.level.ServerLevel level, String description, int count, int minCount, int leftOver)
-
-
Method Details
-
serialize
public static net.minecraft.nbt.CompoundTag serialize(IFactoryController controller, StackList input) Serialize the deliverable.- Parameters:
controller- the controller.input- the input.- Returns:
- the compound.
-
deserialize
public static StackList deserialize(IFactoryController controller, net.minecraft.nbt.CompoundTag compound) Deserialize the deliverable.- Parameters:
controller- the controller.compound- the compound.- Returns:
- the deliverable.
-
serialize
public static void serialize(IFactoryController controller, net.minecraft.network.FriendlyByteBuf buffer, StackList input) Serialize the deliverable.- Parameters:
controller- the controller.buffer- the the buffer to write to.input- the input to serialize.
-
deserialize
public static StackList deserialize(IFactoryController controller, net.minecraft.network.FriendlyByteBuf buffer) Deserialize the deliverable.- Parameters:
controller- the controller.buffer- the buffer to read.- Returns:
- the deliverable.
-
matches
public boolean matches(@NotNull @NotNull net.minecraft.world.item.ItemStack stack) Description copied from interface:IDeliverableMethod called to check if a given stack matches this deliverable. The first stack that returns true from this method is returned as a Deliverable.- Specified by:
matchesin interfaceIDeliverable- Parameters:
stack- The stack to test.- Returns:
- true when the stack matches. False when not.
-
getMinimumCount
public int getMinimumCount()Description copied from interface:IDeliverableMethod called to get the minimum amount required to fulfill this request.- Specified by:
getMinimumCountin interfaceIDeliverable- Returns:
- the minimum amount.
-
getCount
public int getCount()Description copied from interface:IDeliverableMethod called to get the amount of items that need to be in the stack.- Specified by:
getCountin interfaceIDeliverable- Returns:
- The amount of items.
-
getLeftOver
public int getLeftOver()Description copied from interface:INonExhaustiveDeliverableGet the amount that is supposed to be kept left over at the warehouse.- Specified by:
getLeftOverin interfaceINonExhaustiveDeliverable- Returns:
- the amount.
-
getStacks
-
setResult
public void setResult(@NotNull @NotNull net.minecraft.world.item.ItemStack result) Description copied from interface:IDeliverableMethod to set the result of a delivery.- Specified by:
setResultin interfaceIDeliverable- Parameters:
result- The result of the delivery.
-
copyWithCount
Description copied from interface:IDeliverableCreates a new instance of this requestable with the given count.- Specified by:
copyWithCountin interfaceIDeliverable- Parameters:
newCount- The new requestable, with the requested count.- Returns:
- the deliverable.
-
getResult
@NotNull public @NotNull net.minecraft.world.item.ItemStack getResult()Description copied from interface:IDeliverableMethod to get the result of the delivery.- Specified by:
getResultin interfaceIDeliverable- Returns:
- The result of the delivery.
-
equals
-
hashCode
public int hashCode() -
getDescription
Getter for the display description of the list.- Returns:
- the description.
-
getRequestedItems
Description copied from interface:IConcreteDeliverableGet a list of concrete items requested by this deliverable- Specified by:
getRequestedItemsin interfaceIConcreteDeliverable- Returns:
-
getSuperClasses
Description copied from interface:IRequestableGet the super classes associated to this request type.- Specified by:
getSuperClassesin interfaceIRequestable- Returns:
- the type.
-