程序包 org.bukkit.event.world

# 类 AsyncStructureGenerateEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.world.WorldEvent
org.bukkit.event.world.AsyncStructureGenerateEvent

@Experimental public class AsyncStructureGenerateEvent extends WorldEvent
This event will sometimes fire synchronously, depending on how it was triggered.

The constructor provides a boolean to indicate if the event was fired synchronously or asynchronously. When asynchronous, this event can be called from any thread, sans the main thread, and has limited access to the API.

If a `Structure` is naturally placed in a chunk of the world, this event will be asynchronous. If a player executes the '/place structure' command, this event will be synchronous. Allows to register transformers that can modify the blocks placed and entities spawned by the structure.

Care should be taken to check `Event.isAsynchronous()` and treat the event appropriately.

- ## 嵌套类概要

  嵌套类
  修饰符和类型
  类
  说明
  `static enum`
  `AsyncStructureGenerateEvent.Cause`

  ## 从类继承的嵌套类/接口 org.bukkit.event.Event

  `Event.Result`

- ## 构造器概要

  构造器
  构造器
  说明
  `AsyncStructureGenerateEvent(@NotNull World world, boolean async, @NotNull AsyncStructureGenerateEvent.Cause cause, @NotNull Structure structure, @NotNull BoundingBox boundingBox, int chunkX, int chunkZ)`

- ## 方法概要

  修饰符和类型
  方法
  说明
  `void`
  `clearBlockTransformers()`
  Removes all block transformers.
  `void`
  `clearEntityTransformers()`
  Removes all entity transformers.
  `@Nullable BlockTransformer`
  `getBlockTransformer(@NotNull NamespacedKey key)`
  Gets a block transformer by key.
  `@NotNull Map<NamespacedKey,BlockTransformer>`
  `getBlockTransformers()`
  Gets all block transformers in a unmodifiable map.
  `@NotNull BoundingBox`
  `getBoundingBox()`
  Get the bounding box of the structure.
  `@NotNull AsyncStructureGenerateEvent.Cause`
  `getCause()`
  Gets the event cause.
  `int`
  `getChunkX()`
  Get the x coordinate of the origin chunk of the structure.
  `int`
  `getChunkZ()`
  Get the z coordinate of the origin chunk of the structure.
  `@Nullable EntityTransformer`
  `getEntityTransformer(@NotNull NamespacedKey key)`
  Gets a entity transformer by key.
  `@NotNull Map<NamespacedKey,EntityTransformer>`
  `getEntityTransformers()`
  Gets all entity transformers in a unmodifiable map.
  `static @NotNull HandlerList`
  `getHandlerList()`
  `@NotNull HandlerList`
  `getHandlers()`
  `@NotNull Structure`
  `getStructure()`
  Get the structure reference that is generated.
  `void`
  `removeBlockTransformer(@NotNull NamespacedKey key)`
  Removes a block transformer.
  `void`
  `removeEntityTransformer(@NotNull NamespacedKey key)`
  Removes a entity transformer.
  `void`
  `setBlockTransformer(@NotNull NamespacedKey key, @NotNull BlockTransformer transformer)`
  Sets a block transformer to a key.
  `void`
  `setEntityTransformer(@NotNull NamespacedKey key, @NotNull EntityTransformer transformer)`
  Sets a entity transformer to a key.

  ### 从类继承的方法 org.bukkit.event.world.WorldEvent

  `getWorld`

  ### 从类继承的方法 org.bukkit.event.Event

  `getEventName, isAsynchronous`

  ### 从类继承的方法 java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 构造器详细资料

  - ### AsyncStructureGenerateEvent

    public AsyncStructureGenerateEvent(@NotNull @NotNull World world, boolean async, @NotNull @NotNull AsyncStructureGenerateEvent.Cause cause, @NotNull @NotNull Structure structure, @NotNull @NotNull BoundingBox boundingBox, int chunkX, int chunkZ)

- ## 方法详细资料

  - ### getCause

    @NotNull public @NotNull AsyncStructureGenerateEvent.Cause getCause()
    Gets the event cause.
    返回:
      the event cause

  - ### getBlockTransformer

    @Nullable public @Nullable BlockTransformer getBlockTransformer(@NotNull @NotNull NamespacedKey key)
    Gets a block transformer by key.
    参数:
      `key` - the key of the block transformer
    返回:
      the block transformer or null

  - ### setBlockTransformer

    public void setBlockTransformer(@NotNull @NotNull NamespacedKey key, @NotNull @NotNull BlockTransformer transformer)
    Sets a block transformer to a key.
    参数:
      `key` - the key
      `transformer` - the block transformer

  - ### removeBlockTransformer

    public void removeBlockTransformer(@NotNull @NotNull NamespacedKey key)
    Removes a block transformer.
    参数:
      `key` - the key of the block transformer

  - ### clearBlockTransformers

    public void clearBlockTransformers()
    Removes all block transformers.

  - ### getBlockTransformers

    @NotNull public @NotNull Map<NamespacedKey,BlockTransformer> getBlockTransformers()
    Gets all block transformers in a unmodifiable map.
    返回:
      the block transformers in a map

  - ### getEntityTransformer

    @Nullable public @Nullable EntityTransformer getEntityTransformer(@NotNull @NotNull NamespacedKey key)
    Gets a entity transformer by key.
    参数:
      `key` - the key of the entity transformer
    返回:
      the entity transformer or null

  - ### setEntityTransformer

    public void setEntityTransformer(@NotNull @NotNull NamespacedKey key, @NotNull @NotNull EntityTransformer transformer)
    Sets a entity transformer to a key.
    参数:
      `key` - the key
      `transformer` - the entity transformer

  - ### removeEntityTransformer

    public void removeEntityTransformer(@NotNull @NotNull NamespacedKey key)
    Removes a entity transformer.
    参数:
      `key` - the key of the entity transformer

  - ### clearEntityTransformers

    public void clearEntityTransformers()
    Removes all entity transformers.

  - ### getEntityTransformers

    @NotNull public @NotNull Map<NamespacedKey,EntityTransformer> getEntityTransformers()
    Gets all entity transformers in a unmodifiable map.
    返回:
      the entity transformers in a map

  - ### getStructure

    @NotNull public @NotNull Structure getStructure()
    Get the structure reference that is generated.
    返回:
      the structure

  - ### getBoundingBox

    @NotNull public @NotNull BoundingBox getBoundingBox()
    Get the bounding box of the structure.
    返回:
      the bounding box

  - ### getChunkX

    public int getChunkX()
    Get the x coordinate of the origin chunk of the structure.
    返回:
      the chunk x coordinate

  - ### getChunkZ

    public int getChunkZ()
    Get the z coordinate of the origin chunk of the structure.
    返回:
      the chunk z coordinate

  - ### getHandlers

    @NotNull public @NotNull HandlerList getHandlers()
    指定者:
      `getHandlers` 在类中 `Event`

  - ### getHandlerList

    @NotNull public static @NotNull HandlerList getHandlerList()