Interface IPollenType<P>

Type Parameters:
P - The type of pollen

public interface IPollenType<P>
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canPollinate(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.ResourceLocation
    id()
     
    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.
    boolean
    tryPollinate(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:
      true if 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 null if 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:
      true if the pollination succeeded and the pollen should be consumed.
    • readNbt

      IPollen<P> readNbt(net.minecraft.nbt.Tag nbt)
      Reads a pollen of this type from NBT. Should match whatever is written by IPollen.writeNbt().
      Parameters:
      nbt - The NBT object representing a pollen object of this type.