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

public class BasicSoil extends Soil implements CacheableRecipe
  • Field Details

    • CODEC

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

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

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

  • Method Details

    • getProperties

      public BasicSoil.Properties getProperties()
    • 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.
    • getGrowthModifier

      public float getGrowthModifier(@NotNull @NotNull BotanyPotContext context, @NotNull @NotNull net.minecraft.world.level.Level level)
      Description copied from class: Soil
      Gets the modifier to apply to the crop growth rate.
      Specified by:
      getGrowthModifier in class Soil
      Parameters:
      context - The current context.
      level - The current game level.
      Returns:
      The growth modifier of the soil.
    • getLightLevel

      public int getLightLevel(@NotNull @NotNull BotanyPotContext context, @NotNull @NotNull net.minecraft.world.level.Level level)
      Description copied from class: Soil
      Gets the light level emitted by the soil.
      Specified by:
      getLightLevel in class Soil
      Parameters:
      context - The current context.
      level - The current game level.
      Returns:
      The light level emitted by the soil.
    • getDisplay

      public Display getDisplay(BotanyPotContext context, @NotNull @NotNull net.minecraft.world.level.Level level)
      Description copied from class: Soil
      Gets the display for the soil.
      Specified by:
      getDisplay in class Soil
      Parameters:
      context - The current context.
      level - The current game level.
      Returns:
      The display for the soil.
    • getSerializer

      @NotNull public @NotNull net.minecraft.world.item.crafting.RecipeSerializer<?> getSerializer()
      Specified by:
      getSerializer in interface net.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)
      Description copied from class: BotanyPotRecipe
      Populates a tooltip when the item is hovered in a botany pot.
      Overrides:
      hoverTooltip in class BotanyPotRecipe
      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.
    • 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.
    • getYieldModifier

      public float getYieldModifier(BotanyPotContext context, net.minecraft.world.level.Level level)
      Description copied from class: Soil
      Gets a modifier that will be added to the chance that a crop will drop items when harvested. If the chance exceeds 100% additional rolls can happen.
      Overrides:
      getYieldModifier in class Soil
      Parameters:
      context - The context of the crop being grown.
      level - The game level this is happening in.
      Returns:
      The drop chance modifier to add to the base chance.