Class ChunkWatchEvent

java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.level.ChunkWatchEvent
Direct Known Subclasses:
ChunkWatchEvent.Sent, ChunkWatchEvent.UnWatch, ChunkWatchEvent.Watch

public abstract class ChunkWatchEvent extends net.neoforged.bus.api.Event
This event is fired whenever a chunk has a watch-related action.

The player's level may not be the same as the level of the chunk when the player is teleporting to another dimension.

This event is not cancellable and does not

invalid reference
have a result
.

This event is fired on the main Forge event bus only on the logical server.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    This event is fired whenever a chunk being watched by a ServerPlayer is transmitted to their client (see PlayerChunkSender.sendNextChunks(ServerPlayer)).
    static class 
    This event is fired whenever a ServerPlayer stops watching a chunk.
    static class 
    This event is fired whenever a ServerPlayer begins watching a chunk and the chunk is queued up for sending to the client (see ChunkMap.markChunkPendingToSend(ServerPlayer, LevelChunk)).
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final net.minecraft.server.level.ServerLevel
     
    private final net.minecraft.server.level.ServerPlayer
     
    private final net.minecraft.world.level.ChunkPos
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ChunkWatchEvent(net.minecraft.server.level.ServerPlayer player, net.minecraft.world.level.ChunkPos pos, net.minecraft.server.level.ServerLevel level)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    net.minecraft.server.level.ServerLevel
    Returns the server level containing the chunk.
    net.minecraft.server.level.ServerPlayer
    Returns the server player involved with the watch action.
    net.minecraft.world.level.ChunkPos
    Returns the chunk position this watch 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.server.level.ServerLevel level
    • player

      private final net.minecraft.server.level.ServerPlayer player
    • pos

      private final net.minecraft.world.level.ChunkPos pos
  • Constructor Details

    • ChunkWatchEvent

      public ChunkWatchEvent(net.minecraft.server.level.ServerPlayer player, net.minecraft.world.level.ChunkPos pos, net.minecraft.server.level.ServerLevel level)
  • Method Details

    • getPlayer

      public net.minecraft.server.level.ServerPlayer getPlayer()
      Returns the server player involved with the watch action.
      Returns:
      the server player involved with the watch action
    • getPos

      public net.minecraft.world.level.ChunkPos getPos()
      Returns the chunk position this watch event is affecting.
      Returns:
      the chunk position this watch event is affecting
    • getLevel

      public net.minecraft.server.level.ServerLevel getLevel()
      Returns the server level containing the chunk.
      Returns:
      the server level containing the chunk