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
Provides some basic definitions used by the animal herding AI (and JEI).
-
Field Summary
Fields inherited from class com.minecolonies.api.colony.buildings.modules.AbstractBuildingModule
building, isDirty -
Constructor Summary
ConstructorsConstructorDescriptionAnimalHerdingModule(@NotNull JobEntry jobEntry, @NotNull Predicate<net.minecraft.world.entity.animal.Animal> animalPredicate, @NotNull ItemStorage breedingItem) -
Method Summary
Modifier and TypeMethodDescription@NotNull List<ItemStorage>Gets the item required to breed the animal.@NotNull IJob<?>Gets the herding job associated with this module.@NotNull List<net.minecraft.resources.ResourceLocation>getLootTables(@NotNull net.minecraft.world.entity.animal.Animal animal) Gets a list of loot tables that should be available for drop analysis.@NotNull List<IGenericRecipe>getRecipesForDisplayPurposesOnly(@NotNull net.minecraft.world.entity.animal.Animal animal) Get a list of "recipes" for items obtainable by herding the given animal.Override this method if you want to keep an amount of items in inventory.booleanisCompatible(@NotNull net.minecraft.world.entity.animal.Animal animal) Check if this module handles the particular animal.reservedStacksExcluding(@Nullable IRequest<? extends IDeliverable> excluded) Calculate the number of reserved stacks the resolver can't touch.Methods inherited from class com.minecolonies.api.colony.buildings.modules.AbstractBuildingModule
checkDirty, clearDirty, getBuilding, getProducer, markDirty, setBuilding, setProducerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.minecolonies.api.colony.buildings.modules.IBuildingModule
getBuilding, getProducer, serializeToView, serializeToView, setBuilding, setProducerMethods inherited from interface com.minecolonies.api.util.IHasDirty
checkDirty, clearDirty, markDirtyMethods inherited from interface com.minecolonies.api.colony.buildings.modules.IHasRequiredItemsModule
reservedStacks
-
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
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
Gets the item required to breed the animal.- Returns:
- The animal's preferred breeding item (as a list of alternatives).
-
getLootTables
@NotNull public @NotNull List<net.minecraft.resources.ResourceLocation> 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. viagetRecipesForDisplayPurposesOnly(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, getRequiredItemsAndAmount()Boolean>> Description copied from interface:IHasRequiredItemsModuleOverride 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:
getRequiredItemsAndAmountin interfaceIHasRequiredItemsModule- 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:IHasRequiredItemsModuleCalculate the number of reserved stacks the resolver can't touch.- Specified by:
reservedStacksExcludingin interfaceIHasRequiredItemsModule- 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.
-