Package forestry.api.genetics.pollen
Interface IPollenType<P>
- Type Parameters:
P- The type of pollen
public interface IPollenType<P>
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleancanPollinate(net.minecraft.world.level.LevelAccessor level, net.minecraft.core.BlockPos pos, Object pollinator) Used to determine whether a block can be pollinated or have pollen of this type.net.minecraft.resources.ResourceLocationid()readNbt(net.minecraft.nbt.Tag nbt) Reads a pollen of this type from NBT.tryCollectPollen(net.minecraft.world.level.LevelAccessor level, net.minecraft.core.BlockPos pos, Object pollinator) Tries to collect pollen from a block in the world.booleantryPollinate(net.minecraft.world.level.LevelAccessor level, net.minecraft.core.BlockPos pos, P pollen, Object pollinator) Tries to pollinate the block at the position.
-
Method Details
-
id
net.minecraft.resources.ResourceLocation id()- Returns:
- The unique ID of this pollen type.
-
canPollinate
boolean canPollinate(net.minecraft.world.level.LevelAccessor level, net.minecraft.core.BlockPos pos, @Nullable Object pollinator) Used to determine whether a block can be pollinated or have pollen of this type. Only used by butterflies in base Forestry.- Parameters:
level- The world to find pollen from.pos- The position to check for pollen.pollinator- The individual or player (or something else) transporting the pollen.- Returns:
trueif the target block has pollen of this type.
-
tryCollectPollen
@Nullable IPollen<P> tryCollectPollen(net.minecraft.world.level.LevelAccessor level, net.minecraft.core.BlockPos pos, @Nullable Object pollinator) Tries to collect pollen from a block in the world.- Parameters:
level- The world to try gathering pollen from. Always on the logical server.pos- The position of the block to try collecting pollen from. Always in a loaded chunk.pollinator- The individual or player (or something else) responsible for gathering the pollen.- Returns:
- A new pollen object, or
nullif the block did not have valid pollen for this type.
-
tryPollinate
boolean tryPollinate(net.minecraft.world.level.LevelAccessor level, net.minecraft.core.BlockPos pos, P pollen, @Nullable Object pollinator) Tries to pollinate the block at the position. This method should check whether the pollen is compatible with the target, such as checking if the block holds the same pollen type, and if the two pollens should mix.- Parameters:
level- The world to try pollinating in. Always on the logical server.pos- The position of the block to try pollinating. Always in a loaded chunk.pollen- The pollen to pollinate the block with.pollinator- The individual or player (or something else) responsible for the pollination.- Returns:
trueif the pollination succeeded and the pollen should be consumed.
-
readNbt
Reads a pollen of this type from NBT. Should match whatever is written byIPollen.writeNbt().- Parameters:
nbt- The NBT object representing a pollen object of this type.
-