类 BlockGrowFeatureEvent
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.level.LevelEvent
net.neoforged.neoforge.event.level.BlockGrowFeatureEvent
- 所有已实现的接口:
net.neoforged.bus.api.ICancellableEvent
public class BlockGrowFeatureEvent
extends LevelEvent
implements net.neoforged.bus.api.ICancellableEvent
This event is fired whenever a block (like a sapling) grows into a feature (like a tree).
In vanilla, this fires for saplings, fungi, mushrooms and azaleas. Mods may fire it for similar blocks.
This event is only fired on the logical server.
-
嵌套类概要
从类继承的嵌套类/接口 net.neoforged.neoforge.event.level.LevelEvent
LevelEvent.CreateSpawnPosition, LevelEvent.Load, LevelEvent.PotentialSpawns, LevelEvent.Save, LevelEvent.Unload
-
字段概要
字段修饰符和类型字段说明private @Nullable Holder
<ConfiguredFeature<?, ?>> private final BlockPos
private final RandomSource
-
构造器概要
构造器构造器说明BlockGrowFeatureEvent
(LevelAccessor level, RandomSource rand, BlockPos pos, @Nullable Holder<ConfiguredFeature<?, ?>> feature) -
方法概要
修饰符和类型方法说明@Nullable Holder
<ConfiguredFeature<?, ?>> 返回 the holder of the feature which will be placed, possibly null。getPos()
返回 the coordinates of the sapling attempting to grow。返回 the random source which initiated the sapling growth。void
setCanceled
(boolean canceled) Canceling this event will prevent the feature from growing.void
setFeature
(@Nullable Holder<ConfiguredFeature<?, ?>> feature) Changes the feature that will be grown.void
setFeature
(ResourceKey<ConfiguredFeature<?, ?>> featureKey) Changes the feature that will be grown.从类继承的方法 net.neoforged.neoforge.event.level.LevelEvent
getLevel
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 net.neoforged.bus.api.ICancellableEvent
isCanceled
-
字段详细资料
-
rand
-
pos
-
feature
-
-
构造器详细资料
-
BlockGrowFeatureEvent
public BlockGrowFeatureEvent(LevelAccessor level, RandomSource rand, BlockPos pos, @Nullable @Nullable Holder<ConfiguredFeature<?, ?>> feature)
-
-
方法详细资料
-
getRandom
返回 the random source which initiated the sapling growth。- 返回:
- the random source which initiated the sapling growth
-
getPos
返回 the coordinates of the sapling attempting to grow。- 返回:
- the coordinates of the sapling attempting to grow
-
getFeature
返回 the holder of the feature which will be placed, possibly null。- 返回:
- the holder of the feature which will be placed, possibly null
-
setFeature
Changes the feature that will be grown. If a null feature is set, the original block will remain in place.- 参数:
feature
- a Holder referencing a new feature to be placed instead of the current feature.
-
setFeature
Changes the feature that will be grown. If the holder cannot be resolved, a null feature will be set.- 参数:
featureKey
- a ResourceKey referencing a new feature to be placed instead of the current feature.
-
setCanceled
public void setCanceled(boolean canceled) Canceling this event will prevent the feature from growing. The original block will remain in place.- 指定者:
setCanceled
在接口中net.neoforged.bus.api.ICancellableEvent
-