Class SaplingGrowTreeEvent

java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.event.level.LevelEvent
net.minecraftforge.event.level.SaplingGrowTreeEvent

public class SaplingGrowTreeEvent extends LevelEvent
This event is fired whenever a sapling, fungus, mushroom or azalea grows into a tree. This event is fired during sapling growth in SaplingBlock.advanceTree(ServerLevel, BlockPos, BlockState, RandomSource).

This event is not cancellable but does have a result. ALLOW and DEFAULT will allow the sapling to grow using the features set on the event. DENY will prevent the sapling from growing.

This event is fired on the main Forge event bus only on the logical server. TODO 1.20 rename event

  • Field Details

  • Constructor Details

  • Method Details

    • getRandomSource

      public RandomSource getRandomSource()
      Returns the random source which initiated the sapling growth.
      Returns:
      the random source which initiated the sapling growth
    • getPos

      public BlockPos getPos()
      Returns the coordinates of the sapling attempting to grow.
      Returns:
      the coordinates of the sapling attempting to grow
    • getFeature

      public Holder<? extends ConfiguredFeature<?,?>> getFeature()
      Returns the holder of the feature which will be placed.
      Returns:
      the holder of the feature which will be placed
    • setFeature

      public void setFeature(Holder<? extends ConfiguredFeature<?,?>> feature)