Package net.darkhax.botanypots
Class BotanyPotHelper
java.lang.Object
net.darkhax.botanypots.BotanyPotHelper
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.darkhax.bookshelf.api.function.CachedSupplier<net.minecraft.world.item.crafting.RecipeSerializer<?>>static final net.darkhax.bookshelf.api.function.CachedSupplier<net.minecraft.world.item.crafting.RecipeSerializer<?>>static final net.darkhax.bookshelf.api.function.CachedSupplier<net.minecraft.world.item.crafting.RecipeType<Crop>>static final BotanyPotEventDispatcherstatic final net.darkhax.bookshelf.api.function.CachedSupplier<net.minecraft.world.item.crafting.RecipeType<Fertilizer>>static final net.darkhax.bookshelf.api.function.CachedSupplier<net.minecraft.world.item.crafting.RecipeType<PotInteraction>>static final net.darkhax.bookshelf.api.function.CachedSupplier<net.minecraft.world.item.crafting.RecipeSerializer<?>>static final net.darkhax.bookshelf.api.function.CachedSupplier<net.minecraft.world.item.crafting.RecipeSerializer<?>>static final net.darkhax.bookshelf.api.function.CachedSupplier<net.minecraft.world.item.crafting.RecipeType<Soil>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancanCropGrow(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot, Soil soil, Crop crop) Tests if a crop can grow in the specified growing condition.sstatic CropfindCrop(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot, net.minecraft.world.item.ItemStack stack) Attempts to find a crop entry in the game recipe manager.static FertilizerfindFertilizer(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand, net.minecraft.world.item.ItemStack heldStack, BlockEntityBotanyPot pot) Attempts to find a fertilizer based on the provided context.static PotInteractionfindPotInteraction(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand, net.minecraft.world.item.ItemStack heldStack, BlockEntityBotanyPot pot) Attempts to find a pot interaction based on the provided context.static SoilfindSoil(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot, net.minecraft.world.item.ItemStack soilStack) Attempts to find a soil entry in the game recipe manager.static List<net.minecraft.world.item.ItemStack>generateDrop(Random rng, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot, Crop crop) Generates the harvested drops for a crop.static <C extends net.minecraft.world.Container,T extends net.minecraft.world.item.crafting.Recipe<C>>
List<T>getAllRecipes(net.minecraft.world.item.crafting.RecipeManager manager, net.minecraft.world.item.crafting.RecipeType<T> type) static intgetRequiredGrowthTicks(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot, Crop crop, Soil soil) Calculates the amount of growth ticks required for a crop to be considered fully grown.
-
Field Details
-
SOIL_TYPE
public static final net.darkhax.bookshelf.api.function.CachedSupplier<net.minecraft.world.item.crafting.RecipeType<Soil>> SOIL_TYPE -
SOIL_SERIALIZER
public static final net.darkhax.bookshelf.api.function.CachedSupplier<net.minecraft.world.item.crafting.RecipeSerializer<?>> SOIL_SERIALIZER -
CROP_TYPE
public static final net.darkhax.bookshelf.api.function.CachedSupplier<net.minecraft.world.item.crafting.RecipeType<Crop>> CROP_TYPE -
CROP_SERIALIZER
public static final net.darkhax.bookshelf.api.function.CachedSupplier<net.minecraft.world.item.crafting.RecipeSerializer<?>> CROP_SERIALIZER -
POT_INTERACTION_TYPE
public static final net.darkhax.bookshelf.api.function.CachedSupplier<net.minecraft.world.item.crafting.RecipeType<PotInteraction>> POT_INTERACTION_TYPE -
SIMPLE_POT_INTERACTION_SERIALIZER
public static final net.darkhax.bookshelf.api.function.CachedSupplier<net.minecraft.world.item.crafting.RecipeSerializer<?>> SIMPLE_POT_INTERACTION_SERIALIZER -
FERTILIZER_TYPE
public static final net.darkhax.bookshelf.api.function.CachedSupplier<net.minecraft.world.item.crafting.RecipeType<Fertilizer>> FERTILIZER_TYPE -
BASIC_FERTILIZER_SERIALIZER
public static final net.darkhax.bookshelf.api.function.CachedSupplier<net.minecraft.world.item.crafting.RecipeSerializer<?>> BASIC_FERTILIZER_SERIALIZER -
EVENT_DISPATCHER
-
-
Constructor Details
-
BotanyPotHelper
public BotanyPotHelper()
-
-
Method Details
-
getRequiredGrowthTicks
public static int getRequiredGrowthTicks(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot, @Nullable Crop crop, @Nullable Soil soil) Calculates the amount of growth ticks required for a crop to be considered fully grown.- Parameters:
level- The level of the world that the crop is growing in.pos- The position of the pot growing the crop.pot- The pot growing the crop.crop- The crop being grown.soil- The soil being grown.- Returns:
- The amount of growth ticks required for a crop to be fully grown. A result of -1 indicates that the crop can not grow.
-
canCropGrow
public static boolean canCropGrow(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot, Soil soil, Crop crop) Tests if a crop can grow in the specified growing condition.s- Parameters:
level- The level of the world that the crop is growing in.pos- The position of the pot growing the crop.pot- The pot that the crop is growing in.soil- The soil that the crop is growing in.crop- The crop being grown.- Returns:
- Whether the crop can grow or not.
-
findSoil
@Nullable public static Soil findSoil(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot, net.minecraft.world.item.ItemStack soilStack) Attempts to find a soil entry in the game recipe manager.- Parameters:
level- The level of the world that the soil is being placed.pos- The position of the pot.pot- The pot that the soil would go into.soilStack- The item being used.- Returns:
- A soil that is applicable for the provided context. If no soil is found the result will be null.
-
findCrop
@Nullable public static Crop findCrop(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot, net.minecraft.world.item.ItemStack stack) Attempts to find a crop entry in the game recipe manager.- Parameters:
level- The level of the world that the crop is being placed.pos- The position of the pot.pot- The pot that the crop would go into.stack- The item being used.- Returns:
- A crop that is applicable for the provided context. If no crop is found the result will be null.
-
getAllRecipes
public static <C extends net.minecraft.world.Container,T extends net.minecraft.world.item.crafting.Recipe<C>> List<T> getAllRecipes(net.minecraft.world.item.crafting.RecipeManager manager, net.minecraft.world.item.crafting.RecipeType<T> type) -
findPotInteraction
@Nullable public static PotInteraction findPotInteraction(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand, net.minecraft.world.item.ItemStack heldStack, BlockEntityBotanyPot pot) Attempts to find a pot interaction based on the provided context.- Parameters:
state- The state of the pot being interacted with.world- The world the pot is in.pos- The position of the pot.player- The player interacting with the pot.hand- The hand being used.heldStack- The stack being used.pot- The pot being interacted with.- Returns:
- A pot interaction applicable for the provided context. If no interaction could be found the result will be null.
-
findFertilizer
@Nullable public static Fertilizer findFertilizer(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand, net.minecraft.world.item.ItemStack heldStack, BlockEntityBotanyPot pot) Attempts to find a fertilizer based on the provided context.- Parameters:
state- The state of the pot being interacted with.world- The world the pot is in.pos- The position of the pot.player- The player interacting with the pot.hand- The hand being used.heldStack- The stack being used.pot- The pot being interacted with.- Returns:
- A fertilizer applicable for the provided context. If no fertilizer could be found the result will be null.
-
generateDrop
public static List<net.minecraft.world.item.ItemStack> generateDrop(Random rng, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot, Crop crop) Generates the harvested drops for a crop.- Parameters:
level- The world the pot is in.pos- The position of the pot.pot- The pot being harvested from.crop- The crop being harvested.- Returns:
- A list of drops generated by harvesting the crop.
-