程序包 org.bukkit

接口 World

所有超级接口:
Keyed, Metadatable, PersistentDataHolder, PluginMessageRecipient, RegionAccessor, WorldInfo

代表一个世界,包含了实体,区块,方块
  • 方法详细资料

    • getBlockAt

      @NotNull @NotNull Block getBlockAt(int x, int y, int z)
      获取坐标所指的方块.

      原文:Gets the Block at the given coordinates

      参数:
      x - 方块的X坐标
      y - 方块的Y坐标
      z - 方块的Z坐标
      返回:
      在指定坐标的方块
    • getBlockAt

      获取指定位置方块.

      原文:Gets the Block at the given Location

      参数:
      location - 要获取的方块的位置
      返回:
      在指定位置的方块
    • getHighestBlockAt

      @NotNull @NotNull Block getHighestBlockAt(int x, int z)
      获取指定坐标最高处不是空气且不可逾越的方块.

      原文:Gets the highest non-empty (impassable) block at the given coordinates.

      参数:
      x - 方块X坐标
      z - 方块Z坐标
      返回:
      最高处不是空气的方块.
    • getHighestBlockAt

      @NotNull @NotNull Block getHighestBlockAt(@NotNull @NotNull Location location)
      获取指定位置最高处不是空气且不可逾越的方块.

      原文:Gets the highest non-empty (impassable) block at the given coordinates.

      参数:
      location - 需要获取最高的方块的位置
      返回:
      最高的不是空气的方块
    • getHighestBlockAt

      @NotNull @NotNull Block getHighestBlockAt(int x, int z, @NotNull @NotNull HeightMap heightMap)
      Gets the highest block corresponding to the HeightMap at the given coordinates.
      参数:
      x - X-coordinate of the block
      z - Z-coordinate of the block
      heightMap - the heightMap that is used to determine the highest point
      返回:
      Highest block corresponding to the HeightMap
    • getHighestBlockAt

      @NotNull @NotNull Block getHighestBlockAt(@NotNull @NotNull Location location, @NotNull @NotNull HeightMap heightMap)
      Gets the highest block corresponding to the HeightMap at the given coordinates.
      参数:
      location - Coordinates to get the highest block
      heightMap - the heightMap that is used to determine the highest point
      返回:
      Highest block corresponding to the HeightMap
    • getChunkAt

      @NotNull @NotNull Chunk getChunkAt(int x, int z)
      获取给定坐标所在的区块.

      原文:Gets the Chunk at the given coordinates

      参数:
      x - X坐标
      z - Z坐标
      返回:
      给定坐标所在的区块
    • getChunkAt

      @NotNull @NotNull Chunk getChunkAt(int x, int z, boolean generate)
      Gets the Chunk at the given coordinates
      参数:
      x - X-coordinate of the chunk
      z - Z-coordinate of the chunk
      generate - Whether the chunk should be fully generated or not
      返回:
      Chunk at the given coordinates
    • getChunkAt

      获取给定位置所在的区块.

      原文: Gets the Chunk at the given Location

      参数:
      location - 方块的位置
      返回:
      给定位置的区块
    • getChunkAt

      获取这个方块所处的区块.

      原文: Gets the Chunk that contains the given Block

      参数:
      block - 需要检测的方块
      返回:
      方块所处的区块
    • isChunkLoaded

      boolean isChunkLoaded(@NotNull @NotNull Chunk chunk)
      检查指定区块是否已经被加载.

      原文: Checks if the specified Chunk is loaded

      参数:
      chunk - 需要检查的区块
      返回:
      如果区块已经被加载则返回true,否则返回false
    • getLoadedChunks

      @NotNull @NotNull Chunk[] getLoadedChunks()
      获取一个所有被加载的区块的数组.

      原文: Gets an array of all loaded Chunks

      返回:
      包含所有被加载区块的数组Chunk[]
    • loadChunk

      void loadChunk(@NotNull @NotNull Chunk chunk)
      加载指定的区块.

      本方法将使指定的区块保持加载状态直到卸载方法被手动调用. 建议开发者使用 getChunkAt 方法, 其方法只会临时加载请求的区块, 而不是本方法.

      原文: Loads the specified Chunk.

      This method will keep the specified chunk loaded until one of the unload methods is manually called. Callers are advised to instead use getChunkAt which will only temporarily load the requested chunk.

      参数:
      chunk - 待加载的区块
    • isChunkLoaded

      boolean isChunkLoaded(int x, int z)
      检查在指定坐标的区块是否被加载.

      原文: Checks if the Chunk at the specified coordinates is loaded

      参数:
      x - 区块的x坐标
      z - 区块的z坐标
      返回:
      如果区块已经被加载则返回true,否则返回false
    • isChunkGenerated

      boolean isChunkGenerated(int x, int z)
      检查指定坐标处的区块是否已生成.

      原文:Checks if the Chunk at the specified coordinates is generated

      参数:
      x - 区块x坐标
      z - 区块z坐标
      返回:
      区块已生成则返回true, 反之为false
    • isChunkInUse

      @Deprecated boolean isChunkInUse(int x, int z)
      已过时。
      本方法曾被添加用于促进区块的垃圾回收. 由于当前 Minecraft 的区块被严格管理, 并且除非那些区块正被使用, 否则不会加载超过1tick时长 (意思是mc现在对区块管理更好了, 不用的区块会被及时卸载并回收)
      检查指定坐标的区块是否被加载且被一个或更多的玩家使用.

      原文: Checks if the Chunk at the specified coordinates is loaded and in use by one or more players

      参数:
      x - 区块的x坐标
      z - 区块的z坐标
      返回:
      如果区块被加载且被一个或更多的玩家使用则返回true,否则返回false
    • loadChunk

      void loadChunk(int x, int z)
      加载指定坐标的区块.

      本方法将使指定的区块保持加载状态直到卸载方法被手动调用. 建议开发者使用 getChunkAt 方法, 其方法只会临时加载请求的区块, 而不是本方法.

      如果区块不存在则会被生成。

      这个方法类似于当generate值为true时的loadChunk(int, int, boolean).

      原文: Loads the Chunk at the specified coordinates.

      This method will keep the specified chunk loaded until one of the unload methods is manually called. Callers are advised to instead use getChunkAt which will only temporarily load the requested chunk.

      If the chunk does not exist, it will be generated.

      This method is analogous to loadChunk(int, int, boolean) where generate is true.

      参数:
      x - 区块的x坐标
      z - 区块的z坐标
    • loadChunk

      boolean loadChunk(int x, int z, boolean generate)
      加载指定坐标的区块.

      本方法将使指定的区块保持加载状态直到卸载方法被手动调用. 建议开发者使用 getChunkAt 方法, 其方法只会临时加载请求的区块, 而不是本方法.

      原文: Loads the Chunk at the specified coordinates.

      This method will keep the specified chunk loaded until one of the unload methods is manually called. Callers are advised to instead use getChunkAt which will only temporarily load the requested chunk.

      参数:
      x - 区块的x坐标
      z - 区块的z坐标
      generate - 如果区块不存在是否生成
      返回:
      如果区块被成功加载则返回true,否则返回false
    • unloadChunk

      boolean unloadChunk(@NotNull @NotNull Chunk chunk)
      安全的卸载并保存指定坐标的区块.

      这个方法类似于当safe值为true时的unloadChunk(int, int, boolean).

      原文: Safely unloads and saves the Chunk at the specified coordinates

      This method is analogous to unloadChunk(int, int, boolean) where save is true.

      参数:
      chunk - 卸载的区块
      返回:
      如果区块被成功卸载则返回true,否则返回false
    • unloadChunk

      boolean unloadChunk(int x, int z)
      安全的卸载并保存指定坐标的区块.

      这个方法类似于当safe值为true时的unloadChunk(int, int, boolean).

      原文: Safely unloads and saves the Chunk at the specified coordinates

      This method is analogous to unloadChunk(int, int, boolean) where save is true.

      参数:
      x - 区块的x坐标
      z - 区块的z坐标
      返回:
      如果区块被成功卸载则返回true,否则返回false
    • unloadChunk

      boolean unloadChunk(int x, int z, boolean save)
      安全的卸载并选择是否保存指定坐标的区块.

      原文: Safely unloads and optionally saves the Chunk at the specified coordinates

      参数:
      x - 区块的x坐标
      z - 区块的z坐标
      save - 是否保存区块
      返回:
      如果区块被成功卸载则返回true,否则返回false
    • unloadChunkRequest

      boolean unloadChunkRequest(int x, int z)
      安全地将卸载指定坐标的区块请求列入队列.

      原文: Safely queues the Chunk at the specified coordinates for unloading

      参数:
      x - 区块的x坐标
      z - 区块的z坐标
      返回:
      如果尝试列入队列成功则返回true,否则返回false
    • regenerateChunk

      @Deprecated boolean regenerateChunk(int x, int z)
      已过时。
      无法保证重新生成单个区块会产生与之前相同的区块, 因为地形装饰可分布在区块上. 应避免使用本方法, 由于已知本方法易产生bug
      重新生成指定坐标的区块.

      原文: Regenerates the Chunk at the specified coordinates

      参数:
      x - 区块的x坐标
      z - 区块的z坐标
      返回:
      区块是否真的被重新生成
    • refreshChunk

      @Deprecated boolean refreshChunk(int x, int z)
      已过时。
      这个方法不能保证在所有的客户端接口都正常地工作。
      区块重新发送给所有的客户端.

      原文: Resends the Chunk to all clients

      参数:
      x - 区块的x坐标
      z - 区块的z坐标
      返回:
      区块是否真的被刷新
    • isChunkForceLoaded

      boolean isChunkForceLoaded(int x, int z)
      Gets whether the chunk at the specified chunk coordinates is force loaded.

      A force loaded chunk will not be unloaded due to lack of player activity.

      参数:
      x - X-coordinate of the chunk
      z - Z-coordinate of the chunk
      返回:
      force load status
    • setChunkForceLoaded

      void setChunkForceLoaded(int x, int z, boolean forced)
      Sets whether the chunk at the specified chunk coordinates is force loaded.

      A force loaded chunk will not be unloaded due to lack of player activity.

      参数:
      x - X-coordinate of the chunk
      z - Z-coordinate of the chunk
      forced - force load status
    • getForceLoadedChunks

      @NotNull @NotNull Collection<Chunk> getForceLoadedChunks()
      Returns all force loaded chunks in this world.

      A force loaded chunk will not be unloaded due to lack of player activity.

      返回:
      unmodifiable collection of force loaded chunks
    • addPluginChunkTicket

      boolean addPluginChunkTicket(int x, int z, @NotNull @NotNull Plugin plugin)
      Adds a plugin ticket for the specified chunk, loading the chunk if it is not already loaded.

      A plugin ticket will prevent a chunk from unloading until it is explicitly removed. A plugin instance may only have one ticket per chunk, but each chunk can have multiple plugin tickets.

      参数:
      x - X-coordinate of the chunk
      z - Z-coordinate of the chunk
      plugin - Plugin which owns the ticket
      返回:
      true if a plugin ticket was added, false if the ticket already exists for the plugin
      抛出:
      IllegalStateException - If the specified plugin is not enabled
      另请参阅:
    • removePluginChunkTicket

      boolean removePluginChunkTicket(int x, int z, @NotNull @NotNull Plugin plugin)
      Removes the specified plugin's ticket for the specified chunk

      A plugin ticket will prevent a chunk from unloading until it is explicitly removed. A plugin instance may only have one ticket per chunk, but each chunk can have multiple plugin tickets.

      参数:
      x - X-coordinate of the chunk
      z - Z-coordinate of the chunk
      plugin - Plugin which owns the ticket
      返回:
      true if the plugin ticket was removed, false if there is no plugin ticket for the chunk
      另请参阅:
    • removePluginChunkTickets

      void removePluginChunkTickets(@NotNull @NotNull Plugin plugin)
      Removes all plugin tickets for the specified plugin

      A plugin ticket will prevent a chunk from unloading until it is explicitly removed. A plugin instance may only have one ticket per chunk, but each chunk can have multiple plugin tickets.

      参数:
      plugin - Specified plugin
      另请参阅:
    • getPluginChunkTickets

      @NotNull @NotNull Collection<Plugin> getPluginChunkTickets(int x, int z)
      Retrieves a collection specifying which plugins have tickets for the specified chunk. This collection is not updated when plugin tickets are added or removed to the chunk.

      A plugin ticket will prevent a chunk from unloading until it is explicitly removed. A plugin instance may only have one ticket per chunk, but each chunk can have multiple plugin tickets.

      参数:
      x - X-coordinate of the chunk
      z - Z-coordinate of the chunk
      返回:
      unmodifiable collection containing which plugins have tickets for the chunk
      另请参阅:
    • getIntersectingChunks

      Gets all Chunks intersecting the given BoundingBox.
      参数:
      box - BoundingBox to check
      返回:
      A collection of Chunks intersecting the given BoundingBox
    • getPluginChunkTickets

      @NotNull @NotNull Map<Plugin,Collection<Chunk>> getPluginChunkTickets()
      Returns a map of which plugins have tickets for what chunks. The returned map is not updated when plugin tickets are added or removed to chunks. If a plugin has no tickets, it will be absent from the map.

      A plugin ticket will prevent a chunk from unloading until it is explicitly removed. A plugin instance may only have one ticket per chunk, but each chunk can have multiple plugin tickets.

      返回:
      unmodifiable map containing which plugins have tickets for what chunks
      另请参阅:
    • dropItem

      在指定的位置丢出一个物品.

      原文: Drops an item at the specified Location

      参数:
      location - 丢出物品的位置
      item - 丢出的物品堆
      返回:
      这个方法会创建一个ItemDrop(物品掉落)实体作为结果
    • dropItem

      Drops an item at the specified Location Note that functions will run before the entity is spawned
      参数:
      location - Location to drop the item
      item - ItemStack to drop
      function - the function to be run before the entity is spawned.
      返回:
      ItemDrop entity created as a result of this method
    • dropItemNaturally

      在指定的位置丢出一个随机偏移的物品.

      原文:Drops an item at the specified Location with a random offset

      参数:
      location - 丢出物品的位置
      item - 丢出的物品堆
      返回:
      这个方法会创建一个ItemDrop(物品掉落)实体作为结果
    • dropItemNaturally

      @NotNull @NotNull Item dropItemNaturally(@NotNull @NotNull Location location, @NotNull @NotNull ItemStack item, @Nullable @Nullable Consumer<? super Item> function)
      Drops an item at the specified Location with a random offset Note that functions will run before the entity is spawned
      参数:
      location - Location to drop the item
      item - ItemStack to drop
      function - the function to be run before the entity is spawned.
      返回:
      ItemDrop entity created as a result of this method
    • spawnArrow

      @NotNull @NotNull Arrow spawnArrow(@NotNull @NotNull Location location, @NotNull @NotNull Vector direction, float speed, float spread)
      在指定的位置创建一个的实体.

      原文: Creates an Arrow entity at the given Location

      参数:
      location - 生成箭的位置
      direction - 箭射向的方向
      speed - 箭的射速,建议为0.6
      spread - 箭存在的时间(箭在多久后会消失)
      返回:
      这个方法会生成一个Arrow(箭)实体作为结果
    • spawnArrow

      @NotNull <T extends AbstractArrow> T spawnArrow(@NotNull @NotNull Location location, @NotNull @NotNull Vector direction, float speed, float spread, @NotNull @NotNull Class<T> clazz)
      Creates an arrow entity of the given class at the given Location
      类型参数:
      T - type of arrow to spawn
      参数:
      location - Location to spawn the arrow
      direction - Direction to shoot the arrow in
      speed - Speed of the arrow. A recommend speed is 0.6
      spread - Spread of the arrow. A recommend spread is 12
      clazz - the Entity class for the arrow SpectralArrow,Arrow,TippedArrow
      返回:
      Arrow entity spawned as a result of this method
    • generateTree

      boolean generateTree(@NotNull @NotNull Location location, @NotNull @NotNull TreeType type)
      在指定的位置创建一颗树.

      原文: Creates a tree at the given Location

      参数:
      location - 生成树的位置
      type - 创建的树的类型
      返回:
      如果树被成功生成则返回true,否则返回false
    • generateTree

      已过时。
      this method does not handle tile entities (bee nests)
      在指定的位置创建一颗树.

      原文: Creates a tree at the given Location

      参数:
      loc - 生成树的位置
      type - 创建的树的类型
      delegate - 这个方法会返回一个用于调用每个方块的改变的类作为结果
      返回:
      如果树被成功生成则返回true,否则返回false
      另请参阅:
    • strikeLightning

      在指定的位置劈下闪电.

      原文: Strikes lightning at the given Location

      参数:
      loc - 劈下闪电的位置
      返回:
      lightning(闪电)实体
    • strikeLightningEffect

      在指定的位置劈下不会造成伤害的闪电.

      原文: Strikes lightning at the given Location without doing damage

      参数:
      loc - 劈下闪电的位置
      返回:
      lightning(闪电)实体
    • getEntities

      @NotNull @NotNull List<Entity> getEntities()
      获取一个这个世界所有实体的列表.

      原文: Get a list of all entities in this World

      指定者:
      getEntities 在接口中 RegionAccessor
      返回:
      一个当前处在这个世界的所有实体的列表
    • getLivingEntities

      @NotNull @NotNull List<LivingEntity> getLivingEntities()
      获取一个这个世界所有生物实体的列表.

      原文: Get a list of all living entities in this World

      指定者:
      getLivingEntities 在接口中 RegionAccessor
      返回:
      一个当前处在这个世界的所有生物实体的列表
    • getEntitiesByClass

      @Deprecated @NotNull <T extends Entity> @NotNull Collection<T> getEntitiesByClass(@NotNull @NotNull Class<T>... classes)
      已过时。
      获取一个在这个世界的所有与指定的类/接口相匹配的实体的集合.

      原文: Get a collection of all entities in this World matching the given class/interface

      类型参数:
      T - 一个实体子类
      参数:
      classes - 用于匹配的表示实体类型的类
      返回:
      一个当前处在这个世界的所有与指定的类/接口相匹配的实体的列表
    • getEntitiesByClass

      @NotNull <T extends Entity> @NotNull Collection<T> getEntitiesByClass(@NotNull @NotNull Class<T> cls)
      获取一个在这个世界的所有与指定的类/接口相匹配的实体的集合.

      原文: Get a collection of all entities in this World matching the given class/interface

      指定者:
      getEntitiesByClass 在接口中 RegionAccessor
      类型参数:
      T - 一个实体子类
      参数:
      cls - 用于匹配的表示实体类型的类
      返回:
      一个当前处在这个世界的所有与指定的类/接口相匹配的实体的列表
    • getEntitiesByClasses

      @NotNull @NotNull Collection<Entity> getEntitiesByClasses(@NotNull @NotNull Class<?>... classes)
      获取一个在这个世界的所有与任一指定的类/接口相匹配的实体的集合.

      原文: Get a collection of all entities in this World matching any of the given classes/interfaces

      指定者:
      getEntitiesByClasses 在接口中 RegionAccessor
      参数:
      classes - 用于匹配的表示实体类型的类
      返回:
      一个当前处在这个世界的所有与一个或更多指定的类/接口相匹配的实体的列表
    • getPlayers

      @NotNull @NotNull List<Player> getPlayers()
      获取一个这个世界的所有玩家的列表.

      原文: Get a list of all players in this World

      返回:
      一个当前处在这个世界的所有玩家的列表
    • getNearbyEntities

      @NotNull @NotNull Collection<Entity> getNearbyEntities(@NotNull @NotNull Location location, double x, double y, double z)
      返回一个以这个位置为中心的包围着的所有实体的列表(译注:这个可能不太好理解,就是在这个位置,按指定的搜索范围,搜索这个范围里的所有实体).

      这可能不会考虑当前尚未加载的区块中的实体. 一些实现可能会对搜索的范围的大小施加限制.

      原文: Returns a list of entities within a bounding box centered around a Location.

      This may not consider entities in currently unloaded chunks. Some implementations may impose artificial restrictions on the size of the search bounding box.

      参数:
      location - 搜索范围的中心
      x - 搜索范围的x半轴长度
      y - 搜索范围的y半轴长度
      z - 搜索范围的z半轴长度
      返回:
      在位置附近的实体的集合,一般不为空
    • getNearbyEntities

      @NotNull @NotNull Collection<Entity> getNearbyEntities(@NotNull @NotNull Location location, double x, double y, double z, @Nullable @Nullable Predicate<? super Entity> filter)
      Returns a list of entities within a bounding box centered around a Location.

      This may not consider entities in currently unloaded chunks. Some implementations may impose artificial restrictions on the size of the search bounding box.

      参数:
      location - The center of the bounding box
      x - 1/2 the size of the box along x axis
      y - 1/2 the size of the box along y axis
      z - 1/2 the size of the box along z axis
      filter - only entities that fulfill this predicate are considered, or null to consider all entities
      返回:
      the collection of entities near location. This will always be a non-null collection.
    • getNearbyEntities

      @NotNull @NotNull Collection<Entity> getNearbyEntities(@NotNull @NotNull BoundingBox boundingBox)
      Returns a list of entities within the given bounding box.

      This may not consider entities in currently unloaded chunks. Some implementations may impose artificial restrictions on the size of the search bounding box.

      参数:
      boundingBox - the bounding box
      返回:
      the collection of entities within the bounding box, will always be a non-null collection
    • getNearbyEntities

      @NotNull @NotNull Collection<Entity> getNearbyEntities(@NotNull @NotNull BoundingBox boundingBox, @Nullable @Nullable Predicate<? super Entity> filter)
      Returns a list of entities within the given bounding box.

      This may not consider entities in currently unloaded chunks. Some implementations may impose artificial restrictions on the size of the search bounding box.

      参数:
      boundingBox - the bounding box
      filter - only entities that fulfill this predicate are considered, or null to consider all entities
      返回:
      the collection of entities within the bounding box, will always be a non-null collection
    • rayTraceEntities

      @Nullable @Nullable RayTraceResult rayTraceEntities(@NotNull @NotNull Location start, @NotNull @NotNull Vector direction, double maxDistance)
      执行检查实体碰撞的射线跟踪.

      这可能不考虑当前已经卸载的区块中的实体. 一些实现可能会对最大距离施加人为限制.

      原文: Performs a ray trace that checks for entity collisions.

      This may not consider entities in currently unloaded chunks. Some implementations may impose artificial restrictions on the maximum distance.

      Note: Due to display entities having a zero size hitbox, this method will not detect them. To detect display entities use rayTraceEntities(Location, Vector, double, double) with a positive raySize

      参数:
      start - 起始位置
      direction - 射线方向
      maxDistance - 最大距离
      返回:
      最近的射线跟踪命中结果, 如果没有命中, 则为null
      另请参阅:
    • rayTraceEntities

      @Nullable @Nullable RayTraceResult rayTraceEntities(@NotNull @NotNull Location start, @NotNull @NotNull Vector direction, double maxDistance, double raySize)
      执行检查实体碰撞的射线跟踪.

      这可能不考虑当前已经卸载的区块中的实体. 一些实现可能会对最大距离施加人为限制.

      原文: Performs a ray trace that checks for entity collisions.

      This may not consider entities in currently unloaded chunks. Some implementations may impose artificial restrictions on the maximum distance.

      参数:
      start - 起始位置
      direction - 射线方向
      maxDistance - 最大距离
      raySize - 在进行碰撞检查之前, 实体边界框将按此值均匀地放大(或缩小)
      返回:
      最近的射线跟踪命中结果, 如果没有命中, 则为null
      另请参阅:
    • rayTraceEntities

      @Nullable @Nullable RayTraceResult rayTraceEntities(@NotNull @NotNull Location start, @NotNull @NotNull Vector direction, double maxDistance, @Nullable @Nullable Predicate<? super Entity> filter)
      执行检查实体碰撞的射线跟踪.

      这可能不考虑当前已经卸载的区块中的实体. 一些实现可能会对最大距离施加人为限制.

      原文: Performs a ray trace that checks for entity collisions.

      This may not consider entities in currently unloaded chunks. Some implementations may impose artificial restrictions on the maximum distance.

      Note: Due to display entities having a zero size hitbox, this method will not detect them. To detect display entities use rayTraceEntities(Location, Vector, double, double, Predicate) with a positive raySize

      参数:
      start - 起始位置
      direction - 射线方向
      maxDistance - 最大距离
      filter - 只考虑满足此过滤器的实体, 或者 null 考虑所有实体
      返回:
      最近的射线跟踪命中结果, 如果没有命中, 则为null
      另请参阅:
    • rayTraceEntities

      @Nullable @Nullable RayTraceResult rayTraceEntities(@NotNull @NotNull Location start, @NotNull @NotNull Vector direction, double maxDistance, double raySize, @Nullable @Nullable Predicate<? super Entity> filter)
      执行检查实体碰撞的射线跟踪.

      这可能不考虑当前已经卸载的区块中的实体. 一些实现可能会对最大距离施加人为限制.

      原文: Performs a ray trace that checks for entity collisions.

      This may not consider entities in currently unloaded chunks. Some implementations may impose artificial restrictions on the maximum distance.

      参数:
      start - 起始位置
      direction - 射线方向
      maxDistance - 最大距离
      raySize - 在进行碰撞检查之前, 实体边界框将按此值均匀地放大(或缩小)
      filter - 只考虑满足此过滤器的实体, 或者 null 考虑所有实体
      返回:
      最近的射线跟踪命中结果, 如果没有命中, 则为null
    • rayTraceBlocks

      @Nullable @Nullable RayTraceResult rayTraceBlocks(@NotNull @NotNull Location start, @NotNull @NotNull Vector direction, double maxDistance)
      执行射线跟踪, 使用方块的精确碰撞形状来检查方块碰撞.

      这将考虑与可穿过的方块的碰撞, 但忽略流体.

      这可能会导致区块加载! 一些实现可能会对最大距离施加人为限制.

      原文: Performs a ray trace that checks for block collisions using the blocks' precise collision shapes.

      This takes collisions with passable blocks into account, but ignores fluids.

      This may cause loading of chunks! Some implementations may impose artificial restrictions on the maximum distance.

      参数:
      start - 起始位置
      direction - 射线方向
      maxDistance - 最大距离
      返回:
      最近的射线跟踪命中结果, 如果没有命中, 则为null
      另请参阅:
    • rayTraceBlocks

      @Nullable @Nullable RayTraceResult rayTraceBlocks(@NotNull @NotNull Location start, @NotNull @NotNull Vector direction, double maxDistance, @NotNull @NotNull FluidCollisionMode fluidCollisionMode)
      执行射线跟踪, 使用方块的精确碰撞形状来检查方块碰撞.

      这将考虑与可穿过的方块的碰撞.

      这可能会导致区块加载! 一些实现可能会对最大距离施加人为限制.

      原文: Performs a ray trace that checks for block collisions using the blocks' precise collision shapes.

      This takes collisions with passable blocks into account.

      This may cause loading of chunks! Some implementations may impose artificial restrictions on the maximum distance.

      参数:
      start - 起始位置
      direction - 射线方向
      maxDistance - 最大距离
      fluidCollisionMode - 流体碰撞模式
      返回:
      最近的射线跟踪命中结果, 如果没有命中, 则为null
      另请参阅:
    • rayTraceBlocks

      @Nullable @Nullable RayTraceResult rayTraceBlocks(@NotNull @NotNull Location start, @NotNull @NotNull Vector direction, double maxDistance, @NotNull @NotNull FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks)
      执行射线跟踪, 使用方块的精确碰撞形状来检查方块碰撞.

      如果忽略与可穿过的方块的碰撞, 则无论流体碰撞模式如何, 也会忽略流体碰撞.

      只有当射线从传送门方块内部开始时, 其才被认为是可穿过的. 除此之外, 即使忽略了与可穿过方块的碰撞, 也将考虑与传送门方块的碰撞.

      这可能会导致区块加载! 一些实现可能会对最大距离施加人为限制.

      原文: Performs a ray trace that checks for block collisions using the blocks' precise collision shapes.

      If collisions with passable blocks are ignored, fluid collisions are ignored as well regardless of the fluid collision mode.

      Portal blocks are only considered passable if the ray starts within them. Apart from that collisions with portal blocks will be considered even if collisions with passable blocks are otherwise ignored.

      This may cause loading of chunks! Some implementations may impose artificial restrictions on the maximum distance.

      参数:
      start - 起始位置
      direction - 射线方向
      maxDistance - 最大距离
      fluidCollisionMode - 流体碰撞模式
      ignorePassableBlocks - 是否忽略可穿过但可碰撞的方块(例如高草丛、告示牌、液体等)
      返回:
      最近的射线跟踪命中结果, 如果没有命中, 则为null
    • rayTrace

      @Nullable @Nullable RayTraceResult rayTrace(@NotNull @NotNull Location start, @NotNull @NotNull Vector direction, double maxDistance, @NotNull @NotNull FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks, double raySize, @Nullable @Nullable Predicate<? super Entity> filter)
      执行射线跟踪, 检查方块碰撞和实体碰撞.

      方块碰撞使用方块的精确碰撞形状. raySize 参数仅用于实体的碰撞检查.

      如果忽略与可穿过方块的碰撞, 则无论流体碰撞模式如何, 也会忽略流体碰撞.

      只有当射线从传送门方块内部开始时, 其才被认为是可穿过的. 除此之外, 即使忽略了与可穿过方块的碰撞, 也将考虑与传送门方块的碰撞.

      这可能会导致区块加载! 一些实现可能会对最大距离施加人为限制.

      原文: Performs a ray trace that checks for both block and entity collisions.

      Block collisions use the blocks' precise collision shapes. The raySize parameter is only taken into account for entity collision checks.

      If collisions with passable blocks are ignored, fluid collisions are ignored as well regardless of the fluid collision mode.

      Portal blocks are only considered passable if the ray starts within them. Apart from that collisions with portal blocks will be considered even if collisions with passable blocks are otherwise ignored.

      This may cause loading of chunks! Some implementations may impose artificial restrictions on the maximum distance.

      参数:
      start - 起始位置
      direction - 射线方向
      maxDistance - 最大距离
      fluidCollisionMode - 流体碰撞模式
      ignorePassableBlocks - 是否忽略可穿过但可碰撞的方块(例如高草丛、告示牌、液体等)
      raySize - 在进行碰撞检查之前, 实体边界框将按此值均匀地放大(或缩小)
      filter - 只考虑满足此过滤器的实体, 或者 null 考虑所有实体
      返回:
      最近的方块或实体的射线跟踪命中结果, 如果没有命中, 则为null
    • getSpawnLocation

      @NotNull @NotNull Location getSpawnLocation()
      获取这个世界的默认出生点位置.

      原文: Gets the default spawn Location of this world

      返回:
      这个世界的出生点位置
    • setSpawnLocation

      boolean setSpawnLocation(@NotNull @NotNull Location location)
      设置这个世界的出生点位置.
      提供的位置所处世界必须与这个世界相同.

      原文:Sets the spawn location of the world.
      The location provided must be equal to this world.

      参数:
      location - 要设置的出生点位置
      返回:
      若成功设置返回true
    • setSpawnLocation

      boolean setSpawnLocation(int x, int y, int z, float angle)
      设置这个世界的出生点位置.

      原文:Sets the spawn location of the world

      参数:
      x - X 坐标
      y - Y 坐标
      z - Z 坐标
      angle - 角度
      返回:
      若成功设置返回true
    • setSpawnLocation

      boolean setSpawnLocation(int x, int y, int z)
      设置这个世界的出生点位置.

      原文: Sets the spawn location of the world

      参数:
      x - x坐标
      y - y坐标
      z - z坐标
      返回:
      如果成功设置则返回true
    • getTime

      long getTime()
      获取这个世界在游戏中的相对时间.

      相对时间类似于小时数*1000(译注:意思是,如果这个世界在游戏中的时间为一个小时则相对时间显示为1000,一小时十二分为1200).

      原文: Gets the relative in-game time of this world.

      The relative time is analogous to hours * 1000

      返回:
      当前相对时间
      另请参阅:
    • setTime

      void setTime(long time)
      设置服务器的在游戏中的相对时间.

      相对时间类似于小时数*1000(译注:意思是,如果这个世界在游戏中的时间为一个小时则相对时间显示为1000,一小时十二分为1200).

      注意设置的相对时间如果小于当前相对时间则实际上是将时钟向前移动了一天。如果你要倒回时间,请使用setFullTime(long).

      原文: Sets the relative in-game time on the server.

      The relative time is analogous to hours * 1000

      Note that setting the relative time below the current relative time will actually move the clock forward a day. If you require to rewind time, please see setFullTime(long)

      参数:
      time - 设置的在游戏中的新的相对时间(格式为小时数*1000)
      另请参阅:
    • getFullTime

      long getFullTime()
      获取这个世界完整的游戏时间.

      原文: Gets the full in-game time on this world

      返回:
      当前绝对时间
      另请参阅:
    • setFullTime

      void setFullTime(long time)
      设置服务器的游戏时间.

      注意这是设置全世界的时间,可能产生不好的影响,比如破坏红石钟或任一预定事件.

      原文: Sets the in-game time on the server

      Note that this sets the full time of the world, which may cause adverse effects such as breaking redstone clocks and any scheduled events

      参数:
      time - 设置的世界的新绝对时间
      另请参阅:
    • getGameTime

      long getGameTime()
      Gets the full in-game time on this world since the world generation
      返回:
      The current absolute time since the world generation
      另请参阅:
    • hasStorm

      boolean hasStorm()
      返回世界现在是否有雷暴.

      原文: Returns whether the world has an ongoing storm.

      返回:
      是否有雷暴
    • setStorm

      void setStorm(boolean hasStorm)
      设置是否有风暴. 会为新的天气设置一段持续时间. 本方法会隐式调用 setClearWeatherDuration(int), 指定 0 tick 来重置世界的晴朗天气.

      原文: Set whether there is a storm. A duration will be set for the new current conditions. This will implicitly call setClearWeatherDuration(int) with 0 ticks to reset the world's clear weather.

      参数:
      hasStorm - 是否下雨或下雪
    • getWeatherDuration

      int getWeatherDuration()
      获取当前天气的剩余时间,单位为tick.

      原文: Get the remaining time in ticks of the current conditions.

      返回:
      时间,单位为tick
    • setWeatherDuration

      void setWeatherDuration(int duration)
      设置当前天气的剩余时间,单位为tick.

      原文: Set the remaining time in ticks of the current conditions.

      参数:
      duration - 时间,单位为tick
    • isThundering

      boolean isThundering()
      返回这个世界是否在打雷.

      原文: Returns whether there is thunder.

      返回:
      是否打雷
    • setThundering

      void setThundering(boolean thundering)
      设置这个世界是否在打雷. 本方法会隐式调用 setClearWeatherDuration(int), 指定 0 tick 来重置世界的晴朗天气.

      原文: Set whether it is thundering. This will implicitly call setClearWeatherDuration(int) with 0 ticks to reset the world's clear weather.

      参数:
      thundering - 是否打雷
    • getThunderDuration

      int getThunderDuration()
      获取这个世界打雷的持续时间.

      原文: Get the thundering duration.

      返回:
      持续时间,单位为tick
    • setThunderDuration

      void setThunderDuration(int duration)
      设置这个世界打雷持续时间。

      原文: Set the thundering duration.

      参数:
      duration - 持续时间,单位为tick
    • isClearWeather

      boolean isClearWeather()
      返回世界是否为晴天. 退散, 便是晴天.

      原文:Returns whether the world has clear weather. This will be true such that isThundering() and hasStorm() are both false.

      返回:
      是否为晴天
    • setClearWeatherDuration

      void setClearWeatherDuration(int duration)
      设置晴朗天气的持续时间 (单位为 tick). 晴朗天气的持续时间决定着是否允许世界下雨或打雷. 如果持续时间为 > 0, 那么在持续时间过后, 世界也不会自然地下雨/雪. 本方法等效于 /weather clear 持续时间.

      原文:Set the clear weather duration. The clear weather ticks determine whether or not the world will be allowed to rain or storm. If clear weather ticks are > 0, the world will not naturally do either until the duration has elapsed. This method is equivalent to calling /weather clear with a set amount of ticks.

      参数:
      duration - 持续时间, 单位为 tick
    • getClearWeatherDuration

      int getClearWeatherDuration()
      获取晴朗天气的持续时间.

      原文:Get the clear weather duration.

      返回:
      持续时间, 单位为 tick
    • createExplosion

      boolean createExplosion(double x, double y, double z, float power)
      在指定坐标生成指定威力的爆炸.

      原文: Creates explosion at given coordinates with given power

      参数:
      x - x坐标
      y - y坐标
      z - z坐标
      power - 爆炸的威力,一个TNT当量为4F
      返回:
      如果爆炸被取消则返回false,否则返回true
    • createExplosion

      boolean createExplosion(double x, double y, double z, float power, boolean setFire)
      在指定的坐标生成指定威力的爆炸并设置方块是否会着火.

      原文: Creates explosion at given coordinates with given power and optionally setting blocks on fire.

      参数:
      x - x坐标
      y - y坐标
      z - z坐标
      power - 爆炸的威力,一个TNT当量为4F
      setFire - 方块是否会着火
      返回:
      如果爆炸被取消则返回false,否则返回true
    • createExplosion

      boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks)
      在指定的坐标生成指定威力的爆炸并设置方块是否会着火或被破坏.

      原文: Creates explosion at given coordinates with given power and optionally setting blocks on fire or breaking blocks.

      参数:
      x - x坐标
      y - y坐标
      z - z坐标
      power - 爆炸的威力,一个TNT当量为4F
      setFire - 方块是否会着火
      breakBlocks - 是否破坏方块
      返回:
      如果爆炸被取消则返回false,否则返回true
    • createExplosion

      boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks, @Nullable @Nullable Entity source)
      Creates explosion at given coordinates with given power and optionally setting blocks on fire or breaking blocks.

      Note that if a non-null source Entity is provided and breakBlocks is true, the value of breakBlocks will be ignored if GameRule.MOB_GRIEFING is false in the world in which the explosion occurs. In other words, the mob griefing gamerule will take priority over breakBlocks if explosions are not allowed.

      参数:
      x - X coordinate
      y - Y coordinate
      z - Z coordinate
      power - The power of explosion, where 4F is TNT
      setFire - Whether or not to set blocks on fire
      breakBlocks - Whether or not to have blocks be destroyed
      source - the source entity, used for tracking damage
      返回:
      false if explosion was canceled, otherwise true
    • createExplosion

      boolean createExplosion(@NotNull @NotNull Location loc, float power)
      在指定坐标生成指定威力的爆炸.

      原文: Creates explosion at given coordinates with given power

      参数:
      loc - 爆炸位置
      power - 爆炸的威力,一个TNT当量为4F
      返回:
      如果爆炸被取消则返回false,否则返回true
    • createExplosion

      boolean createExplosion(@NotNull @NotNull Location loc, float power, boolean setFire)
      在指定的坐标生成指定威力的爆炸并设置方块是否会着火.

      原文: Creates explosion at given coordinates with given power and optionally setting blocks on fire.

      参数:
      loc - 爆炸位置
      power - 爆炸的威力,一个TNT当量为4F
      setFire - 方块是否会着火
      返回:
      如果爆炸被取消则返回false,否则返回true
    • createExplosion

      boolean createExplosion(@NotNull @NotNull Location loc, float power, boolean setFire, boolean breakBlocks)
      Creates explosion at given coordinates with given power and optionally setting blocks on fire or breaking blocks.
      参数:
      loc - Location to blow up
      power - The power of explosion, where 4F is TNT
      setFire - Whether or not to set blocks on fire
      breakBlocks - Whether or not to have blocks be destroyed
      返回:
      false if explosion was canceled, otherwise true
    • createExplosion

      boolean createExplosion(@NotNull @NotNull Location loc, float power, boolean setFire, boolean breakBlocks, @Nullable @Nullable Entity source)
      Creates explosion at given coordinates with given power and optionally setting blocks on fire or breaking blocks.

      Note that if a non-null source Entity is provided and breakBlocks is true, the value of breakBlocks will be ignored if GameRule.MOB_GRIEFING is false in the world in which the explosion occurs. In other words, the mob griefing gamerule will take priority over breakBlocks if explosions are not allowed.

      参数:
      loc - Location to blow up
      power - The power of explosion, where 4F is TNT
      setFire - Whether or not to set blocks on fire
      breakBlocks - Whether or not to have blocks be destroyed
      source - the source entity, used for tracking damage
      返回:
      false if explosion was canceled, otherwise true
    • getPVP

      boolean getPVP()
      获取世界当前的PVP设置.

      原文: Gets the current PVP setting for this world.

      返回:
      如果允许PVP则返回true
    • setPVP

      void setPVP(boolean pvp)
      设置世界的PVP设置.

      原文: Sets the PVP setting for this world.

      参数:
      pvp - 是否允许PVP,允许为true,不允许为false.
    • getGenerator

      获取世界的区块生成器.

      原文: Gets the chunk generator for this world

      返回:
      这个世界相关的区块生成器
    • getBiomeProvider

      @Nullable @Nullable BiomeProvider getBiomeProvider()
      Gets the biome provider for this world
      返回:
      BiomeProvider associated with this world
    • save

      void save()
      保存世界到磁盘.

      原文:Saves world to disk

    • getPopulators

      获取一个这个世界使用的所有方块填充器的列表.

      原文: Gets a list of all applied BlockPopulators for this World

      返回:
      这个世界使用的所有方块填充器的列表
    • spawn

      @NotNull <T extends LivingEntity> T spawn(@NotNull @NotNull Location location, @NotNull @NotNull Class<T> clazz, @NotNull CreatureSpawnEvent.SpawnReason spawnReason, boolean randomizeData, @Nullable @Nullable Consumer<? super T> function) throws IllegalArgumentException
      Creates a new entity at the given Location with the supplied function run before the entity is added to the world.
      Note that when the function is run, the entity will not be actually in the world. Any operation involving such as teleporting the entity is undefined until after this function returns. The passed function however is run after the potential entity's spawn randomization and hence already allows access to the values of the mob, whether or not those were randomized, such as attributes or the entity equipment.
      类型参数:
      T - the generic type of the entity that is being created.
      参数:
      location - the location at which the entity will be spawned.
      clazz - the class of the LivingEntity that is to be spawned.
      spawnReason - the reason provided during the CreatureSpawnEvent call.
      randomizeData - whether or not the entity's data should be randomised before spawning. By default entities are randomised before spawning in regards to their equipment, age, attributes, etc. An example of this randomization would be the color of a sheep, random enchantments on the equipment of mobs or even a zombie becoming a chicken jockey. If set to false, the entity will not be randomised before spawning, meaning all their data will remain in their default state and not further modifications to the entity will be made. Notably only entities that extend the Mob interface provide randomisation logic for their spawn. This parameter is hence useless for any other type of entity.
      function - the function to be run before the entity is spawned.
      返回:
      the spawned entity instance.
      抛出:
      IllegalArgumentException - if either the world or clazz parameter are null.
    • spawnFallingBlock

      Spawn a FallingBlock entity at the given Location of the specified MaterialData. The MaterialData dictates what is falling. When the FallingBlock hits the ground, it will place that block.

      The Material must be a block type, check with data.getItemType().isBlock(). The Material may not be air.

      参数:
      location - The Location to spawn the FallingBlock
      data - The block data
      返回:
      The spawned FallingBlock instance
      抛出:
      IllegalArgumentException - if Location or MaterialData are null or Material of the MaterialData is not a block
    • spawnFallingBlock

      在指定的位置根据给定的BlockData生成一个掉落中的方块实体。 BlockData决定下落的东西。当下落方块碰到地时就会放置这个方块.

      原文: Spawn a FallingBlock entity at the given Location of the specified BlockData. The BlockData dictates what is falling. When the FallingBlock hits the ground, it will place that block.

      参数:
      location - 生成下落方块的位置
      data - FallingBlock的方块数据
      返回:
      生成的正在下落的方块实例
      抛出:
      IllegalArgumentException - 如果 LocationBlockData 为null
    • spawnFallingBlock

      已过时。
      不安全的参数
      在指定的位置根据指定的方块物品生成一个掉落中的方块实体. 物品决定下落的东西。当下落方块碰到地时就会放置这个方块.

      物品必须是一个经过Material.isBlock()检验的方块类型,可能不是空气.

      原文: Spawn a FallingBlock entity at the given Location of the specified Material. The material dictates what is falling. When the FallingBlock hits the ground, it will place that block.

      The Material must be a block type, check with material.isBlock(). The Material may not be air.

      参数:
      location - 生成下落方块的位置
      material - 方块 Material 类型
      data - 方块数据
      返回:
      生成的正在下落的方块实例
      抛出:
      IllegalArgumentException - 如果 LocationMaterial 为null 或 Material 不是方块
    • playEffect

      void playEffect(@NotNull @NotNull Location location, @NotNull @NotNull Effect effect, int data)
      向以指定位置为圆心的默认半径内的所有玩家施加(给予)一个效果.

      原文: Plays an effect to all players within a default radius around a given location.

      参数:
      location - 在这个位置周围给玩家施加效果
      effect - 效果
      data - 一些效果需要的数据
    • playEffect

      void playEffect(@NotNull @NotNull Location location, @NotNull @NotNull Effect effect, int data, int radius)
      向在以指定位置为圆心的指定半径内的所有玩家施加(给予)一个效果。

      原文: Plays an effect to all players within a given radius around a location.

      参数:
      location - 在这个位置周围给玩家施加效果
      effect - 效果
      data - 一些效果需要的数据
      radius - 半径
    • playEffect

      <T> void playEffect(@NotNull @NotNull Location location, @NotNull @NotNull Effect effect, @Nullable T data)
      向在以指定位置为圆心的默认半径内的所有玩家施加(给予)一个效果。

      原文: Plays an effect to all players within a default radius around a given location.

      类型参数:
      T - 与效果类型相关的数据
      参数:
      location - 在这个位置周围给玩家施加效果
      effect - 效果
      data - 一些效果需要的数据
    • playEffect

      <T> void playEffect(@NotNull @NotNull Location location, @NotNull @NotNull Effect effect, @Nullable T data, int radius)
      向在以指定位置为圆心的指定半径内的所有玩家施加(给予)一个效果。

      原文: Plays an effect to all players within a given radius around a location.

      类型参数:
      T - 与效果类型相关的数据
      参数:
      location - 在这个位置周围给玩家施加效果
      effect - 效果
      data - 一些效果需要的数据
      radius - 半径
    • getEmptyChunkSnapshot

      @NotNull @NotNull ChunkSnapshot getEmptyChunkSnapshot(int x, int z, boolean includeBiome, boolean includeBiomeTemp)
      获取空区块的快照(相当于所有空气方块),可设置包含有效生物群系数据。用于表示一个未生成的区块,或者只用于获取生物群系数据而不加载区块。

      原文: Get empty chunk snapshot (equivalent to all air blocks), optionally including valid biome data. Used for representing an ungenerated chunk, or for fetching only biome data without loading a chunk.

      参数:
      x - 区块x坐标
      z - 区块z坐标
      includeBiome - 如果为true,则快照会包含每个坐标的生物群系类型
      includeBiomeTemp - 如果为true,则快照会包含每个坐标的原始生物群系温度
      返回:
      空快照
    • setSpawnFlags

      void setSpawnFlags(boolean allowMonsters, boolean allowAnimals)
      为这个世界设置出生标识。

      原文: Sets the spawn flags for this.

      参数:
      allowMonsters - 如果为true,则允许怪物在这个世界生成
      allowAnimals - 如果为true,则允许动物在这个世界生成
    • getAllowAnimals

      boolean getAllowAnimals()
      获取动物能不能在这个世界生成。

      原文: Gets whether animals can spawn in this world.

      返回:
      动物能不能在这个世界生成
    • getAllowMonsters

      boolean getAllowMonsters()
      获取怪物能不能在这个世界生成。

      原文: Gets whether monsters can spawn in this world.

      返回:
      怪物能不能在这个世界生成
    • getBiome

      @NotNull @Deprecated @NotNull Biome getBiome(int x, int z)
      已过时。
      1.15更新后生物群系已三维化
      获取指定方块坐标的生物群系。

      原文: Gets the biome for the given block coordinates.

      参数:
      x - 方块的x坐标
      z - 方块的z坐标
      返回:
      所查方块的生物群系
    • setBiome

      @Deprecated void setBiome(int x, int z, @NotNull @NotNull Biome bio)
      已过时。
      1.15更新后生物群系已三维化
      设置指定方块坐标的生物群系.

      原文:Sets the biome for the given block coordinates

      参数:
      x - 方块的x坐标
      z - 方块的z坐标
      bio - 这个方块的新生物群系类型
    • getTemperature

      @Deprecated double getTemperature(int x, int z)
      已过时。
      1.15更新后生物群系已三维化
      获取指定方块坐标的温度。

      方块不存在时运行这个方法是安全的,它不会创建方块.

      本方法将返回原始温度值, 不以方块高度所带来的影响而判断.

      原文: Gets the temperature for the given block coordinates.

      It is safe to run this method when the block does not exist, it will not create the block.

      This method will return the raw temperature without adjusting for block height effects.

      参数:
      x - 方块的x坐标
      z - 方块的z坐标
      返回:
      查询方块的温度
    • getTemperature

      double getTemperature(int x, int y, int z)
      Gets the temperature for the given block coordinates.

      It is safe to run this method when the block does not exist, it will not create the block.

      This method will return the raw temperature without adjusting for block height effects.

      参数:
      x - X coordinate of the block
      y - Y coordinate of the block
      z - Z coordinate of the block
      返回:
      Temperature of the requested block
    • getHumidity

      @Deprecated double getHumidity(int x, int z)
      已过时。
      1.15更新后生物群系已三维化
      获取指定方块坐标的湿度。

      方块不存在时运行这个方法是安全的,它不会创建方块。

      原文: Gets the humidity for the given block coordinates.

      It is safe to run this method when the block does not exist, it will not create the block.

      参数:
      x - 方块的x坐标
      z - 方块的z坐标
      返回:
      查询方块的湿度
    • getHumidity

      double getHumidity(int x, int y, int z)
      Gets the humidity for the given block coordinates.

      It is safe to run this method when the block does not exist, it will not create the block.

      参数:
      x - X coordinate of the block
      y - Y coordinate of the block
      z - Z coordinate of the block
      返回:
      Humidity of the requested block
    • getLogicalHeight

      int getLogicalHeight()
      Gets the maximum height to which chorus fruits and nether portals can bring players within this dimension. This excludes portals that were already built above the limit as they still connect normally. May not be greater than WorldInfo.getMaxHeight().
      返回:
      maximum logical height for chorus fruits and nether portals
    • isNatural

      boolean isNatural()
      Gets if this world is natural. When false, compasses spin randomly, and using a bed to set the respawn point or sleep, is disabled. When true, nether portals can spawn zombified piglins.
      返回:
      true if world is natural
    • isBedWorks

      boolean isBedWorks()
      Gets if beds work in this world. A non-working bed will blow up when trying to sleep. isNatural() defines if a bed can be used to set spawn point.
      返回:
      true if beds work in this world
    • hasSkyLight

      boolean hasSkyLight()
      Gets if this world has skylight access.
      返回:
      true if this world has skylight access
    • hasCeiling

      boolean hasCeiling()
      Gets if this world has a ceiling.
      返回:
      true if this world has a bedrock ceiling
    • isPiglinSafe

      boolean isPiglinSafe()
      Gets if this world allow to piglins to survive without shaking and transforming to zombified piglins.
      返回:
      true if piglins will not transform to zombified piglins
    • isRespawnAnchorWorks

      boolean isRespawnAnchorWorks()
      Gets if this world allows players to charge and use respawn anchors.
      返回:
      true if players can charge and use respawn anchors
    • hasRaids

      boolean hasRaids()
      Gets if players with the bad omen effect in this world will trigger a raid.
      返回:
      true if raids will be triggered
    • isUltraWarm

      boolean isUltraWarm()
      Gets if various water/lava mechanics will be triggered in this world, eg:
      • Water is evaporated
      • Sponges dry
      • Lava spreads faster and further
      返回:
      true if this world has the above mechanics
    • getSeaLevel

      int getSeaLevel()
      获取世界的海平面。

      这个值总是WorldInfo.getMaxHeight()的一半

      原文: Gets the sea level for this world.

      This is often half of WorldInfo.getMaxHeight()

      返回:
      海平面高度
    • getKeepSpawnInMemory

      @Deprecated boolean getKeepSpawnInMemory()
      已过时。
      使用 GameRule.SPAWN_CHUNK_RADIUS 以更好地控制
      获取世界的出生点是否会在内存中保存加载。

      原文: Gets whether the world's spawn area should be kept loaded into memory or not.

      返回:
      如果世界的出生地区会在内存中保存加载则返回true
    • setKeepSpawnInMemory

      @Deprecated void setKeepSpawnInMemory(boolean keepLoaded)
      已过时。
      使用 GameRule.SPAWN_CHUNK_RADIUS 以更好地控制
      设置世界的出生点是否会在内存中保存加载。

      原文: Sets whether the world's spawn area should be kept loaded into memory or not.

      参数:
      keepLoaded - 如果为true则世界的出生地区会在内存中保存加载
    • isAutoSave

      boolean isAutoSave()
      获取世界是否会自动保存。

      原文: Gets whether or not the world will automatically save

      返回:
      如果世界会自动保存则返回true,否则返回false
    • setAutoSave

      void setAutoSave(boolean value)
      设置世界是否会自动保存。

      原文: Sets whether or not the world will automatically save

      参数:
      value - 如果为true则世界会自动保存,否则为false
    • setDifficulty

      void setDifficulty(@NotNull @NotNull Difficulty difficulty)
      设置世界的游戏难度。

      原文: Sets the Difficulty of the world.

      参数:
      difficulty - 设置的世界的新难度
    • getDifficulty

      @NotNull @NotNull Difficulty getDifficulty()
      获取世界的游戏难度。

      原文: Gets the Difficulty of the world.

      返回:
      世界的难度
    • getViewDistance

      int getViewDistance()
      Returns the view distance used for this world.
      返回:
      the view distance used for this world
    • getSimulationDistance

      int getSimulationDistance()
      Returns the simulation distance used for this world.
      返回:
      the simulation distance used for this world
    • getWorldFolder

      @NotNull @NotNull File getWorldFolder()
      获取这个世界保存在磁盘的哪个文件夹。

      原文: Gets the folder of this world on disk.

      返回:
      这个世界所在的文件夹
    • getWorldType

      已过时。
      world type is only used to select the default word generation settings and is not stored in Vanilla worlds, making it impossible for this method to always return the correct value.
      获取世界类型。

      原文: Gets the type of this world.

      返回:
      世界类型
    • canGenerateStructures

      boolean canGenerateStructures()
      获取建筑物是否会被生成。

      原文: Gets whether or not structures are being generated.

      返回:
      如果建筑物会被生成则返回true
    • isHardcore

      boolean isHardcore()
      Gets whether the world is hardcore or not. In a hardcore world the difficulty is locked to hard.
      返回:
      hardcore status
    • setHardcore

      void setHardcore(boolean hardcore)
      Sets whether the world is hardcore or not. In a hardcore world the difficulty is locked to hard.
      参数:
      hardcore - Whether the world is hardcore
    • getTicksPerAnimalSpawns

      @Deprecated long getTicksPerAnimalSpawns()
      已过时。
      获取世界生成动物的时间间隔(单位为tick)。

      这个数值决定每次尝试生成动物之间的时间间隔(单位为tick)。

      用法示例:

      • 数值为1意味着服务器每1tick都会尝试在这个世界生成动物。
      • 数值为400意味着服务器每400tick会尝试在这个世界生成动物。
      • 数值低于0则会被重置为Minecraft的默认值。

      注意: 如果设置为0,则会禁止这个世界生成动物。我们一般使用setSpawnFlags(boolean, boolean)来代替。

      Minecraft的默认值:400。

      原文: Gets the world's ticks per animal spawns value

      This value determines how many ticks there are between attempts to spawn animals.

      Example Usage:

      • A value of 1 will mean the server will attempt to spawn animals in this world every tick.
      • A value of 400 will mean the server will attempt to spawn animals in this world every 400th tick.
      • A value below 0 will be reset back to Minecraft's default.

      Note: If set to 0, animal spawning will be disabled for this world. We recommend using setSpawnFlags(boolean, boolean) to control this instead.

      Minecraft default: 400.

      返回:
      世界生成动物的时间间隔(单位为tick)
    • setTicksPerAnimalSpawns

      @Deprecated void setTicksPerAnimalSpawns(int ticksPerAnimalSpawns)
      已过时。
      设置世界生成动物的时间间隔(单位为tick)。

      这个数值决定每次尝试生成动物之间的时间间隔(单位为tick)。

      用法示例:

      • 数值为1意味着服务器每1tick都会尝试在这个世界生成动物。
      • 数值为400意味着服务器每400tick会尝试在这个世界生成动物。
      • 数值低于0则会被重置为Minecraft的默认值。

      注意: 如果设置为0,则会禁止这个世界生成动物。我们一般使用setSpawnFlags(boolean, boolean)来代替。

      Minecraft的默认值:400。

      原文: Sets the world's ticks per animal spawns value

      This value determines how many ticks there are between attempts to spawn animals.

      Example Usage:

      • A value of 1 will mean the server will attempt to spawn animals in this world every tick.
      • A value of 400 will mean the server will attempt to spawn animals in this world every 400th tick.
      • A value below 0 will be reset back to Minecraft's default.

      Note: If set to 0, animal spawning will be disabled for this world. We recommend using setSpawnFlags(boolean, boolean) to control this instead.

      Minecraft default: 400.

      参数:
      ticksPerAnimalSpawns - 设置的世界生成动物的时间间隔(单位为tick)
    • getTicksPerMonsterSpawns

      @Deprecated long getTicksPerMonsterSpawns()
      已过时。
      获取世界生成怪物的时间间隔(单位为tick)。

      这个数值决定每次尝试生成怪物之间的时间间隔(单位为tick)。

      用法示例:

      • 数值为1意味着服务器每1tick都会尝试在这个世界生成怪物。
      • 数值为400意味着服务器每400tick会尝试在这个世界生成怪物。
      • 数值低于0则会被重置为Minecraft的默认值。

      注意: 如果设置为0,则会禁止这个世界生成怪物。我们一般使用setSpawnFlags(boolean, boolean)来代替。

      Minecraft的默认值:1。

      原文: Gets the world's ticks per monster spawns value

      This value determines how many ticks there are between attempts to spawn monsters.

      Example Usage:

      • A value of 1 will mean the server will attempt to spawn monsters in this world every tick.
      • A value of 400 will mean the server will attempt to spawn monsters in this world every 400th tick.
      • A value below 0 will be reset back to Minecraft's default.

      Note: If set to 0, monsters spawning will be disabled for this world. We recommend using setSpawnFlags(boolean, boolean) to control this instead.

      Minecraft default: 1.

      返回:
      世界生成怪物的时间间隔(单位为tick)
    • setTicksPerMonsterSpawns

      @Deprecated void setTicksPerMonsterSpawns(int ticksPerMonsterSpawns)
      已过时。
      设置世界生成怪物的时间间隔(单位为tick)。

      这个数值决定每次尝试生成怪物之间的时间间隔(单位为tick)。

      用法示例:

      • 数值为1意味着服务器每1tick都会尝试在这个世界生成怪物。
      • 数值为400意味着服务器每400tick会尝试在这个世界生成怪物。
      • 数值低于0则会被重置为Minecraft的默认值。

      注意: 如果设置为0,则会禁止这个世界生成怪物。我们一般使用setSpawnFlags(boolean, boolean)来代替。

      Minecraft的默认值:1。

      原文: Sets the world's ticks per monster spawns value

      This value determines how many ticks there are between attempts to spawn monsters.

      Example Usage:

      • A value of 1 will mean the server will attempt to spawn monsters in this world on every tick.
      • A value of 400 will mean the server will attempt to spawn monsters in this world every 400th tick.
      • A value below 0 will be reset back to Minecraft's default.

      Note: If set to 0, monsters spawning will be disabled for this world. We recommend using setSpawnFlags(boolean, boolean) to control this instead.

      Minecraft default: 1.

      参数:
      ticksPerMonsterSpawns - 设置的世界生成怪物的时间间隔(单位为tick)
    • getTicksPerWaterSpawns

      @Deprecated long getTicksPerWaterSpawns()
      已过时。
      Gets the world's ticks per water mob spawns value

      This value determines how many ticks there are between attempts to spawn water mobs.

      Example Usage:

      • A value of 1 will mean the server will attempt to spawn water mobs in this world every tick.
      • A value of 400 will mean the server will attempt to spawn water mobs in this world every 400th tick.
      • A value below 0 will be reset back to Minecraft's default.

      Note: If set to 0, water mobs spawning will be disabled for this world.

      Minecraft default: 1.

      返回:
      The world's ticks per water mob spawns value
    • setTicksPerWaterSpawns

      @Deprecated void setTicksPerWaterSpawns(int ticksPerWaterSpawns)
      已过时。
      Sets the world's ticks per water mob spawns value

      This value determines how many ticks there are between attempts to spawn water mobs.

      Example Usage:

      • A value of 1 will mean the server will attempt to spawn water mobs in this world on every tick.
      • A value of 400 will mean the server will attempt to spawn water mobs in this world every 400th tick.
      • A value below 0 will be reset back to Minecraft's default.

      Note: If set to 0, water mobs spawning will be disabled for this world.

      Minecraft default: 1.

      参数:
      ticksPerWaterSpawns - the ticks per water mob spawns value you want to set the world to
    • getTicksPerWaterAmbientSpawns

      @Deprecated long getTicksPerWaterAmbientSpawns()
      已过时。
      Deprecated in favor of getTicksPerSpawns(SpawnCategory)
      Gets the default ticks per water ambient mob spawns value.

      Example Usage:

      • A value of 1 will mean the server will attempt to spawn water ambient mobs every tick.
      • A value of 400 will mean the server will attempt to spawn water ambient mobs every 400th tick.
      • A value below 0 will be reset back to Minecraft's default.

      Note: If set to 0, ambient mobs spawning will be disabled.

      Minecraft default: 1.

      返回:
      the default ticks per water ambient mobs spawn value
    • setTicksPerWaterAmbientSpawns

      @Deprecated void setTicksPerWaterAmbientSpawns(int ticksPerAmbientSpawns)
      已过时。
      Sets the world's ticks per water ambient mob spawns value

      This value determines how many ticks there are between attempts to spawn water ambient mobs.

      Example Usage:

      • A value of 1 will mean the server will attempt to spawn water ambient mobs in this world on every tick.
      • A value of 400 will mean the server will attempt to spawn water ambient mobs in this world every 400th tick.
      • A value below 0 will be reset back to Minecraft's default.

      Note: If set to 0, water ambient mobs spawning will be disabled for this world.

      Minecraft default: 1.

      参数:
      ticksPerAmbientSpawns - the ticks per water ambient mob spawns value you want to set the world to
    • getTicksPerWaterUndergroundCreatureSpawns

      @Deprecated long getTicksPerWaterUndergroundCreatureSpawns()
      已过时。
      Deprecated in favor of getTicksPerSpawns(SpawnCategory)
      Gets the default ticks per water underground creature spawns value.

      Example Usage:

      • A value of 1 will mean the server will attempt to spawn water underground creature every tick.
      • A value of 400 will mean the server will attempt to spawn water underground creature every 400th tick.
      • A value below 0 will be reset back to Minecraft's default.

      Note: If set to 0, water underground creature spawning will be disabled.

      Minecraft default: 1.

      返回:
      the default ticks per water underground creature spawn value
    • setTicksPerWaterUndergroundCreatureSpawns

      @Deprecated void setTicksPerWaterUndergroundCreatureSpawns(int ticksPerWaterUndergroundCreatureSpawns)
      已过时。
      Sets the world's ticks per water underground creature spawns value

      This value determines how many ticks there are between attempts to spawn water underground creature.

      Example Usage:

      • A value of 1 will mean the server will attempt to spawn water underground creature in this world on every tick.
      • A value of 400 will mean the server will attempt to spawn water underground creature in this world every 400th tick.
      • A value below 0 will be reset back to Minecraft's default.

      Note: If set to 0, water underground creature spawning will be disabled for this world.

      Minecraft default: 1.

      参数:
      ticksPerWaterUndergroundCreatureSpawns - the ticks per water underground creature spawns value you want to set the world to
    • getTicksPerAmbientSpawns

      @Deprecated long getTicksPerAmbientSpawns()
      已过时。
      Deprecated in favor of getTicksPerSpawns(SpawnCategory)
      Gets the world's ticks per ambient mob spawns value

      This value determines how many ticks there are between attempts to spawn ambient mobs.

      Example Usage:

      • A value of 1 will mean the server will attempt to spawn ambient mobs in this world every tick.
      • A value of 400 will mean the server will attempt to spawn ambient mobs in this world every 400th tick.
      • A value below 0 will be reset back to Minecraft's default.

      Note: If set to 0, ambient mobs spawning will be disabled for this world.

      Minecraft default: 1.

      返回:
      the default ticks per ambient mobs spawn value
    • setTicksPerAmbientSpawns

      @Deprecated void setTicksPerAmbientSpawns(int ticksPerAmbientSpawns)
      已过时。
      Sets the world's ticks per ambient mob spawns value

      This value determines how many ticks there are between attempts to spawn ambient mobs.

      Example Usage:

      • A value of 1 will mean the server will attempt to spawn ambient mobs in this world on every tick.
      • A value of 400 will mean the server will attempt to spawn ambient mobs in this world every 400th tick.
      • A value below 0 will be reset back to Minecraft's default.

      Note: If set to 0, ambient mobs spawning will be disabled for this world.

      Minecraft default: 1.

      参数:
      ticksPerAmbientSpawns - the ticks per ambient mob spawns value you want to set the world to
    • getTicksPerSpawns

      long getTicksPerSpawns(@NotNull @NotNull SpawnCategory spawnCategory)
      Gets the world's ticks per SpawnCategory mob spawns value

      This value determines how many ticks there are between attempts to spawn SpawnCategory mobs.

      Example Usage:

      • A value of 1 will mean the server will attempt to spawn SpawnCategory mobs in this world every tick.
      • A value of 400 will mean the server will attempt to spawn SpawnCategory mobs in this world every 400th tick.
      • A value below 0 will be reset back to Minecraft's default.

      Note: If set to 0, SpawnCategory mobs spawning will be disabled for this world.

      Minecraft default: 1.

      参数:
      spawnCategory - the category spawn
      返回:
      The world's ticks per SpawnCategory mob spawns value
    • setTicksPerSpawns

      void setTicksPerSpawns(@NotNull @NotNull SpawnCategory spawnCategory, int ticksPerCategorySpawn)
      Sets the world's ticks per SpawnCategory mob spawns value

      This value determines how many ticks there are between attempts to spawn SpawnCategory mobs.

      Example Usage:

      • A value of 1 will mean the server will attempt to spawn SpawnCategory mobs in this world on every tick.
      • A value of 400 will mean the server will attempt to spawn SpawnCategory mobs in this world every 400th tick.
      • A value below 0 will be reset back to Minecraft's default.

      Note: If set to 0, SpawnCategory mobs spawning will be disabled for this world.

      Minecraft default: 1.

      参数:
      spawnCategory - the category spawn
      ticksPerCategorySpawn - the ticks per SpawnCategory mob spawns value you want to set the world to
    • getMonsterSpawnLimit

      @Deprecated int getMonsterSpawnLimit()
      已过时。
      获取这个世界一个区块内的怪物生成数限制。

      原文: Gets limit for number of monsters that can spawn in a chunk in this world

      返回:
      怪物生成限制
    • setMonsterSpawnLimit

      @Deprecated void setMonsterSpawnLimit(int limit)
      已过时。
      设置这个世界一个区块内的怪物生成数限制。

      注意:如果设置为负数则这个世界会使用服务器普遍的生成限制来代替。

      原文: Sets the limit for number of monsters that can spawn in a chunk in this world

      Note: If set to a negative number the world will use the server-wide spawn limit instead.

      参数:
      limit - 新的怪物限制
    • getAnimalSpawnLimit

      @Deprecated int getAnimalSpawnLimit()
      已过时。
      获取这个世界一个区块内的动物生成数限制。

      原文: Gets the limit for number of animals that can spawn in a chunk in this world

      返回:
      动物生成限制
    • setAnimalSpawnLimit

      @Deprecated void setAnimalSpawnLimit(int limit)
      已过时。
      设置这个世界一个区块内的动物生成数限制。

      注意:如果设置为负数则这个世界会使用服务器普遍的生成限制来代替。

      原文: Sets the limit for number of animals that can spawn in a chunk in this world

      Note: If set to a negative number the world will use the server-wide spawn limit instead.

      参数:
      limit - 新的动物限制
    • getWaterAnimalSpawnLimit

      @Deprecated int getWaterAnimalSpawnLimit()
      已过时。
      获取这个世界一个区块内的水生动物生成数限制。

      原文: Gets the limit for number of water animals that can spawn in a chunk in this world

      返回:
      水生动物生成限制
    • setWaterAnimalSpawnLimit

      @Deprecated void setWaterAnimalSpawnLimit(int limit)
      已过时。
      设置这个世界一个区块内的水生动物生成数限制。

      注意:如果设置为负数则这个世界会使用服务器普遍的生成限制来代替。

      原文: Sets the limit for number of water animals that can spawn in a chunk in this world

      Note: If set to a negative number the world will use the server-wide spawn limit instead.

      参数:
      limit - 新的水生动物限制
    • getWaterUndergroundCreatureSpawnLimit

      @Deprecated int getWaterUndergroundCreatureSpawnLimit()
      已过时。
      Deprecated in favor of getSpawnLimit(SpawnCategory)
      Gets the limit for number of water underground creature that can spawn in a chunk in this world
      返回:
      The water underground creature spawn limit
    • setWaterUndergroundCreatureSpawnLimit

      @Deprecated void setWaterUndergroundCreatureSpawnLimit(int limit)
      已过时。
      Deprecated in favor of setSpawnLimit(SpawnCategory, int)
      Sets the limit for number of water underground creature that can spawn in a chunk in this world

      Note: If set to a negative number the world will use the server-wide spawn limit instead.

      参数:
      limit - the new mob limit
    • getWaterAmbientSpawnLimit

      @Deprecated int getWaterAmbientSpawnLimit()
      已过时。
      Deprecated in favor of getSpawnLimit(SpawnCategory)
      Gets user-specified limit for number of water ambient mobs that can spawn in a chunk.
      返回:
      the water ambient spawn limit
    • setWaterAmbientSpawnLimit

      @Deprecated void setWaterAmbientSpawnLimit(int limit)
      已过时。
      Deprecated in favor of setSpawnLimit(SpawnCategory, int)
      Sets the limit for number of water ambient mobs that can spawn in a chunk in this world

      Note: If set to a negative number the world will use the server-wide spawn limit instead.

      参数:
      limit - the new mob limit
    • getAmbientSpawnLimit

      @Deprecated int getAmbientSpawnLimit()
      已过时。
      获取这个世界一个区块内周围的怪物的生成数限制。

      原文: Gets the limit for number of ambient mobs that can spawn in a chunk in this world

      返回:
      周围的怪物的生成限制
    • setAmbientSpawnLimit

      @Deprecated void setAmbientSpawnLimit(int limit)
      已过时。
      设置这个世界一个区块内周围的怪物的生成数限制。

      注意:如果设置为负数则这个世界会使用服务器普遍的生成限制来代替。

      原文: Sets the limit for number of ambient mobs that can spawn in a chunk in this world

      Note: If set to a negative number the world will use the server-wide spawn limit instead.

      参数:
      limit - 新的周围的怪物的限制
    • getSpawnLimit

      int getSpawnLimit(@NotNull @NotNull SpawnCategory spawnCategory)
      Gets the limit for number of SpawnCategory entities that can spawn in a chunk in this world
      参数:
      spawnCategory - the entity category
      返回:
      The ambient spawn limit
    • setSpawnLimit

      void setSpawnLimit(@NotNull @NotNull SpawnCategory spawnCategory, int limit)
      Sets the limit for number of SpawnCategory entities that can spawn in a chunk in this world

      Note: If set to a negative number the world will use the server-wide spawn limit instead.

      参数:
      spawnCategory - the entity category
      limit - the new mob limit
    • playNote

      void playNote(@NotNull @NotNull Location loc, @NotNull @NotNull Instrument instrument, @NotNull @NotNull Note note)
      Play a note at the provided Location in the World.
      This will work with cake.

      This method will fail silently when called with Instrument.CUSTOM_HEAD.

      参数:
      loc - The location to play the note
      instrument - The instrument
      note - The note
    • playSound

      void playSound(@NotNull @NotNull Location location, @NotNull @NotNull Sound sound, float volume, float pitch)
      在世界中指定的位置播放一个声音。

      如果位置或声音为空则这个函数会失效。

      原文: Play a Sound at the provided Location in the World

      This function will fail silently if Location or Sound are null.

      参数:
      location - 演奏声音的位置
      sound - 要播放的声音
      volume - 声音音量
      pitch - 声音音调
    • playSound

      void playSound(@NotNull @NotNull Location location, @NotNull @NotNull String sound, float volume, float pitch)
      Play a Sound at the provided Location in the World.

      This function will fail silently if Location or Sound are null. No sound will be heard by the players if their clients do not have the respective sound for the value passed.

      参数:
      location - The location to play the sound
      sound - The internal sound name to play
      volume - The volume of the sound
      pitch - The pitch of the sound
    • playSound

      void playSound(@NotNull @NotNull Location location, @NotNull @NotNull Sound sound, @NotNull @NotNull SoundCategory category, float volume, float pitch)
      Play a Sound at the provided Location in the World.

      This function will fail silently if Location or Sound are null.

      参数:
      location - The location to play the sound
      sound - The sound to play
      category - the category of the sound
      volume - The volume of the sound
      pitch - The pitch of the sound
    • playSound

      void playSound(@NotNull @NotNull Location location, @NotNull @NotNull String sound, @NotNull @NotNull SoundCategory category, float volume, float pitch)
      Play a Sound at the provided Location in the World.

      This function will fail silently if Location or Sound are null. No sound will be heard by the players if their clients do not have the respective sound for the value passed.

      参数:
      location - The location to play the sound
      sound - The internal sound name to play
      category - The category of the sound
      volume - The volume of the sound
      pitch - The pitch of the sound
    • playSound

      void playSound(@NotNull @NotNull Location location, @NotNull @NotNull Sound sound, @NotNull @NotNull SoundCategory category, float volume, float pitch, long seed)
      Play a Sound at the provided Location in the World. For sounds with multiple variations passing the same seed will always play the same variation.

      This function will fail silently if Location or Sound are null.

      参数:
      location - The location to play the sound
      sound - The sound to play
      category - the category of the sound
      volume - The volume of the sound
      pitch - The pitch of the sound
      seed - The seed for the sound
    • playSound

      void playSound(@NotNull @NotNull Location location, @NotNull @NotNull String sound, @NotNull @NotNull SoundCategory category, float volume, float pitch, long seed)
      Play a Sound at the provided Location in the World. For sounds with multiple variations passing the same seed will always play the same variation.

      This function will fail silently if Location or Sound are null. No sound will be heard by the players if their clients do not have the respective sound for the value passed.

      参数:
      location - The location to play the sound
      sound - The internal sound name to play
      category - the category of the sound
      volume - The volume of the sound
      pitch - The pitch of the sound
      seed - The seed for the sound
    • playSound

      void playSound(@NotNull @NotNull Entity entity, @NotNull @NotNull Sound sound, float volume, float pitch)
      Play a Sound at the location of the provided entity in the World.

      This function will fail silently if Entity or Sound are null.

      参数:
      entity - The entity to play the sound
      sound - The sound to play
      volume - The volume of the sound
      pitch - The pitch of the sound
    • playSound

      void playSound(@NotNull @NotNull Entity entity, @NotNull @NotNull String sound, float volume, float pitch)
      Play a Sound at the location of the provided entity in the World.

      This function will fail silently if Entity or Sound are null.

      参数:
      entity - The entity to play the sound
      sound - The sound to play
      volume - The volume of the sound
      pitch - The pitch of the sound
    • playSound

      void playSound(@NotNull @NotNull Entity entity, @NotNull @NotNull Sound sound, @NotNull @NotNull SoundCategory category, float volume, float pitch)
      Play a Sound at the location of the provided entity in the World.

      This function will fail silently if Entity or Sound are null.

      参数:
      entity - The entity to play the sound
      sound - The sound to play
      category - the category of the sound
      volume - The volume of the sound
      pitch - The pitch of the sound
    • playSound

      void playSound(@NotNull @NotNull Entity entity, @NotNull @NotNull String sound, @NotNull @NotNull SoundCategory category, float volume, float pitch)
      Play a Sound at the location of the provided entity in the World.

      This function will fail silently if Entity or Sound are null.

      参数:
      entity - The entity to play the sound
      sound - The sound to play
      category - The category of the sound
      volume - The volume of the sound
      pitch - The pitch of the sound
    • playSound

      void playSound(@NotNull @NotNull Entity entity, @NotNull @NotNull Sound sound, @NotNull @NotNull SoundCategory category, float volume, float pitch, long seed)
      Play a Sound at the location of the provided entity in the World. For sounds with multiple variations passing the same seed will always play the same variation.

      This function will fail silently if Entity or Sound are null.

      参数:
      entity - The entity to play the sound
      sound - The sound to play
      category - The category of the sound
      volume - The volume of the sound
      pitch - The pitch of the sound
      seed - The seed for the sound
    • playSound

      void playSound(@NotNull @NotNull Entity entity, @NotNull @NotNull String sound, @NotNull @NotNull SoundCategory category, float volume, float pitch, long seed)
      Play a Sound at the location of the provided entity in the World. For sounds with multiple variations passing the same seed will always play the same variation.

      This function will fail silently if Entity or Sound are null.

      参数:
      entity - The entity to play the sound
      sound - The sound to play
      category - The category of the sound
      volume - The volume of the sound
      pitch - The pitch of the sound
      seed - The seed for the sound
    • getGameRules

      @NotNull @NotNull String[] getGameRules()
      获取包含所有游戏规则的数组.

      原文:Get an array containing the names of all the GameRules.

      返回:
      游戏规则名列表.
    • getGameRuleValue

      @Deprecated @Contract("null -> null; !null -> !null") @Nullable @Nullable String getGameRuleValue(@Nullable @Nullable String rule)
      已过时。
      获取指定游戏规则的当前状态.

      如果rule为null则会返回null.

      原文: Gets the current state of the specified rule

      Will return null if rule passed is null

      参数:
      rule - 要查找的规则
      返回:
      规则的字符串数值
    • setGameRuleValue

      @Deprecated boolean setGameRuleValue(@NotNull @NotNull String rule, @NotNull @NotNull String value)
      已过时。
      将指定的游戏规则设置为指定数值.

      规则可能会尝试验证值,如果数值被设置则会返回true.

      如果rule为null,则这个函数会返回false.

      原文: Set the specified gamerule to specified value.

      The rule may attempt to validate the value passed, will return true if value was set.

      If rule is null, the function will return false.

      参数:
      rule - 要设置的规则
      value - 要设置的规则数值
      返回:
      规则被设置则返回true
    • isGameRule

      boolean isGameRule(@NotNull @NotNull String rule)
      检查字符串是否是一个有效的游戏规则.

      原文: Checks if string is a valid game rule

      参数:
      rule - 要检测的规则
      返回:
      如果规则存在则返回true
    • getGameRuleValue

      @Nullable <T> T getGameRuleValue(@NotNull @NotNull GameRule<T> rule)
      获取给定的游戏规则的数据值.

      原文:Get the current value for a given GameRule.

      类型参数:
      T - 游戏规则数据类型
      参数:
      rule - 游戏规则
      返回:
      游戏规则值
    • getGameRuleDefault

      @Nullable <T> T getGameRuleDefault(@NotNull @NotNull GameRule<T> rule)
      获取给定游戏规则的默认值. 不保证该值与当前值匹配.

      原文:Get the default value for a given GameRule. This value is not guaranteed to match the current value.

      类型参数:
      T - 游戏规则数据类型
      参数:
      rule - 游戏规则
      返回:
      游戏规则默认值
    • setGameRule

      <T> boolean setGameRule(@NotNull @NotNull GameRule<T> rule, @NotNull T newValue)
      设置给定游戏规则的数据值.

      原文:Set the given GameRule's new value.

      类型参数:
      T - 对应游戏规则的数据类型
      参数:
      rule - 要更新的游戏规则
      newValue - 值
      返回:
      若设置成功返回true
    • getWorldBorder

      @NotNull @NotNull WorldBorder getWorldBorder()
      获取这个世界的世界边界对象。

      原文: Gets the world border for this world.

      返回:
      这个世界的世界边界对象
    • spawnParticle

      void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count)
      Spawns the particle (the number of times specified by count) at the target location.
      参数:
      particle - the particle to spawn
      location - the location to spawn at
      count - the number of particles
    • spawnParticle

      void spawnParticle(@NotNull @NotNull Particle particle, double x, double y, double z, int count)
      Spawns the particle (the number of times specified by count) at the target location.
      参数:
      particle - the particle to spawn
      x - the position on the x axis to spawn at
      y - the position on the y axis to spawn at
      z - the position on the z axis to spawn at
      count - the number of particles
    • spawnParticle

      <T> void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count, @Nullable T data)
      Spawns the particle (the number of times specified by count) at the target location.
      类型参数:
      T - type of particle data (see Particle.getDataType()
      参数:
      particle - the particle to spawn
      location - the location to spawn at
      count - the number of particles
      data - the data to use for the particle or null, the type of this depends on Particle.getDataType()
    • spawnParticle

      <T> void spawnParticle(@NotNull @NotNull Particle particle, double x, double y, double z, int count, @Nullable T data)
      Spawns the particle (the number of times specified by count) at the target location.
      类型参数:
      T - type of particle data (see Particle.getDataType()
      参数:
      particle - the particle to spawn
      x - the position on the x axis to spawn at
      y - the position on the y axis to spawn at
      z - the position on the z axis to spawn at
      count - the number of particles
      data - the data to use for the particle or null, the type of this depends on Particle.getDataType()
    • spawnParticle

      void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ)
      Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.
      参数:
      particle - the particle to spawn
      location - the location to spawn at
      count - the number of particles
      offsetX - the maximum random offset on the X axis
      offsetY - the maximum random offset on the Y axis
      offsetZ - the maximum random offset on the Z axis
    • spawnParticle

      void spawnParticle(@NotNull @NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ)
      Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.
      参数:
      particle - the particle to spawn
      x - the position on the x axis to spawn at
      y - the position on the y axis to spawn at
      z - the position on the z axis to spawn at
      count - the number of particles
      offsetX - the maximum random offset on the X axis
      offsetY - the maximum random offset on the Y axis
      offsetZ - the maximum random offset on the Z axis
    • spawnParticle

      <T> void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, @Nullable T data)
      Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.
      类型参数:
      T - type of particle data (see Particle.getDataType()
      参数:
      particle - the particle to spawn
      location - the location to spawn at
      count - the number of particles
      offsetX - the maximum random offset on the X axis
      offsetY - the maximum random offset on the Y axis
      offsetZ - the maximum random offset on the Z axis
      data - the data to use for the particle or null, the type of this depends on Particle.getDataType()
    • spawnParticle

      <T> void spawnParticle(@NotNull @NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, @Nullable T data)
      Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.
      类型参数:
      T - type of particle data (see Particle.getDataType()
      参数:
      particle - the particle to spawn
      x - the position on the x axis to spawn at
      y - the position on the y axis to spawn at
      z - the position on the z axis to spawn at
      count - the number of particles
      offsetX - the maximum random offset on the X axis
      offsetY - the maximum random offset on the Y axis
      offsetZ - the maximum random offset on the Z axis
      data - the data to use for the particle or null, the type of this depends on Particle.getDataType()
    • spawnParticle

      void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, double extra)
      Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.
      参数:
      particle - the particle to spawn
      location - the location to spawn at
      count - the number of particles
      offsetX - the maximum random offset on the X axis
      offsetY - the maximum random offset on the Y axis
      offsetZ - the maximum random offset on the Z axis
      extra - the extra data for this particle, depends on the particle used (normally speed)
    • spawnParticle

      void spawnParticle(@NotNull @NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra)
      Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.
      参数:
      particle - the particle to spawn
      x - the position on the x axis to spawn at
      y - the position on the y axis to spawn at
      z - the position on the z axis to spawn at
      count - the number of particles
      offsetX - the maximum random offset on the X axis
      offsetY - the maximum random offset on the Y axis
      offsetZ - the maximum random offset on the Z axis
      extra - the extra data for this particle, depends on the particle used (normally speed)
    • spawnParticle

      <T> void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data)
      Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.
      类型参数:
      T - type of particle data (see Particle.getDataType()
      参数:
      particle - the particle to spawn
      location - the location to spawn at
      count - the number of particles
      offsetX - the maximum random offset on the X axis
      offsetY - the maximum random offset on the Y axis
      offsetZ - the maximum random offset on the Z axis
      extra - the extra data for this particle, depends on the particle used (normally speed)
      data - the data to use for the particle or null, the type of this depends on Particle.getDataType()
    • spawnParticle

      <T> void spawnParticle(@NotNull @NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data)
      Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.
      类型参数:
      T - type of particle data (see Particle.getDataType()
      参数:
      particle - the particle to spawn
      x - the position on the x axis to spawn at
      y - the position on the y axis to spawn at
      z - the position on the z axis to spawn at
      count - the number of particles
      offsetX - the maximum random offset on the X axis
      offsetY - the maximum random offset on the Y axis
      offsetZ - the maximum random offset on the Z axis
      extra - the extra data for this particle, depends on the particle used (normally speed)
      data - the data to use for the particle or null, the type of this depends on Particle.getDataType()
    • spawnParticle

      <T> void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data, boolean force)
      Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.
      类型参数:
      T - type of particle data (see Particle.getDataType()
      参数:
      particle - the particle to spawn
      location - the location to spawn at
      count - the number of particles
      offsetX - the maximum random offset on the X axis
      offsetY - the maximum random offset on the Y axis
      offsetZ - the maximum random offset on the Z axis
      extra - the extra data for this particle, depends on the particle used (normally speed)
      data - the data to use for the particle or null, the type of this depends on Particle.getDataType()
      force - whether to send the particle to players within an extended range and encourage their client to render it regardless of settings
    • spawnParticle

      <T> void spawnParticle(@NotNull @NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data, boolean force)
      Spawns the particle (the number of times specified by count) at the target location. The position of each particle will be randomized positively and negatively by the offset parameters on each axis.
      类型参数:
      T - type of particle data (see Particle.getDataType()
      参数:
      particle - the particle to spawn
      x - the position on the x axis to spawn at
      y - the position on the y axis to spawn at
      z - the position on the z axis to spawn at
      count - the number of particles
      offsetX - the maximum random offset on the X axis
      offsetY - the maximum random offset on the Y axis
      offsetZ - the maximum random offset on the Z axis
      extra - the extra data for this particle, depends on the particle used (normally speed)
      data - the data to use for the particle or null, the type of this depends on Particle.getDataType()
      force - whether to send the particle to players within an extended range and encourage their client to render it regardless of settings
    • locateNearestStructure

      @Nullable @Deprecated @Nullable Location locateNearestStructure(@NotNull @NotNull Location origin, @NotNull StructureType structureType, int radius, boolean findUnexplored)
      Find the closest nearby structure of a given StructureType. Finding unexplored structures can, and will, block if the world is looking in chunks that gave not generated yet. This can lead to the world temporarily freezing while locating an unexplored structure.

      The radius is not a rigid square radius. Each structure may alter how many chunks to check for each iteration. Do not assume that only a radius x radius chunk area will be checked. For example, StructureType.WOODLAND_MANSION can potentially check up to 20,000 blocks away (or more) regardless of the radius used.

      This will not load or generate chunks. This can also lead to instances where the server can hang if you are only looking for unexplored structures. This is because it will keep looking further and further out in order to find the structure.

      参数:
      origin - where to start looking for a structure
      structureType - the type of structure to find
      radius - the radius, in chunks, around which to search
      findUnexplored - true to only find unexplored structures
      返回:
      the closest Location, or null if no structure of the specified type exists.
      另请参阅:
    • locateNearestStructure

      @Nullable @Nullable StructureSearchResult locateNearestStructure(@NotNull @NotNull Location origin, @NotNull @NotNull StructureType structureType, int radius, boolean findUnexplored)
      Find the closest nearby structure of a given StructureType. Finding unexplored structures can, and will, block if the world is looking in chunks that gave not generated yet. This can lead to the world temporarily freezing while locating an unexplored structure.

      The radius is not a rigid square radius. Each structure may alter how many chunks to check for each iteration. Do not assume that only a radius x radius chunk area will be checked. For example, StructureType.WOODLAND_MANSION can potentially check up to 20,000 blocks away (or more) regardless of the radius used.

      This will not load or generate chunks. This can also lead to instances where the server can hang if you are only looking for unexplored structures. This is because it will keep looking further and further out in order to find the structure.

      The difference between searching for a StructureType and a Structure is, that a StructureType can refer to multiple Structures while searching for a Structure while only search for the given Structure.

      参数:
      origin - where to start looking for a structure
      structureType - the type of structure to find
      radius - the radius, in chunks, around which to search
      findUnexplored - true to only find unexplored structures
      返回:
      the closest Location and Structure, or null if no structure of the specified type exists.
      另请参阅:
    • locateNearestStructure

      @Nullable @Nullable StructureSearchResult locateNearestStructure(@NotNull @NotNull Location origin, @NotNull @NotNull Structure structure, int radius, boolean findUnexplored)
      Find the closest nearby structure of a given Structure. Finding unexplored structures can, and will, block if the world is looking in chunks that gave not generated yet. This can lead to the world temporarily freezing while locating an unexplored structure.

      The radius is not a rigid square radius. Each structure may alter how many chunks to check for each iteration. Do not assume that only a radius x radius chunk area will be checked. For example, Structure.MANSION can potentially check up to 20,000 blocks away (or more) regardless of the radius used.

      This will not load or generate chunks. This can also lead to instances where the server can hang if you are only looking for unexplored structures. This is because it will keep looking further and further out in order to find the structure.

      The difference between searching for a StructureType and a Structure is, that a StructureType can refer to multiple Structures while searching for a Structure while only search for the given Structure.

      参数:
      origin - where to start looking for a structure
      structure - the structure to find
      radius - the radius, in chunks, around which to search
      findUnexplored - true to only find unexplored structures
      返回:
      the closest Location and Structure, or null if no structure was found.
      另请参阅:
    • spigot

    • locateNearestBiome

      @Nullable @Nullable BiomeSearchResult locateNearestBiome(@NotNull @NotNull Location origin, int radius, @NotNull @NotNull Biome... biomes)
      Find the closest nearby location with a biome matching the provided Biome(s). Finding biomes can, and will, block if the world is looking in chunks that have not generated yet. This can lead to the world temporarily freezing while locating a biome.

      Note: This will not reflect changes made to the world after generation, this method only sees the biome at the time of world generation. This will not load or generate chunks.

      If multiple biomes are provided BiomeSearchResult.getBiome() will indicate which one was located.

      This method will use a horizontal interval of 32 and a vertical interval of 64, equal to the /locate command.

      参数:
      origin - where to start looking for a biome
      radius - the radius, in blocks, around which to search
      biomes - the biomes to search for
      返回:
      a BiomeSearchResult containing the closest Location and Biome, or null if no biome was found.
      另请参阅:
    • locateNearestBiome

      @Nullable @Nullable BiomeSearchResult locateNearestBiome(@NotNull @NotNull Location origin, int radius, int horizontalInterval, int verticalInterval, @NotNull @NotNull Biome... biomes)
      Find the closest nearby location with a biome matching the provided Biome(s). Finding biomes can, and will, block if the world is looking in chunks that have not generated yet. This can lead to the world temporarily freezing while locating a biome.

      Note: This will not reflect changes made to the world after generation, this method only sees the biome at the time of world generation. This will not load or generate chunks.

      If multiple biomes are provided BiomeSearchResult.getBiome() will indicate which one was located. Higher values for horizontalInterval and verticalInterval will result in faster searches, but may lead to small biomes being missed.

      参数:
      origin - where to start looking for a biome
      radius - the radius, in blocks, around which to search
      horizontalInterval - the horizontal distance between each check
      verticalInterval - the vertical distance between each check
      biomes - the biomes to search for
      返回:
      a BiomeSearchResult containing the closest Location and Biome, or null if no biome was found.
      另请参阅:
    • locateNearestRaid

      @Nullable @Nullable Raid locateNearestRaid(@NotNull @NotNull Location location, int radius)
      寻找与给定位置相距最近的袭击.

      原文:Finds the nearest raid close to the given location.

      参数:
      location - 源位置
      radius - 搜索半径
      返回:
      最近的袭击, 如果没有找到袭击事件返回null.
    • getRaids

      @NotNull @NotNull List<Raid> getRaids()
      获取本世界正在进行的所有袭击.

      原文:Gets all raids that are going on over this world.

      返回:
      本世界所有活跃的袭击
    • getEnderDragonBattle

      @Nullable @Nullable DragonBattle getEnderDragonBattle()
      Get the DragonBattle associated with this world. If this world's environment is not World.Environment.THE_END, null will be returned.

      If an end world, a dragon battle instance will be returned regardless of whether or not a dragon is present in the world or a fight sequence has been activated. The dragon battle instance acts as a state holder.

      返回:
      the dragon battle instance
    • getFeatureFlags

      @NotNull @NotNull Set<FeatureFlag> getFeatureFlags()
      Get all FeatureFlag enabled in this world.
      返回:
      all enabled FeatureFlag
    • getStructures

      @NotNull @NotNull Collection<GeneratedStructure> getStructures(int x, int z)
      Gets all generated structures that intersect the chunk at the given coordinates.
      If no structures are present an empty collection will be returned.
      参数:
      x - X-coordinate of the chunk
      z - Z-coordinate of the chunk
      返回:
      a collection of placed structures in the chunk at the given coordinates
    • getStructures

      @NotNull @NotNull Collection<GeneratedStructure> getStructures(int x, int z, @NotNull @NotNull Structure structure)
      Gets all generated structures of a given Structure that intersect the chunk at the given coordinates.
      If no structures are present an empty collection will be returned.
      参数:
      x - X-coordinate of the chunk
      z - Z-coordinate of the chunk
      structure - the structure to find
      返回:
      a collection of placed structures in the chunk at the given coordinates