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

    Fields
    Modifier and Type
    Field
    Description
    private final List<net.minecraft.world.level.CustomSpawner>
     
    private final net.minecraft.server.level.ServerLevel
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ModifyCustomSpawnersEvent(net.minecraft.server.level.ServerLevel serverLevel, List<net.minecraft.world.level.CustomSpawner> customSpawners)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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
    Returns the server level this event is affecting.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • serverLevel

      private final net.minecraft.server.level.ServerLevel serverLevel
    • customSpawners

      private final List<net.minecraft.world.level.CustomSpawner> 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

      public List<net.minecraft.world.level.CustomSpawner> getCustomSpawners()
      Returns:
      the modifiable custom spawner list.
    • addCustomSpawner

      public void addCustomSpawner(net.minecraft.world.level.CustomSpawner customSpawner)
      Adds a custom spawner to the list.