All Implemented Interfaces:
CacheableRecipe, net.minecraft.world.item.crafting.Recipe<BotanyPotContext>

public class BasicFertilizer extends Fertilizer implements CacheableRecipe
  • Field Details

    • CODEC

      public static final com.mojang.serialization.MapCodec<BasicFertilizer> CODEC
    • STREAM

      public static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,BasicFertilizer> STREAM
    • SERIALIZER

      public static final net.minecraft.world.item.crafting.RecipeSerializer<BasicFertilizer> SERIALIZER
  • Constructor Details

  • Method Details

    • getProperties

      public BasicFertilizer.Properties getProperties()
    • apply

      public void apply(@NotNull @NotNull BotanyPotContext input, @NotNull @NotNull net.minecraft.world.level.Level level)
      Description copied from class: Fertilizer
      Applies the fertilizer to the crop.
      Specified by:
      apply in class Fertilizer
      Parameters:
      input - The context that the fertilizer is being used in.
      level - The current game level.
    • matches

      public boolean matches(@NotNull @NotNull BotanyPotContext input, @NotNull @NotNull net.minecraft.world.level.Level level)
      Specified by:
      matches in interface net.minecraft.world.item.crafting.Recipe<BotanyPotContext>
    • canBeCached

      public boolean canBeCached()
      Description copied from interface: CacheableRecipe
      Determines if recipe can be cached based on the deserialized contents of the recipe. For example, imagine a recipe with an optional list of non-cacheable conditions. If this list is not present or empty, the recipe could be cached when it otherwise could not.
      Specified by:
      canBeCached in interface CacheableRecipe
      Returns:
      If the recipe can be cached.
    • isCacheKey

      public boolean isCacheKey(net.minecraft.world.item.ItemStack stack)
      Description copied from interface: CacheableRecipe
      Determines if a given item would be a valid cache key for this recipe. Recipes can have more than one valid key.

      Implementations should only check intrinsic properties of the stack like the item id, tags, and the type of the item. Properties like data components should not be checked as these are not intrinsic to the item. An ItemStack is only provided in this context because it is needed to test Ingredient.

      Specified by:
      isCacheKey in interface CacheableRecipe
      Parameters:
      stack - The item to test.
      Returns:
      If the item is a valid cache key for this recipe.
    • getSerializer

      @NotNull public @NotNull net.minecraft.world.item.crafting.RecipeSerializer<?> getSerializer()
      Specified by:
      getSerializer in interface net.minecraft.world.item.crafting.Recipe<BotanyPotContext>
    • couldMatch

      public boolean couldMatch(net.minecraft.world.item.ItemStack candidate, BotanyPotContext context, net.minecraft.world.level.Level level)
      Description copied from class: BotanyPotRecipe
      Tests if the recipe is valid for the current context.
      Specified by:
      couldMatch in class BotanyPotRecipe
      Parameters:
      candidate - The item to test.
      context - The current context.
      level - The current game level.
      Returns:
      If the recipe is valid.