Class SessionSpawnEntityEvent

java.lang.Object
org.geysermc.geyser.api.event.connection.ConnectionEvent
org.geysermc.geyser.api.event.bedrock.SessionSpawnEntityEvent
All Implemented Interfaces:
org.geysermc.event.Cancellable, org.geysermc.event.Event
Direct Known Subclasses:
ServerAttachParrotsEvent, ServerSpawnEntityEvent

public abstract class SessionSpawnEntityEvent extends ConnectionEvent implements org.geysermc.event.Cancellable
  • Constructor Details

    • SessionSpawnEntityEvent

      public SessionSpawnEntityEvent(@NonNull GeyserConnection connection)
  • Method Details

    • definition

      public abstract @Nullable GeyserEntityDefinition definition()
      Gets the entity definition sent to the connection when the entity is spawned.
      Returns:
      the entity definition sent to the connection when the entity is spawned
    • definition

      public abstract void definition(@Nullable GeyserEntityDefinition entityDefinition)
      Sets the entity definition sent to the connection when the entity is spawned. This entity definition MUST have been registered in the GeyserDefineEntitiesEvent before using it here!
      Parameters:
      entityDefinition - the entity definition sent to the connection when the entity is spawned
    • preSpawnConsumer

      public abstract void preSpawnConsumer(Consumer<@NonNull GeyserEntity> consumer)
      Adds a consumer for the GeyserEntity that will be called once the entity is created, assuming that it hasn't been cancelled. Using this method, you can modify the entities' entity properties, scale, with, and other entity data.
      Parameters:
      consumer - the consumer for the new GeyserEntity