Interface IFruit

All Superinterfaces:
IRegistryAlleleValue

public interface IFruit extends IRegistryAlleleValue
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
     
    default float
    getFruitChance(IGenome genome, net.minecraft.world.level.LevelAccessor level, net.minecraft.core.BlockPos pos)
    The chance that this leaves contains fruits or the chance that a pod block spawns.
    List<net.minecraft.world.item.ItemStack>
    getFruits(IGenome genome, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, 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
    A unmodifiable list that contains all products and their associated drop chances.
    int
     
    A unmodifiable list that contains all specialties and their associated drop chances.
    net.minecraft.resources.ResourceLocation
    getSprite(IGenome genome, net.minecraft.world.level.BlockGetter world, net.minecraft.core.BlockPos pos, int ripeningTime)
     
    boolean
    isFruitLeaf(IGenome genome, net.minecraft.world.level.LevelAccessor level, net.minecraft.core.BlockPos pos)
    Determines if fruit block of this provider is considered a leaf block.
    default void
    registerSprites(net.minecraftforge.client.event.TextureStitchEvent.Pre event)
     
    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.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(IGenome genome, net.minecraft.world.level.LevelAccessor level, net.minecraft.core.BlockPos pos)
      Determines if fruit block of this provider is considered a leaf block.
      Parameters:
      genome - The genome of the tree of the pod / leaves block.
      level - The world in that the pod / leaves block is located.
      pos - The position of the pod / leaves block.
      Returns:
      True if this provider provides a fruit leaf for the given genome at the given position.
    • getFruitChance

      default float getFruitChance(IGenome genome, net.minecraft.world.level.LevelAccessor level, net.minecraft.core.BlockPos pos)
      The chance that this leaves contains fruits or the chance that a pod block spawns.
      Parameters:
      genome - The genome of the tree of the pod / leaves block.
      level -
      Returns:
      The chance that this leaves contains 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.
    • getProducts

      List<IProduct> getProducts()
      A unmodifiable list that contains all products and their associated drop chances.
      Returns:
      A unmodifiable list that contains all products and their associated drop chances.
    • getSpecialty

      List<IProduct> getSpecialty()
      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.
    • getFruits

      List<net.minecraft.world.item.ItemStack> getFruits(IGenome genome, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, 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 repining 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.
    • registerSprites

      default void registerSprites(net.minecraftforge.client.event.TextureStitchEvent.Pre event)
    • getLogTag

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