Class AnimalHerdingModule

java.lang.Object
com.minecolonies.api.colony.buildings.modules.AbstractBuildingModule
com.minecolonies.core.colony.buildings.modules.AnimalHerdingModule
All Implemented Interfaces:
IBuildingModule, IHasRequiredItemsModule, IHasDirty
Direct Known Subclasses:
BuildingBeekeeper.HerdingModule, BuildingChickenHerder.HerdingModule, BuildingCowboy.HerdingModule, BuildingShepherd.HerdingModule, BuildingStable.HerdingModule

public class AnimalHerdingModule extends AbstractBuildingModule implements IHasRequiredItemsModule
Provides some basic definitions used by the animal herding AI (and JEI).
  • Constructor Details

    • AnimalHerdingModule

      public AnimalHerdingModule(@NotNull @NotNull JobEntry jobEntry, @NotNull @NotNull Predicate<net.minecraft.world.entity.animal.Animal> animalPredicate, @NotNull @NotNull ItemStorage breedingItem)
  • Method Details

    • getHerdingJob

      @NotNull public @NotNull IJob<?> getHerdingJob()
      Gets the herding job associated with this module.
      Returns:
      The job.
    • isCompatible

      public boolean isCompatible(@NotNull @NotNull net.minecraft.world.entity.animal.Animal animal)
      Check if this module handles the particular animal.
      Parameters:
      animal - the animal to check.
      Returns:
      true if so.
    • getBreedingItems

      @NotNull public @NotNull List<ItemStorage> getBreedingItems()
      Gets the item required to breed the animal.
      Returns:
      The animal's preferred breeding item (as a list of alternatives).
    • getLootTables

      public List<net.minecraft.resources.ResourceKey<net.minecraft.world.level.storage.loot.LootTable>> getLootTables(@NotNull @NotNull net.minecraft.world.entity.animal.Animal animal)
      Gets a list of loot tables that should be available for drop analysis. This is not intended for actually generating loot, just for display purposes such as in JEI (e.g. via getRecipesForDisplayPurposesOnly(net.minecraft.world.entity.animal.Animal)).
      Parameters:
      animal - An example animal. (Don't use specific properties of this; it's only for checking type.)
      Returns:
      The list of loot table ids
    • getRequiredItemsAndAmount

      public Map<Predicate<net.minecraft.world.item.ItemStack>,net.minecraft.util.Tuple<Integer,Boolean>> getRequiredItemsAndAmount()
      Description copied from interface: IHasRequiredItemsModule
      Override this method if you want to keep an amount of items in inventory. When the inventory is full, everything get's dumped into the building chest. But you can use this method to hold some stacks back.
      Specified by:
      getRequiredItemsAndAmount in interface IHasRequiredItemsModule
      Returns:
      a list of objects which should be kept.
    • reservedStacksExcluding

      public Map<ItemStorage,Integer> reservedStacksExcluding(@Nullable @Nullable IRequest<? extends IDeliverable> excluded)
      Description copied from interface: IHasRequiredItemsModule
      Calculate the number of reserved stacks the resolver can't touch.
      Specified by:
      reservedStacksExcluding in interface IHasRequiredItemsModule
      Parameters:
      excluded - ignore reservations that would exist for the current request.
      Returns:
      a list of itemstorages.
    • getRecipesForDisplayPurposesOnly

      @NotNull public @NotNull List<IGenericRecipe> getRecipesForDisplayPurposesOnly(@NotNull @NotNull net.minecraft.world.entity.animal.Animal animal)
      Get a list of "recipes" for items obtainable by herding the given animal. This can include loot drops for killing the animal as well as anything else acquired through other means. These are purely for JEI display purposes and don't have to represent actual crafting recipes.
      Parameters:
      animal - An example animal. (Don't use specific properties of this; it's only for checking type.)
      Returns:
      the list of additional display recipes.