类 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 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.

  • 字段详细资料

  • 构造器详细资料

  • 方法详细资料

    • getRandomSource

      public RandomSource getRandomSource()
      返回 the random source which initiated the sapling growth。
      返回:
      the random source which initiated the sapling growth
    • getPos

      public BlockPos getPos()
      返回 the coordinates of the sapling attempting to grow。
      返回:
      the coordinates of the sapling attempting to grow
    • getFeature

      @Nullable public @Nullable Holder<ConfiguredFeature<?,?>> getFeature()
      返回 the holder of the feature which will be placed, possibly null。
      返回:
      the holder of the feature which will be placed, possibly null
    • setFeature

      public void setFeature(@Nullable @Nullable Holder<ConfiguredFeature<?,?>> feature)
      参数:
      feature - a Holder referencing a tree feature to be placed instead of the current feature.
    • setFeature

      public void setFeature(ResourceKey<ConfiguredFeature<?,?>> featureKey)
      参数:
      featureKey - a ResourceKey referencing a tree feature to be placed instead of the current feature.