java.lang.Object
com.minecolonies.api.colony.requestsystem.requestable.RequestTag
All Implemented Interfaces:
IDeliverable, IRequestable, IRetryable

public class RequestTag extends Object implements IDeliverable
Deliverable that can only be fulfilled by a stack whos item is contained in a given tag with a given minimal amount of items.
  • Constructor Summary

    Constructors
    Constructor
    Description
    RequestTag(@NotNull net.minecraft.tags.TagKey<net.minecraft.world.item.Item> tag, int count)
    Create a Tag deliverable.
    RequestTag(@NotNull net.minecraft.tags.TagKey<net.minecraft.world.item.Item> tag, int count, int minCount)
    Create a Tag deliverable.
    RequestTag(@NotNull net.minecraft.tags.TagKey<net.minecraft.world.item.Item> tag, @NotNull net.minecraft.world.item.ItemStack result, int count, int minCount)
    Create a Tag deliverable.
  • Method Summary

    Modifier and Type
    Method
    Description
    copyWithCount(int newCount)
    Creates a new instance of this requestable with the given count.
    static RequestTag
    deserialize(IFactoryController controller, net.minecraft.network.RegistryFriendlyByteBuf buffer)
     
    static RequestTag
    deserialize(net.minecraft.core.HolderLookup.Provider provider, IFactoryController controller, net.minecraft.nbt.CompoundTag compound)
    Deserialize the deliverable.
    boolean
     
    int
    Method called to get the amount of items that need to be in the stack.
    int
    Method called to get the minimum amount required to fulfill this request.
    @NotNull net.minecraft.world.item.ItemStack
    Method to get the result of the delivery.
    Set<com.google.common.reflect.TypeToken<?>>
    Get the super classes associated to this request type.
    @NotNull net.minecraft.tags.TagKey<net.minecraft.world.item.Item>
     
    int
     
    boolean
    matches(@NotNull net.minecraft.world.item.ItemStack stack)
    Method called to check if a given stack matches this deliverable.
    static void
    serialize(IFactoryController controller, net.minecraft.network.RegistryFriendlyByteBuf buffer, RequestTag input)
     
    static net.minecraft.nbt.CompoundTag
    serialize(net.minecraft.core.HolderLookup.Provider provider, IFactoryController controller, RequestTag input)
    Serialize the deliverable.
    void
    setResult(@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, wait

    Methods inherited from interface com.minecolonies.api.colony.requestsystem.requestable.IDeliverable

    canBeResolvedByBuilding
  • Constructor Details

    • RequestTag

      public RequestTag(@NotNull @NotNull net.minecraft.tags.TagKey<net.minecraft.world.item.Item> tag, int count)
      Create a Tag deliverable.
      Parameters:
      tag - the required containing tag.
      count - the count.
    • RequestTag

      public RequestTag(@NotNull @NotNull net.minecraft.tags.TagKey<net.minecraft.world.item.Item> tag, int count, int minCount)
      Create a Tag deliverable.
      Parameters:
      tag - the required containing tag.
      count - the count.
      minCount - the min count.
    • RequestTag

      public RequestTag(@NotNull @NotNull net.minecraft.tags.TagKey<net.minecraft.world.item.Item> tag, @NotNull @NotNull net.minecraft.world.item.ItemStack result, int count, int minCount)
      Create a Tag deliverable.
      Parameters:
      tag - the required containing tag.
      result - the result stack.
      count - the count.
      minCount - the min count.
  • Method Details

    • matches

      public boolean matches(@NotNull @NotNull net.minecraft.world.item.ItemStack stack)
      Method 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:
      matches in interface IDeliverable
      Parameters:
      stack - The stack to test.
      Returns:
      true when the stack matches. False when not.
    • getCount

      public int getCount()
      Method called to get the amount of items that need to be in the stack.
      Specified by:
      getCount in interface IDeliverable
      Returns:
      The amount of items.
    • getMinimumCount

      public int getMinimumCount()
      Method called to get the minimum amount required to fulfill this request.
      Specified by:
      getMinimumCount in interface IDeliverable
      Returns:
      the minimum amount.
    • getResult

      @NotNull public @NotNull net.minecraft.world.item.ItemStack getResult()
      Method to get the result of the delivery.
      Specified by:
      getResult in interface IDeliverable
      Returns:
      The result of the delivery.
    • getTag

      @NotNull public @NotNull net.minecraft.tags.TagKey<net.minecraft.world.item.Item> getTag()
    • setResult

      public void setResult(@NotNull @NotNull net.minecraft.world.item.ItemStack result)
      Method to set the result of a delivery.
      Specified by:
      setResult in interface IDeliverable
      Parameters:
      result - The result of the delivery.
    • copyWithCount

      public IDeliverable copyWithCount(int newCount)
      Creates a new instance of this requestable with the given count.
      Specified by:
      copyWithCount in interface IDeliverable
      Parameters:
      newCount - The new requestable, with the requested count.
      Returns:
      the deliverable.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • serialize

      public static net.minecraft.nbt.CompoundTag serialize(@NotNull net.minecraft.core.HolderLookup.Provider provider, IFactoryController controller, RequestTag input)
      Serialize the deliverable.
      Parameters:
      controller - the controller.
      input - the input.
      Returns:
      the compound.
    • serialize

      public static void serialize(IFactoryController controller, net.minecraft.network.RegistryFriendlyByteBuf buffer, RequestTag input)
    • deserialize

      public static RequestTag deserialize(IFactoryController controller, net.minecraft.network.RegistryFriendlyByteBuf buffer)
    • deserialize

      public static RequestTag deserialize(@NotNull net.minecraft.core.HolderLookup.Provider provider, IFactoryController controller, net.minecraft.nbt.CompoundTag compound)
      Deserialize the deliverable.
      Parameters:
      controller - the controller.
      compound - the compound.
      Returns:
      the deliverable.
    • getSuperClasses

      public Set<com.google.common.reflect.TypeToken<?>> getSuperClasses()
      Description copied from interface: IRequestable
      Get the super classes associated to this request type.
      Specified by:
      getSuperClasses in interface IRequestable
      Returns:
      the type.