Class LevelEvent

java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.level.LevelEvent
Direct Known Subclasses:
BlockGrowFeatureEvent, ChunkEvent, LevelEvent.CreateSpawnPosition, LevelEvent.Load, LevelEvent.PotentialSpawns, LevelEvent.Save, LevelEvent.Unload, SleepFinishedTimeEvent

public abstract class LevelEvent extends net.neoforged.bus.api.Event
This event is fired whenever an event involving a LevelAccessor occurs.

All children of this event are fired on the main Forge event bus.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    This event fires whenever a ServerLevel is initialized for the first time and a spawn position needs to be chosen.
    static class 
    This event is fired whenever a level loads.
    static class 
    Fired when building a list of all possible entities that can spawn at the specified location.
    static class 
    This event fires whenever a level is saved.
    static class 
    This event is fired whenever a level unloads.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final net.minecraft.world.level.LevelAccessor
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    LevelEvent(net.minecraft.world.level.LevelAccessor level)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    net.minecraft.world.level.LevelAccessor
    Returns the 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

    • level

      private final net.minecraft.world.level.LevelAccessor level
  • Constructor Details

    • LevelEvent

      public LevelEvent(net.minecraft.world.level.LevelAccessor level)
  • Method Details

    • getLevel

      public net.minecraft.world.level.LevelAccessor getLevel()
      Returns the level this event is affecting.
      Returns:
      the level this event is affecting