Class BotanyPotRecipe
java.lang.Object
net.darkhax.botanypots.common.api.data.recipes.BotanyPotRecipe
- All Implemented Interfaces:
net.minecraft.world.item.crafting.Recipe<BotanyPotContext>
- Direct Known Subclasses:
Crop,Fertilizer,PotInteraction,Soil
public abstract class BotanyPotRecipe
extends Object
implements net.minecraft.world.item.crafting.Recipe<BotanyPotContext>
The base class for all recipes that use a botany pot.
-
Field Summary
Fields inherited from interface net.minecraft.world.item.crafting.Recipe
CODEC, STREAM_CODEC -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull net.minecraft.world.item.ItemStackassemble(@NotNull BotanyPotContext input, net.minecraft.core.HolderLookup.Provider provider) booleancanCraftInDimensions(int width, int height) abstract booleancouldMatch(net.minecraft.world.item.ItemStack candidate, BotanyPotContext context, net.minecraft.world.level.Level level) Tests if the recipe is valid for the current context.@NotNull net.minecraft.world.item.ItemStackgetResultItem(@NotNull net.minecraft.core.HolderLookup.Provider provider) voidhoverTooltip(net.minecraft.world.item.ItemStack stack, BotanyPotContext context, net.minecraft.world.level.Level level, Consumer<net.minecraft.network.chat.Component> tooltipLines) Populates a tooltip when the item is hovered in a botany pot.booleanstatic <T extends net.minecraft.world.item.crafting.Recipe<?>>
com.mojang.serialization.Codec<T> recipeCodec(Supplier<net.minecraft.world.item.crafting.RecipeType<T>> recipeType) Creates a codec for a recipe of a specific type.static <T extends net.minecraft.world.item.crafting.Recipe<?>>
net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, T> recipeStream(Supplier<net.minecraft.world.item.crafting.RecipeType<T>> recipeType) Creates a stream codec for a recipe of a specific type.booleanMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.world.item.crafting.Recipe
getGroup, getIngredients, getRemainingItems, getSerializer, getToastSymbol, getType, isIncomplete, matches
-
Constructor Details
-
BotanyPotRecipe
public BotanyPotRecipe()
-
-
Method Details
-
couldMatch
public abstract boolean couldMatch(net.minecraft.world.item.ItemStack candidate, BotanyPotContext context, net.minecraft.world.level.Level level) Tests if the recipe is valid for the current context.- Parameters:
candidate- The item to test.context- The current context.level- The current game level.- Returns:
- If the recipe is valid.
-
assemble
@NotNull public @NotNull net.minecraft.world.item.ItemStack assemble(@NotNull @NotNull BotanyPotContext input, @NotNull net.minecraft.core.HolderLookup.Provider provider) - Specified by:
assemblein interfacenet.minecraft.world.item.crafting.Recipe<BotanyPotContext>
-
getResultItem
@NotNull public @NotNull net.minecraft.world.item.ItemStack getResultItem(@NotNull net.minecraft.core.HolderLookup.Provider provider) - Specified by:
getResultItemin interfacenet.minecraft.world.item.crafting.Recipe<BotanyPotContext>
-
canCraftInDimensions
public boolean canCraftInDimensions(int width, int height) - Specified by:
canCraftInDimensionsin interfacenet.minecraft.world.item.crafting.Recipe<BotanyPotContext>
-
isSpecial
public boolean isSpecial()- Specified by:
isSpecialin interfacenet.minecraft.world.item.crafting.Recipe<BotanyPotContext>
-
showNotification
public boolean showNotification()- Specified by:
showNotificationin interfacenet.minecraft.world.item.crafting.Recipe<BotanyPotContext>
-
hoverTooltip
public void hoverTooltip(net.minecraft.world.item.ItemStack stack, BotanyPotContext context, net.minecraft.world.level.Level level, Consumer<net.minecraft.network.chat.Component> tooltipLines) Populates a tooltip when the item is hovered in a botany pot.- Parameters:
stack- The ItemStack being hovered.context- The context of the current situation.level- The current game level.tooltipLines- The list of tooltips being displayed.
-
recipeCodec
public static <T extends net.minecraft.world.item.crafting.Recipe<?>> com.mojang.serialization.Codec<T> recipeCodec(Supplier<net.minecraft.world.item.crafting.RecipeType<T>> recipeType) Creates a codec for a recipe of a specific type.- Type Parameters:
T- The type of the recipe.- Parameters:
recipeType- The type of recipe to serialize.- Returns:
- A codec that serializes recipes of a given type.
-
recipeStream
public static <T extends net.minecraft.world.item.crafting.Recipe<?>> net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,T> recipeStream(Supplier<net.minecraft.world.item.crafting.RecipeType<T>> recipeType) Creates a stream codec for a recipe of a specific type.- Type Parameters:
T- A stream codec that serializes recipes of a given type.- Parameters:
recipeType- The type of recipe to serialize.- Returns:
- The type of the recipe.
-