Class BasicCrop

java.lang.Object
net.darkhax.bookshelf.api.data.recipes.RecipeBase<C>
net.darkhax.bookshelf.api.data.recipes.RecipeBaseData<net.minecraft.world.Container>
net.darkhax.botanypots.data.recipes.crop.Crop
net.darkhax.botanypots.data.recipes.crop.BasicCrop
All Implemented Interfaces:
net.minecraft.world.item.crafting.Recipe<net.minecraft.world.Container>

public class BasicCrop extends Crop
  • Field Details

    • seed

      protected net.minecraft.world.item.crafting.Ingredient seed
      The ingredient used for the crop's seed.
    • soilCategories

      protected Set<String> soilCategories
      An array of valid soil categories.
    • growthTicks

      protected int growthTicks
      The amount of ticks for the crop to grow under normal conditions.
    • results

      protected List<HarvestEntry> results
      An array of things the crop can drop.
    • displayStates

      protected List<DisplayState> displayStates
      The BlockState to render for the crop.
    • lightLevel

      protected int lightLevel
      The light level of the soil when placed in the crop. If this is not specified the light level of the first block in displayStates will be used.
  • Constructor Details

    • BasicCrop

      public BasicCrop(net.minecraft.resources.ResourceLocation id, net.minecraft.world.item.crafting.Ingredient seed, Set<String> soilCategories, int growthTicks, List<HarvestEntry> results, List<DisplayState> displayStates, int lightLevel)
  • Method Details

    • matchesLookup

      public boolean matchesLookup(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot, net.minecraft.world.item.ItemStack placedStack)
      Description copied from class: Crop
      Tests if the crop matches the provided placement context. This is used when looking up crops from their ItemStack and determines which soil they represent.
      Specified by:
      matchesLookup in class Crop
      Parameters:
      level - The current world level that the crop is in.
      pos - The position of the pot.
      pot - The pot being used.
      placedStack - The ItemStack being placed.
      Returns:
      Whether the crop matches the lookup context or not.
    • getGrowthTicks

      public int getGrowthTicks(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot, @Nullable Soil soil)
      Description copied from class: Crop
      Gets the amount of growth ticks required to grow the crop.

      The soil parameter may be null in some circumstances. This indicates that the soil is not available in the current context, such as generating tooltip information.

      This code is not responsible for applying the growth modifier of the soil. This is handled externally. Implementations of this method should not factor this in themselves.

      Specified by:
      getGrowthTicks in class Crop
      Parameters:
      level - The current world level that the crop is in.
      pos - The position that the pot is at.
      pot - The pot growing the crop.
      soil - The soil that the crop is growing in.
      Returns:
      The amount of growth ticks required to grow the crop.
    • getLightLevel

      public int getLightLevel(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot)
      Description copied from class: Crop
      Gets the light level emitted by the crop when placed in a pot.
      Specified by:
      getLightLevel in class Crop
      Parameters:
      level - The current world level that the crop is in.
      pos - The position that the pot is at.
      pot - The pot growing the crop.
      Returns:
      The light level for the crop within the pot. This should be a value between 0 and 15.
    • canGrowInSoil

      public boolean canGrowInSoil(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot, Soil soil)
      Description copied from class: Crop
      Determines if the crop can grow in a given soil.
      Specified by:
      canGrowInSoil in class Crop
      Parameters:
      level - The current world level that the crop is in.
      pos - The position of the pot.
      pot - The pot growing the crop.
      soil - The soil the crop is being grown in.
      Returns:
      Whether the crop can grow in the soil.
    • getCategories

      public Set<String> getCategories(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot)
      Description copied from class: Crop
      Gets a set of soil categories the crop can grow in.
      Specified by:
      getCategories in class Crop
      Parameters:
      level - The current world level that the crop is in.
      pos - The position of the pot.
      pot - The pot growing the crop.
      Returns:
      A set of soil categories that the crop can grow in.
    • getDisplayState

      public List<DisplayState> getDisplayState(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot)
      Description copied from class: Crop
      Gets the display state of the crop. This will be used to render the crop in the pot.
      Specified by:
      getDisplayState in class Crop
      Parameters:
      level - The current world level that the pot is in.
      pos - The position that the pot is at.
      pot - The pot growing the crop.
      Returns:
      A display state to render inside the pot.
    • generateDrops

      public List<net.minecraft.world.item.ItemStack> generateDrops(Random rng, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, BlockEntityBotanyPot pot)
      Description copied from class: Crop
      Generates a new list of drops to spawn when the crop has been harvested.
      Specified by:
      generateDrops in class Crop
      level - The current world level that the pot is in.
      pos - The position of the pot.
      pot - The pot growing the crop.
      Returns:
      A list of drops to spawn when the crop is harvested.
    • getSerializer

      public net.minecraft.world.item.crafting.RecipeSerializer<?> getSerializer()
    • getSeed

      public net.minecraft.world.item.crafting.Ingredient getSeed()
    • getSoilCategories

      public Set<String> getSoilCategories()
    • getGrowthTicks

      public int getGrowthTicks()
    • getResults

      public List<HarvestEntry> getResults()
    • getDisplayStates

      public List<DisplayState> getDisplayStates()
    • getLightLevel

      public int getLightLevel()