Class ModifyCustomSpawnersEvent
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.level.ModifyCustomSpawnersEvent
public class ModifyCustomSpawnersEvent
extends net.neoforged.bus.api.Event
This event is fired on the logical server when a
ServerLevel
is building its custom spawners.
Subscribe to this event to add/remove custom spawners for the level.
This event is not cancellable
and does not have a result.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List
<net.minecraft.world.level.CustomSpawner> private final net.minecraft.server.level.ServerLevel
-
Constructor Summary
ConstructorsConstructorDescriptionModifyCustomSpawnersEvent
(net.minecraft.server.level.ServerLevel serverLevel, List<net.minecraft.world.level.CustomSpawner> customSpawners) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCustomSpawner
(net.minecraft.world.level.CustomSpawner customSpawner) Adds a custom spawner to the list.List
<net.minecraft.world.level.CustomSpawner> net.minecraft.server.level.ServerLevel
getLevel()
Returns the server level this event is affecting.
-
Field Details
-
serverLevel
private final net.minecraft.server.level.ServerLevel serverLevel -
customSpawners
-
-
Constructor Details
-
ModifyCustomSpawnersEvent
@Internal public ModifyCustomSpawnersEvent(net.minecraft.server.level.ServerLevel serverLevel, List<net.minecraft.world.level.CustomSpawner> customSpawners)
-
-
Method Details
-
getLevel
public net.minecraft.server.level.ServerLevel getLevel()Returns the server level this event is affecting.- Returns:
- the server level this event is affecting
-
getCustomSpawners
- Returns:
- the modifiable custom spawner list.
-
addCustomSpawner
public void addCustomSpawner(net.minecraft.world.level.CustomSpawner customSpawner) Adds a custom spawner to the list.
-