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 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
-
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 Holder<? extends ConfiguredFeature<?,
?>> private final BlockPos
private final RandomSource
-
Constructor Summary
ConstructorDescriptionSaplingGrowTreeEvent
(LevelAccessor level, RandomSource randomSource, BlockPos pos) Deprecated, for removal: This API element is subject to removal in a future version.SaplingGrowTreeEvent
(LevelAccessor level, RandomSource randomSource, BlockPos pos, Holder<? extends ConfiguredFeature<?, ?>> feature) -
Method Summary
Modifier and TypeMethodDescriptionHolder<? extends ConfiguredFeature<?,
?>> Returns the holder of the feature which will be placed.getPos()
Returns the coordinates of the sapling attempting to grow.Returns the random source which initiated the sapling growth.void
setFeature
(Holder<? extends ConfiguredFeature<?, ?>> feature) 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
@Deprecated(forRemoval=true, since="1.19.2") public SaplingGrowTreeEvent(LevelAccessor level, RandomSource randomSource, BlockPos pos) Deprecated, for removal: This API element is subject to removal in a future version. -
SaplingGrowTreeEvent
public SaplingGrowTreeEvent(LevelAccessor level, RandomSource randomSource, BlockPos pos, Holder<? extends 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.- Returns:
- the holder of the feature which will be placed
-
setFeature
-