Interface IFruit

All Superinterfaces:
IProductProducer, IRegistryAlleleValue, ISpecialtyProducer

public interface IFruit extends IRegistryAlleleValue, IProductProducer, ISpecialtyProducer
Provides all information that is needed to spawn a fruit leaves / pod block in the world.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    getColour(IGenome genome, net.minecraft.world.level.BlockGetter world, net.minecraft.core.BlockPos pos, int ripeningTime)
    Returns the color of the fruit spite based on the ripening time of the fruit.
    int
    return the color to use for decorative leaves.
    default net.minecraft.resources.ResourceLocation
     
    float
    getFruitChance(IGenome genome, net.minecraft.world.level.LevelAccessor level)
    The chance that a tree leaf will spawn with fruits or the chance that a pod fruit spawns.
    List<net.minecraft.world.item.ItemStack>
    getFruits(IGenome genome, net.minecraft.world.level.Level level, int ripeningTime)
    Returns all drops of this block if you harvest it.
    default net.minecraft.tags.TagKey<net.minecraft.world.level.block.Block>
    Tag for the log that a pod fruit is placed on
    int
     
    default List<IProduct>
     
    Deprecated.
    Use getSpecialties() instead.
    net.minecraft.resources.ResourceLocation
    getSprite(IGenome genome, net.minecraft.world.level.BlockGetter world, net.minecraft.core.BlockPos pos, int ripeningTime)
     
    boolean
    Determines if fruit block of this provider is considered a leaf block.
    boolean
     
    boolean
    trySpawnFruitBlock(IGenome genome, net.minecraft.world.level.LevelAccessor world, net.minecraft.util.RandomSource rand, net.minecraft.core.BlockPos pos)
    Tries to spawn a fruit block at the potential position when the tree generates.

    Methods inherited from interface forestry.api.core.IProductProducer

    getProducts

    Methods inherited from interface forestry.api.genetics.alleles.IRegistryAlleleValue

    isDominant
  • Method Details

    • getColour

      int getColour(IGenome genome, net.minecraft.world.level.BlockGetter world, net.minecraft.core.BlockPos pos, int ripeningTime)
      Returns the color of the fruit spite based on the ripening time of the fruit.
      Parameters:
      genome - The genome of the tree of the pod / leaves block.
      ripeningTime - The ripening time of the leaves / pod block. From 0 to getRipeningPeriod().
    • getDecorativeColor

      int getDecorativeColor()
      return the color to use for decorative leaves. Usually the ripe color.
    • isFruitLeaf

      boolean isFruitLeaf()
      Determines if fruit block of this provider is considered a leaf block.
      Returns:
      True if this provider provides a fruit leaf for the given genome at the given position.
    • getFruitChance

      float getFruitChance(IGenome genome, net.minecraft.world.level.LevelAccessor level)
      The chance that a tree leaf will spawn with fruits or the chance that a pod fruit spawns.
      Parameters:
      genome - The genome of the tree of the pod / leaves block.
      level - The world where this is happening.
      Returns:
      The chance that leaves spawns with fruits or the chance that a pod block spawns.
    • getRipeningPeriod

      int getRipeningPeriod()
      Returns:
      How many successful ripening block ticks a fruit needs to be ripe.
    • getSpecialty

      @Deprecated List<IProduct> getSpecialty()
      Deprecated.
      Use getSpecialties() instead.
      A unmodifiable list that contains all specialties and their associated drop chances.
      Returns:
      A unmodifiable list that contains all products and their associated drop chances.
    • getSpecialties

      default List<IProduct> getSpecialties()
      Specified by:
      getSpecialties in interface ISpecialtyProducer
      Returns:
      The list of possible items that this producer can only produce when in a jubilant state.
    • getFruits

      List<net.minecraft.world.item.ItemStack> getFruits(IGenome genome, net.minecraft.world.level.Level level, int ripeningTime)
      Returns all drops of this block if you harvest it.
      Parameters:
      genome - The genome of the tree of the leaves / pod.
      ripeningTime - The ripening time of the block. From 0 to getRipeningPeriod().
    • getSprite

      @Nullable net.minecraft.resources.ResourceLocation getSprite(IGenome genome, net.minecraft.world.level.BlockGetter world, net.minecraft.core.BlockPos pos, int ripeningTime)
      Parameters:
      ripeningTime - Elapsed ripening time for the fruit.
      Returns:
      ResourceLocation of the texture to overlay on the leaf block.
    • getDecorativeSprite

      @Nullable default net.minecraft.resources.ResourceLocation getDecorativeSprite()
    • requiresFruitBlocks

      boolean requiresFruitBlocks()
      Returns:
      true if this fruit provider requires fruit blocks to spawn, false otherwise.
    • trySpawnFruitBlock

      boolean trySpawnFruitBlock(IGenome genome, net.minecraft.world.level.LevelAccessor world, net.minecraft.util.RandomSource rand, net.minecraft.core.BlockPos pos)
      Tries to spawn a fruit block at the potential position when the tree generates. Spawning a fruit has a random chance of success based on TreeChromosomes.SAPPINESS.
      Returns:
      true if a fruit block was spawned, false otherwise.
    • getLogTag

      default net.minecraft.tags.TagKey<net.minecraft.world.level.block.Block> getLogTag()
      Tag for the log that a pod fruit is placed on