Interface IFruit
- All Superinterfaces:
IProductProducer,IRegistryAlleleValue,ISpecialtyProducer
Provides all information that is needed to spawn a fruit leaves / pod block in the world.
-
Method Summary
Modifier and TypeMethodDescriptionintgetColour(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.intreturn the color to use for decorative leaves.default net.minecraft.resources.ResourceLocationfloatgetFruitChance(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>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 onintDeprecated.net.minecraft.resources.ResourceLocationgetSprite(IGenome genome, net.minecraft.world.level.BlockGetter world, net.minecraft.core.BlockPos pos, int ripeningTime) booleanDetermines if fruit block of this provider is considered a leaf block.booleanbooleantrySpawnFruitBlock(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
getProductsMethods 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 togetRipeningPeriod().
-
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
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.UsegetSpecialties()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
- Specified by:
getSpecialtiesin interfaceISpecialtyProducer- 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 togetRipeningPeriod().
-
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 onTreeChromosomes.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
-
getSpecialties()instead.