Interface BotanyPotContext
- All Superinterfaces:
net.minecraft.world.item.crafting.RecipeInput
- All Known Implementing Classes:
BlockEntityContext,DisplayContext
public interface BotanyPotContext
extends net.minecraft.world.item.crafting.RecipeInput
Provides context for recipes related to botany pots.
-
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.world.level.storage.loot.LootParamscreateLootParams(@Nullable net.minecraft.world.level.block.state.BlockState state) Creates loot table parameters for generating loot from a loot table.net.minecraft.world.item.ItemStackGets the item in the harvest tool slot.net.minecraft.world.item.ItemStackGets the item used by the player if one was used.@Nullable net.minecraft.world.entity.player.PlayerGets the relevant player if one is available.intDetermines the total amount of growth ticks required for the crop to fully mature based on the current conditions.net.minecraft.world.item.ItemStackGets the item in the seed slot.net.minecraft.world.item.ItemStackGets the item in the soil slot.booleanDetermines if the action is happening on the server thread.voidrunFunction(net.minecraft.resources.ResourceLocation functionId) Runs an MCFunction file based on the provided ID.Methods inherited from interface net.minecraft.world.item.crafting.RecipeInput
getItem, isEmpty, size
-
Method Details
-
getSoilItem
net.minecraft.world.item.ItemStack getSoilItem()Gets the item in the soil slot.- Returns:
- The item in the soil slot.
-
getSeedItem
net.minecraft.world.item.ItemStack getSeedItem()Gets the item in the seed slot.- Returns:
- The item in the seed slot.
-
getHarvestItem
net.minecraft.world.item.ItemStack getHarvestItem()Gets the item in the harvest tool slot. This is not the same as the players held item.- Returns:
- The item in the harvest tool slot.
-
createLootParams
net.minecraft.world.level.storage.loot.LootParams createLootParams(@Nullable @Nullable net.minecraft.world.level.block.state.BlockState state) Creates loot table parameters for generating loot from a loot table. Loot tables only exist on the server thread and parameters can not be constructed on a client thread.- Parameters:
state- The state for the block_state parameter. Sometimes it is necessary to use a different block to get te right loot table results. For example, the wheat loot table checks the block id and age.- Returns:
- Loot parameters based on the current context.
-
runFunction
void runFunction(net.minecraft.resources.ResourceLocation functionId) Runs an MCFunction file based on the provided ID. Functions can only be executed on the server thread, trying to do this on a client thread will cause issues.- Parameters:
functionId- The ID of the MCFunction to run.
-
getPlayer
@Nullable @Nullable net.minecraft.world.entity.player.Player getPlayer()Gets the relevant player if one is available.- Returns:
- The relevant player if one is available.
-
getInteractionItem
net.minecraft.world.item.ItemStack getInteractionItem()Gets the item used by the player if one was used.- Returns:
- The item the player used to interact.
-
getRequiredGrowthTicks
int getRequiredGrowthTicks()Determines the total amount of growth ticks required for the crop to fully mature based on the current conditions.- Returns:
- The total amount of growth ticks required to grow the crop.
-
isServerThread
boolean isServerThread()Determines if the action is happening on the server thread. It does not matter if the server is integrated or dedicated.- Returns:
- If the action is happening on a server thread.
-