Package net.minecraftforge.event.level
Class SaplingGrowTreeEvent
java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.event.level.LevelEvent
net.minecraftforge.event.level.SaplingGrowTreeEvent
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraftforge.event.level.LevelEvent
LevelEvent.CreateSpawnPosition, LevelEvent.Load, LevelEvent.PotentialSpawns, LevelEvent.Save, LevelEvent.Unload
Nested classes/interfaces inherited from class net.minecraftforge.eventbus.api.Event
net.minecraftforge.eventbus.api.Event.HasResult, net.minecraftforge.eventbus.api.Event.Result
-
Field Summary
Modifier and TypeFieldDescriptionprivate @Nullable Holder
<ConfiguredFeature<?, ?>> private final BlockPos
private final RandomSource
-
Constructor Summary
ConstructorDescriptionSaplingGrowTreeEvent
(LevelAccessor level, RandomSource randomSource, BlockPos pos, @Nullable Holder<ConfiguredFeature<?, ?>> feature) -
Method Summary
Modifier and TypeMethodDescription@Nullable Holder
<ConfiguredFeature<?, ?>> Returns the holder of the feature which will be placed, possibly null.getPos()
Returns the coordinates of the sapling attempting to grow.Returns the random source which initiated the sapling growth.void
setFeature
(@Nullable Holder<ConfiguredFeature<?, ?>> feature) void
setFeature
(ResourceKey<ConfiguredFeature<?, ?>> featureKey) Methods inherited from class net.minecraftforge.event.level.LevelEvent
getLevel
Methods inherited from class net.minecraftforge.eventbus.api.Event
getListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult
-
Field Details
-
randomSource
-
pos
-
feature
-
-
Constructor Details
-
SaplingGrowTreeEvent
public SaplingGrowTreeEvent(LevelAccessor level, RandomSource randomSource, BlockPos pos, @Nullable @Nullable Holder<ConfiguredFeature<?, ?>> feature)
-
-
Method Details
-
getRandomSource
Returns the random source which initiated the sapling growth.- Returns:
- the random source which initiated the sapling growth
-
getPos
Returns the coordinates of the sapling attempting to grow.- Returns:
- the coordinates of the sapling attempting to grow
-
getFeature
Returns the holder of the feature which will be placed, possibly null.- Returns:
- the holder of the feature which will be placed, possibly null
-
setFeature
- Parameters:
feature
- a Holder referencing a tree feature to be placed instead of the current feature.
-
setFeature
- Parameters:
featureKey
- a ResourceKey referencing a tree feature to be placed instead of the current feature.
-