Class EntityEvent.EnteringSection

java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.entity.EntityEvent
net.neoforged.neoforge.event.entity.EntityEvent.EnteringSection
Enclosing class:
EntityEvent

public static class EntityEvent.EnteringSection extends EntityEvent
This event is fired on server and client after an Entity has entered a different section.
Sections are 16x16x16 block grids of the world.
This event does not fire when a new entity is spawned, only when an entity moves from one section to another one. Use EntityJoinLevelEvent to detect new entities joining the world.
This event is not ICancellableEvent.

This event does not have a result.
invalid reference
HasResult

This event is fired on the NeoForge.EVENT_BUS.
  • Field Details

    • packedOldPos

      private final long packedOldPos
    • packedNewPos

      private final long packedNewPos
  • Constructor Details

    • EnteringSection

      public EnteringSection(Entity entity, long packedOldPos, long packedNewPos)
  • Method Details

    • getPackedOldPos

      public long getPackedOldPos()
      A packed version of the old section's position. This is to be used with the various methods in SectionPos, such as SectionPos.of(long) or SectionPos.x(long) to avoid allocation.
      Returns:
      the packed position of the old section
    • getPackedNewPos

      public long getPackedNewPos()
      A packed version of the new section's position. This is to be used with the various methods in SectionPos, such as SectionPos.of(long) or SectionPos.x(long) to avoid allocation.
      Returns:
      the packed position of the new section
    • getOldPos

      public SectionPos getOldPos()
      Returns:
      the position of the old section
    • getNewPos

      public SectionPos getNewPos()
      Returns:
      the position of the new section
    • didChunkChange

      public boolean didChunkChange()
      Whether the chunk has changed as part of this event. If this method returns false, only the Y position of the section has changed.