接口 World
-
嵌套类概要
-
方法概要
修饰符和类型方法说明boolean
addPluginChunkTicket
(int x, int z, @NotNull Plugin plugin) Adds a plugin ticket for the specified chunk, loading the chunk if it is not already loaded.boolean
获取建筑物是否会被生成。boolean
createExplosion
(double x, double y, double z, float power) 在指定坐标生成指定威力的爆炸.boolean
createExplosion
(double x, double y, double z, float power, boolean setFire) 在指定的坐标生成指定威力的爆炸并设置方块是否会着火.boolean
createExplosion
(double x, double y, double z, float power, boolean setFire, boolean breakBlocks) 在指定的坐标生成指定威力的爆炸并设置方块是否会着火或被破坏.boolean
createExplosion
(double x, double y, double z, float power, boolean setFire, boolean breakBlocks, @Nullable Entity source) Creates explosion at given coordinates with given power and optionally setting blocks on fire or breaking blocks.boolean
createExplosion
(@NotNull Location loc, float power) 在指定坐标生成指定威力的爆炸.boolean
createExplosion
(@NotNull Location loc, float power, boolean setFire) 在指定的坐标生成指定威力的爆炸并设置方块是否会着火.boolean
createExplosion
(@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.boolean
createExplosion
(@NotNull Location loc, float power, boolean setFire, boolean breakBlocks, @Nullable Entity source) Creates explosion at given coordinates with given power and optionally setting blocks on fire or breaking blocks.在指定的位置
丢出一个物品.dropItem
(@NotNull Location location, @NotNull ItemStack item, @Nullable Consumer<? super Item> function) Drops an item at the specifiedLocation
Note that functions will run before the entity is spawneddropItemNaturally
(@NotNull Location location, @NotNull ItemStack item) 在指定的位置
丢出一个随机偏移的物品.dropItemNaturally
(@NotNull Location location, @NotNull ItemStack item, @Nullable Consumer<? super Item> function) Drops an item at the specifiedLocation
with a random offset Note that functions will run before the entity is spawnedboolean
generateTree
(@NotNull Location location, @NotNull TreeType type) 在指定的位置
创建一颗树.boolean
generateTree
(@NotNull Location loc, @NotNull TreeType type, @NotNull BlockChangeDelegate delegate) 已过时。this method does not handle tile entities (bee nests)boolean
获取动物能不能在这个世界生成。boolean
获取怪物能不能在这个世界生成。int
已过时。int
已过时。getBiome
(int x, int z) 已过时。1.15更新后生物群系已三维化Gets the biome provider for this worldgetBlockAt
(int x, int y, int z) 获取坐标所指的方块
.getBlockAt
(@NotNull Location location) getChunkAt
(int x, int z) 获取给定坐标所在的区块
.getChunkAt
(int x, int z, boolean generate) Gets theChunk
at the given coordinatesgetChunkAt
(@NotNull Block block) getChunkAt
(@NotNull Location location) int
获取晴朗天气的持续时间.获取世界的游戏难度。getEmptyChunkSnapshot
(int x, int z, boolean includeBiome, boolean includeBiomeTemp) 获取空区块的快照(相当于所有空气方块),可设置包含有效生物群系数据。Get theDragonBattle
associated with this world.获取一个这个世界所有实体的列表.<T extends Entity>
@NotNull Collection<T>getEntitiesByClass
(@NotNull Class<T> cls) 获取一个在这个世界的所有与指定的类/接口相匹配的实体的集合.<T extends Entity>
@NotNull Collection<T>getEntitiesByClass
(@NotNull Class<T>... classes) 已过时。getEntitiesByClasses
(@NotNull Class<?>... classes) 获取一个在这个世界的所有与任一指定的类/接口相匹配的实体的集合.Get allFeatureFlag
enabled in this world.Returns all force loaded chunks in this world.long
获取这个世界完整的游戏时间.<T> T
getGameRuleDefault
(@NotNull GameRule<T> rule) 获取给定游戏规则
的默认值.获取包含所有游戏规则
的数组.<T> T
getGameRuleValue
(@NotNull GameRule<T> rule) 获取给定的游戏规则
的数据值.getGameRuleValue
(@Nullable String rule) 已过时。long
Gets the full in-game time on this world since the world generation获取世界的区块生成器.getHighestBlockAt
(int x, int z) 获取指定坐标最高处不是空气且不可逾越的方块.getHighestBlockAt
(int x, int z, @NotNull HeightMap heightMap) Gets the highest block corresponding to theHeightMap
at the given coordinates.getHighestBlockAt
(@NotNull Location location) 获取指定位置
最高处不是空气且不可逾越的方块.getHighestBlockAt
(@NotNull Location location, @NotNull HeightMap heightMap) Gets the highest block corresponding to theHeightMap
at the given coordinates.double
getHumidity
(int x, int z) 已过时。1.15更新后生物群系已三维化double
getHumidity
(int x, int y, int z) Gets the humidity for the given block coordinates.Gets all Chunks intersecting the given BoundingBox.boolean
已过时。使用GameRule.SPAWN_CHUNK_RADIUS
以更好地控制获取一个这个世界所有生物实体的列表.获取一个所有被加载的区块
的数组.int
Gets the maximum height to which chorus fruits and nether portals can bring players within this dimension.int
已过时。getNearbyEntities
(@NotNull Location location, double x, double y, double z) 返回一个以这个位置为中心的包围着的所有实体的列表(译注:这个可能不太好理解,就是在这个位置,按指定的搜索范围,搜索这个范围里的所有实体).getNearbyEntities
(@NotNull Location location, double x, double y, double z, @Nullable Predicate<? super Entity> filter) Returns a list of entities within a bounding box centered around a Location.getNearbyEntities
(@NotNull BoundingBox boundingBox) Returns a list of entities within the given bounding box.getNearbyEntities
(@NotNull BoundingBox boundingBox, @Nullable Predicate<? super Entity> filter) Returns a list of entities within the given bounding box.获取一个这个世界的所有玩家的列表.getPlayersSeeingChunk
(int x, int z) Get a list of all players who are can view the specified chunk from their clientgetPlayersSeeingChunk
(@NotNull Chunk chunk) Get a list of all players who are can view the specified chunk from their clientReturns a map of which plugins have tickets for what chunks.getPluginChunkTickets
(int x, int z) Retrieves a collection specifying which plugins have tickets for the specified chunk.获取一个这个世界使用的所有方块填充器
的列表.boolean
getPVP()
获取世界当前的PVP设置.getRaids()
获取本世界正在进行的所有袭击.int
获取世界的海平面。int
Returns the simulation distance used for this world.int
getSpawnLimit
(@NotNull SpawnCategory spawnCategory) Gets the limit for number ofSpawnCategory
entities that can spawn in a chunk in this world获取这个世界的默认出生点位置
.getStructures
(int x, int z) Gets all generated structures that intersect the chunk at the given coordinates.getStructures
(int x, int z, @NotNull Structure structure) Gets all generated structures of a givenStructure
that intersect the chunk at the given coordinates.double
getTemperature
(int x, int z) 已过时。1.15更新后生物群系已三维化double
getTemperature
(int x, int y, int z) Gets the temperature for the given block coordinates.int
获取这个世界打雷的持续时间.long
已过时。Deprecated in favor ofgetTicksPerSpawns(SpawnCategory)
long
已过时。long
已过时。long
getTicksPerSpawns
(@NotNull SpawnCategory spawnCategory) Gets the world's ticks perSpawnCategory
mob spawns valuelong
已过时。Deprecated in favor ofgetTicksPerSpawns(SpawnCategory)
long
已过时。long
已过时。Deprecated in favor ofgetTicksPerSpawns(SpawnCategory)
long
getTime()
获取这个世界在游戏中的相对时间.int
Returns the view distance used for this world.int
已过时。Deprecated in favor ofgetSpawnLimit(SpawnCategory)
int
已过时。int
已过时。Deprecated in favor ofgetSpawnLimit(SpawnCategory)
int
获取当前天气的剩余时间,单位为tick.获取这个世界的世界边界对象。获取这个世界保存在磁盘的哪个文件夹。已过时。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.boolean
Gets if this world has a ceiling.boolean
hasRaids()
Gets if players with the bad omen effect in this world will trigger a raid.boolean
Gets if this world has skylight access.boolean
hasStorm()
返回世界现在是否有雷暴.boolean
获取世界是否会自动保存。boolean
Gets if beds work in this world.boolean
isChunkForceLoaded
(int x, int z) Gets whether the chunk at the specified chunk coordinates is force loaded.boolean
isChunkGenerated
(int x, int z) 检查指定坐标处的区块
是否已生成.boolean
isChunkInUse
(int x, int z) 已过时。本方法曾被添加用于促进区块的垃圾回收.boolean
isChunkLoaded
(int x, int z) 检查在指定坐标的区块
是否被加载.boolean
isChunkLoaded
(@NotNull Chunk chunk) 检查指定区块
是否已经被加载.boolean
返回世界是否为晴天.boolean
isGameRule
(@NotNull String rule) 检查字符串是否是一个有效的游戏规则.boolean
Gets whether the world is hardcore or not.boolean
Gets if this world is natural.boolean
Gets if this world allow to piglins to survive without shaking and transforming to zombified piglins.boolean
Gets if this world allows players to charge and use respawn anchors.boolean
返回这个世界是否在打雷.boolean
Gets if various water/lava mechanics will be triggered in this world, eg:
Water is evaporated Sponges dry Lava spreads faster and furthervoid
loadChunk
(int x, int z) 加载指定坐标的区块
.boolean
loadChunk
(int x, int z, boolean generate) 加载指定坐标的区块
.void
加载指定的区块
.locateNearestBiome
(@NotNull Location origin, int radius, int horizontalInterval, int verticalInterval, @NotNull Biome... biomes) Find the closest nearby location with a biome matching the providedBiome
(s).locateNearestBiome
(@NotNull Location origin, int radius, @NotNull Biome... biomes) Find the closest nearby location with a biome matching the providedBiome
(s).locateNearestRaid
(@NotNull Location location, int radius) 寻找与给定位置相距最近的袭击.locateNearestStructure
(@NotNull Location origin, @NotNull Structure structure, int radius, boolean findUnexplored) Find the closest nearby structure of a givenStructure
.locateNearestStructure
(@NotNull Location origin, @NotNull StructureType structureType, int radius, boolean findUnexplored) Find the closest nearby structure of a givenStructureType
.locateNearestStructure
(@NotNull Location origin, StructureType structureType, int radius, boolean findUnexplored) void
playEffect
(@NotNull Location location, @NotNull Effect effect, int data) 向以指定位置为圆心的默认半径内的所有玩家施加(给予)一个效果.void
playEffect
(@NotNull Location location, @NotNull Effect effect, int data, int radius) 向在以指定位置为圆心的指定半径内的所有玩家施加(给予)一个效果。<T> void
playEffect
(@NotNull Location location, @NotNull Effect effect, T data) 向在以指定位置为圆心的默认半径内的所有玩家施加(给予)一个效果。<T> void
playEffect
(@NotNull Location location, @NotNull Effect effect, T data, int radius) 向在以指定位置为圆心的指定半径内的所有玩家施加(给予)一个效果。void
Play a note at the provided Location in the World.void
Play a Sound at the location of the provided entity in the World.void
playSound
(@NotNull Entity entity, @NotNull String sound, @NotNull SoundCategory category, float volume, float pitch) Play a Sound at the location of the provided entity in the World.void
playSound
(@NotNull Entity entity, @NotNull String sound, @NotNull SoundCategory category, float volume, float pitch, long seed) Play a Sound at the location of the provided entity in the World.void
Play a Sound at the location of the provided entity in the World.void
playSound
(@NotNull Entity entity, @NotNull Sound sound, @NotNull SoundCategory category, float volume, float pitch) Play a Sound at the location of the provided entity in the World.void
playSound
(@NotNull Entity entity, @NotNull Sound sound, @NotNull SoundCategory category, float volume, float pitch, long seed) Play a Sound at the location of the provided entity in the World.void
Play a Sound at the provided Location in the World.void
playSound
(@NotNull Location location, @NotNull String sound, @NotNull SoundCategory category, float volume, float pitch) Play a Sound at the provided Location in the World.void
playSound
(@NotNull Location location, @NotNull String sound, @NotNull SoundCategory category, float volume, float pitch, long seed) Play a Sound at the provided Location in the World.void
在世界中指定的位置播放一个声音。void
playSound
(@NotNull Location location, @NotNull Sound sound, @NotNull SoundCategory category, float volume, float pitch) Play a Sound at the provided Location in the World.void
playSound
(@NotNull Location location, @NotNull Sound sound, @NotNull SoundCategory category, float volume, float pitch, long seed) Play a Sound at the provided Location in the World.rayTrace
(@NotNull Location start, @NotNull Vector direction, double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks, double raySize, @Nullable Predicate<? super Entity> filter) 执行射线跟踪, 检查方块碰撞和实体碰撞.rayTraceBlocks
(@NotNull Location start, @NotNull Vector direction, double maxDistance) 执行射线跟踪, 使用方块的精确碰撞形状来检查方块碰撞.rayTraceBlocks
(@NotNull Location start, @NotNull Vector direction, double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode) 执行射线跟踪, 使用方块的精确碰撞形状来检查方块碰撞.rayTraceBlocks
(@NotNull Location start, @NotNull Vector direction, double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks) 执行射线跟踪, 使用方块的精确碰撞形状来检查方块碰撞.rayTraceEntities
(@NotNull Location start, @NotNull Vector direction, double maxDistance) 执行检查实体碰撞的射线跟踪.rayTraceEntities
(@NotNull Location start, @NotNull Vector direction, double maxDistance, double raySize) 执行检查实体碰撞的射线跟踪.rayTraceEntities
(@NotNull Location start, @NotNull Vector direction, double maxDistance, double raySize, @Nullable Predicate<? super Entity> filter) 执行检查实体碰撞的射线跟踪.rayTraceEntities
(@NotNull Location start, @NotNull Vector direction, double maxDistance, @Nullable Predicate<? super Entity> filter) 执行检查实体碰撞的射线跟踪.boolean
refreshChunk
(int x, int z) 已过时。这个方法不能保证在所有的客户端接口都正常地工作。boolean
regenerateChunk
(int x, int z) 已过时。无法保证重新生成单个区块会产生与之前相同的区块, 因为地形装饰可分布在区块上.boolean
removePluginChunkTicket
(int x, int z, @NotNull Plugin plugin) Removes the specified plugin's ticket for the specified chunkvoid
removePluginChunkTickets
(@NotNull Plugin plugin) Removes all plugin tickets for the specified pluginvoid
save()
保存世界到磁盘.void
setAmbientSpawnLimit
(int limit) 已过时。void
setAnimalSpawnLimit
(int limit) 已过时。void
setAutoSave
(boolean value) 设置世界是否会自动保存。void
已过时。1.15更新后生物群系已三维化void
setChunkForceLoaded
(int x, int z, boolean forced) Sets whether the chunk at the specified chunk coordinates is force loaded.void
setClearWeatherDuration
(int duration) 设置晴朗天气的持续时间 (单位为 tick).void
setDifficulty
(@NotNull Difficulty difficulty) 设置世界的游戏难度。void
setFullTime
(long time) 设置服务器的游戏时间.<T> boolean
setGameRule
(@NotNull GameRule<T> rule, T newValue) 设置给定游戏规则
的数据值.boolean
setGameRuleValue
(@NotNull String rule, @NotNull String value) 已过时。void
setHardcore
(boolean hardcore) Sets whether the world is hardcore or not.void
setKeepSpawnInMemory
(boolean keepLoaded) 已过时。使用GameRule.SPAWN_CHUNK_RADIUS
以更好地控制void
setMonsterSpawnLimit
(int limit) 已过时。void
setPVP
(boolean pvp) 设置世界的PVP设置.void
setSpawnFlags
(boolean allowMonsters, boolean allowAnimals) 为这个世界设置出生标识。void
setSpawnLimit
(@NotNull SpawnCategory spawnCategory, int limit) Sets the limit for number ofSpawnCategory
entities that can spawn in a chunk in this worldboolean
setSpawnLocation
(int x, int y, int z) 设置这个世界的出生点位置.boolean
setSpawnLocation
(int x, int y, int z, float angle) 设置这个世界的出生点位置.boolean
setSpawnLocation
(@NotNull Location location) 设置这个世界的出生点位置.void
setStorm
(boolean hasStorm) 设置是否有风暴.void
setThunderDuration
(int duration) 设置这个世界打雷持续时间。void
setThundering
(boolean thundering) 设置这个世界是否在打雷.void
setTicksPerAmbientSpawns
(int ticksPerAmbientSpawns) 已过时。Deprecated in favor ofsetTicksPerSpawns(SpawnCategory, int)
void
setTicksPerAnimalSpawns
(int ticksPerAnimalSpawns) 已过时。void
setTicksPerMonsterSpawns
(int ticksPerMonsterSpawns) 已过时。void
setTicksPerSpawns
(@NotNull SpawnCategory spawnCategory, int ticksPerCategorySpawn) Sets the world's ticks perSpawnCategory
mob spawns valuevoid
setTicksPerWaterAmbientSpawns
(int ticksPerAmbientSpawns) 已过时。Deprecated in favor ofsetTicksPerSpawns(SpawnCategory, int)
void
setTicksPerWaterSpawns
(int ticksPerWaterSpawns) 已过时。Deprecated in favor ofsetTicksPerSpawns(SpawnCategory, int)
void
setTicksPerWaterUndergroundCreatureSpawns
(int ticksPerWaterUndergroundCreatureSpawns) 已过时。Deprecated in favor ofsetTicksPerSpawns(SpawnCategory, int)
void
setTime
(long time) 设置服务器的在游戏中的相对时间.void
setWaterAmbientSpawnLimit
(int limit) 已过时。Deprecated in favor ofsetSpawnLimit(SpawnCategory, int)
void
setWaterAnimalSpawnLimit
(int limit) 已过时。void
setWaterUndergroundCreatureSpawnLimit
(int limit) 已过时。Deprecated in favor ofsetSpawnLimit(SpawnCategory, int)
void
setWeatherDuration
(int duration) 设置当前天气的剩余时间,单位为tick.<T extends LivingEntity>
Tspawn
(@NotNull Location location, @NotNull Class<T> clazz, CreatureSpawnEvent.SpawnReason spawnReason, boolean randomizeData, @Nullable Consumer<? super T> function) Creates a new entity at the givenLocation
with the supplied function run before the entity is added to the world.spawnArrow
(@NotNull Location location, @NotNull Vector direction, float speed, float spread) <T extends AbstractArrow>
TspawnArrow
(@NotNull Location location, @NotNull Vector direction, float speed, float spread, @NotNull Class<T> clazz) Creates an arrow entity of the given class at the givenLocation
spawnFallingBlock
(@NotNull Location location, @NotNull BlockData data) spawnFallingBlock
(@NotNull Location location, @NotNull MaterialData data) spawnFallingBlock
(@NotNull Location location, @NotNull Material material, byte data) 已过时。不安全的参数void
spawnParticle
(@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.void
spawnParticle
(@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.void
spawnParticle
(@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.<T> void
spawnParticle
(@NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data) Spawns the particle (the number of times specified by count) at the target location.<T> void
spawnParticle
(@NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data, boolean force) Spawns the particle (the number of times specified by count) at the target location.<T> void
spawnParticle
(@NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, T data) Spawns the particle (the number of times specified by count) at the target location.<T> void
spawnParticle
(@NotNull Particle particle, double x, double y, double z, int count, T data) Spawns the particle (the number of times specified by count) at the target location.void
spawnParticle
(@NotNull Particle particle, @NotNull Location location, int count) Spawns the particle (the number of times specified by count) at the target location.void
spawnParticle
(@NotNull Particle particle, @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.void
spawnParticle
(@NotNull Particle particle, @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.<T> void
spawnParticle
(@NotNull Particle particle, @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, T data) Spawns the particle (the number of times specified by count) at the target location.<T> void
spawnParticle
(@NotNull Particle particle, @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, T data, boolean force) Spawns the particle (the number of times specified by count) at the target location.<T> void
spawnParticle
(@NotNull Particle particle, @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, T data) Spawns the particle (the number of times specified by count) at the target location.<T> void
spawnParticle
(@NotNull Particle particle, @NotNull Location location, int count, T data) Spawns the particle (the number of times specified by count) at the target location.spigot()
在指定的位置
劈下闪电.在指定的位置
劈下不会造成伤害的闪电.boolean
unloadChunk
(int x, int z) 安全的卸载并保存指定坐标的区块
.boolean
unloadChunk
(int x, int z, boolean save) 安全的卸载并选择是否保存指定坐标的区块
.boolean
unloadChunk
(@NotNull Chunk chunk) 安全的卸载并保存指定坐标的区块
.boolean
unloadChunkRequest
(int x, int z) 安全地将卸载指定坐标的区块
请求列入队列.从接口继承的方法 org.bukkit.metadata.Metadatable
getMetadata, hasMetadata, removeMetadata, setMetadata
从接口继承的方法 org.bukkit.persistence.PersistentDataHolder
getPersistentDataContainer
从接口继承的方法 org.bukkit.plugin.messaging.PluginMessageRecipient
getListeningPluginChannels, sendPluginMessage
从接口继承的方法 org.bukkit.RegionAccessor
addEntity, createEntity, generateTree, generateTree, generateTree, getBiome, getBiome, getBlockData, getBlockData, getBlockState, getBlockState, getHighestBlockYAt, getHighestBlockYAt, getHighestBlockYAt, getHighestBlockYAt, getType, getType, setBiome, setBiome, setBlockData, setBlockData, setType, setType, spawn, spawn, spawn, spawnEntity, spawnEntity
从接口继承的方法 org.bukkit.generator.WorldInfo
getEnvironment, getMaxHeight, getMinHeight, getName, getSeed, getUID
-
方法详细资料
-
getBlockAt
- 参数:
x
- 方块的X坐标y
- 方块的Y坐标z
- 方块的Z坐标- 返回:
- 在指定坐标的方块
-
getBlockAt
- 参数:
location
- 要获取的方块的位置- 返回:
- 在指定位置的方块
-
getHighestBlockAt
获取指定坐标最高处不是空气且不可逾越的方块.原文:Gets the highest non-empty (impassable) block at the given coordinates.
- 参数:
x
- 方块X坐标z
- 方块Z坐标- 返回:
- 最高处不是空气的方块.
-
getHighestBlockAt
获取指定位置
最高处不是空气且不可逾越的方块.原文:Gets the highest non-empty (impassable) block at the given coordinates.
- 参数:
location
- 需要获取最高的方块的位置- 返回:
- 最高的不是空气的方块
-
getHighestBlockAt
Gets the highest block corresponding to theHeightMap
at the given coordinates.- 参数:
x
- X-coordinate of the blockz
- Z-coordinate of the blockheightMap
- 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 theHeightMap
at the given coordinates.- 参数:
location
- Coordinates to get the highest blockheightMap
- the heightMap that is used to determine the highest point- 返回:
- Highest block corresponding to the
HeightMap
-
getChunkAt
- 参数:
x
- X坐标z
- Z坐标- 返回:
- 给定坐标所在的区块
-
getChunkAt
Gets theChunk
at the given coordinates- 参数:
x
- X-coordinate of the chunkz
- Z-coordinate of the chunkgenerate
- Whether the chunk should be fully generated or not- 返回:
- Chunk at the given coordinates
-
getChunkAt
- 参数:
location
- 方块的位置- 返回:
- 给定位置的区块
-
getChunkAt
- 参数:
block
- 需要检测的方块- 返回:
- 方块所处的区块
-
isChunkLoaded
- 参数:
chunk
- 需要检查的区块- 返回:
- 如果区块已经被加载则返回true,否则返回false
-
getLoadedChunks
- 返回:
- 包含所有被加载区块的数组Chunk[]
-
loadChunk
加载指定的区块
.本方法将使指定的区块保持加载状态直到卸载方法被手动调用. 建议开发者使用 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) - 参数:
x
- 区块的x坐标z
- 区块的z坐标- 返回:
- 如果区块已经被加载则返回true,否则返回false
-
isChunkGenerated
boolean isChunkGenerated(int x, int z) - 参数:
x
- 区块x坐标z
- 区块z坐标- 返回:
- 区块已生成则返回true, 反之为false
-
isChunkInUse
已过时。本方法曾被添加用于促进区块的垃圾回收. 由于当前 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
安全的卸载并保存指定坐标的区块
.这个方法类似于当safe值为true时的
unloadChunk(int, int, boolean)
.原文: Safely unloads and saves the
Chunk
at the specified coordinatesThis 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 coordinatesThis 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) - 参数:
x
- 区块的x坐标z
- 区块的z坐标save
- 是否保存区块- 返回:
- 如果区块被成功卸载则返回true,否则返回false
-
unloadChunkRequest
boolean unloadChunkRequest(int x, int z) - 参数:
x
- 区块的x坐标z
- 区块的z坐标- 返回:
- 如果尝试列入队列成功则返回true,否则返回false
-
regenerateChunk
已过时。无法保证重新生成单个区块会产生与之前相同的区块, 因为地形装饰可分布在区块上. 应避免使用本方法, 由于已知本方法易产生bug- 参数:
x
- 区块的x坐标z
- 区块的z坐标- 返回:
- 区块是否真的被重新生成
-
refreshChunk
已过时。这个方法不能保证在所有的客户端接口都正常地工作。- 参数:
x
- 区块的x坐标z
- 区块的z坐标- 返回:
- 区块是否真的被刷新
-
getPlayersSeeingChunk
Get a list of all players who are can view the specified chunk from their clientThis list will be empty if no players are viewing the chunk, or the chunk is unloaded.
- 参数:
chunk
- the chunk to check- 返回:
- collection of players who can see the chunk
-
getPlayersSeeingChunk
Get a list of all players who are can view the specified chunk from their clientThis list will be empty if no players are viewing the chunk, or the chunk is unloaded.
- 参数:
x
- X-coordinate of the chunkz
- Z-coordinate of the chunk- 返回:
- collection of players who can see the chunk
-
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 chunkz
- 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 chunkz
- Z-coordinate of the chunkforced
- force load status
-
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
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 chunkz
- Z-coordinate of the chunkplugin
- 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
Removes the specified plugin's ticket for the specified chunkA 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 chunkz
- Z-coordinate of the chunkplugin
- Plugin which owns the ticket- 返回:
true
if the plugin ticket was removed,false
if there is no plugin ticket for the chunk- 另请参阅:
-
removePluginChunkTickets
Removes all plugin tickets for the specified pluginA 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
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 chunkz
- Z-coordinate of the chunk- 返回:
- unmodifiable collection containing which plugins have tickets for the 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
- 另请参阅:
-
getIntersectingChunks
Gets all Chunks intersecting the given BoundingBox.- 参数:
box
- BoundingBox to check- 返回:
- A collection of Chunks intersecting the given BoundingBox
-
dropItem
@NotNull @NotNull Item dropItem(@NotNull @NotNull Location location, @NotNull @NotNull ItemStack item) - 参数:
location
- 丢出物品的位置item
- 丢出的物品堆- 返回:
- 这个方法会创建一个ItemDrop(物品掉落)实体作为结果
-
dropItem
@NotNull @NotNull Item dropItem(@NotNull @NotNull Location location, @NotNull @NotNull ItemStack item, @Nullable @Nullable Consumer<? super Item> function) Drops an item at the specifiedLocation
Note that functions will run before the entity is spawned- 参数:
location
- Location to drop the itemitem
- ItemStack to dropfunction
- the function to be run before the entity is spawned.- 返回:
- ItemDrop entity created as a result of this method
-
dropItemNaturally
@NotNull @NotNull Item dropItemNaturally(@NotNull @NotNull Location location, @NotNull @NotNull ItemStack item) - 参数:
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 specifiedLocation
with a random offset Note that functions will run before the entity is spawned- 参数:
location
- Location to drop the itemitem
- ItemStack to dropfunction
- 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) - 参数:
location
- 生成箭的位置direction
- 箭射向的方向speed
- 箭的射速,建议为0.6spread
- 箭存在的时间(箭在多久后会消失)- 返回:
- 这个方法会生成一个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 givenLocation
- 类型参数:
T
- type of arrow to spawn- 参数:
location
- Location to spawn the arrowdirection
- Direction to shoot the arrow inspeed
- Speed of the arrow. A recommend speed is 0.6spread
- Spread of the arrow. A recommend spread is 12clazz
- the Entity class for the arrowSpectralArrow
,Arrow
,TippedArrow
- 返回:
- Arrow entity spawned as a result of this method
-
generateTree
- 参数:
location
- 生成树的位置type
- 创建的树的类型- 返回:
- 如果树被成功生成则返回true,否则返回false
-
generateTree
@Deprecated boolean generateTree(@NotNull @NotNull Location loc, @NotNull @NotNull TreeType type, @NotNull @NotNull BlockChangeDelegate delegate) 已过时。this method does not handle tile entities (bee nests)- 参数:
loc
- 生成树的位置type
- 创建的树的类型delegate
- 这个方法会返回一个用于调用每个方块的改变的类作为结果- 返回:
- 如果树被成功生成则返回true,否则返回false
- 另请参阅:
-
strikeLightning
- 参数:
loc
- 劈下闪电的位置- 返回:
- lightning(闪电)实体
-
strikeLightningEffect
- 参数:
loc
- 劈下闪电的位置- 返回:
- lightning(闪电)实体
-
getEntities
获取一个这个世界所有实体的列表.原文: Get a list of all entities in this World
- 指定者:
getEntities
在接口中RegionAccessor
- 返回:
- 一个当前处在这个世界的所有实体的列表
-
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
获取一个在这个世界的所有与任一指定的类/接口相匹配的实体的集合.原文: Get a collection of all entities in this World matching any of the given classes/interfaces
- 指定者:
getEntitiesByClasses
在接口中RegionAccessor
- 参数:
classes
- 用于匹配的表示实体类型的类- 返回:
- 一个当前处在这个世界的所有与一个或更多指定的类/接口相匹配的实体的列表
-
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 boxx
- 1/2 the size of the box along x axisy
- 1/2 the size of the box along y axisz
- 1/2 the size of the box along z axisfilter
- only entities that fulfill this predicate are considered, ornull
to consider all entities- 返回:
- the collection of entities near location. This will always be a non-null collection.
-
getNearbyEntities
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 boxfilter
- only entities that fulfill this predicate are considered, ornull
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
- 返回:
- 这个世界的出生点位置
-
setSpawnLocation
设置这个世界的出生点位置.
提供的位置所处世界必须与这个世界相同.原文: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()
andhasStorm()
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当量为4FsetFire
- 方块是否会着火- 返回:
- 如果爆炸被取消则返回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当量为4FsetFire
- 方块是否会着火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 andbreakBlocks
istrue
, the value ofbreakBlocks
will be ignored ifGameRule.MOB_GRIEFING
isfalse
in the world in which the explosion occurs. In other words, the mob griefing gamerule will take priority overbreakBlocks
if explosions are not allowed.- 参数:
x
- X coordinatey
- Y coordinatez
- Z coordinatepower
- The power of explosion, where 4F is TNTsetFire
- Whether or not to set blocks on firebreakBlocks
- Whether or not to have blocks be destroyedsource
- the source entity, used for tracking damage- 返回:
- false if explosion was canceled, otherwise true
-
createExplosion
在指定坐标生成指定威力的爆炸.原文: Creates explosion at given coordinates with given power
- 参数:
loc
- 爆炸位置power
- 爆炸的威力,一个TNT当量为4F- 返回:
- 如果爆炸被取消则返回false,否则返回true
-
createExplosion
在指定的坐标生成指定威力的爆炸并设置方块是否会着火.原文: Creates explosion at given coordinates with given power and optionally setting blocks on fire.
- 参数:
loc
- 爆炸位置power
- 爆炸的威力,一个TNT当量为4FsetFire
- 方块是否会着火- 返回:
- 如果爆炸被取消则返回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 uppower
- The power of explosion, where 4F is TNTsetFire
- Whether or not to set blocks on firebreakBlocks
- 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 andbreakBlocks
istrue
, the value ofbreakBlocks
will be ignored ifGameRule.MOB_GRIEFING
isfalse
in the world in which the explosion occurs. In other words, the mob griefing gamerule will take priority overbreakBlocks
if explosions are not allowed.- 参数:
loc
- Location to blow uppower
- The power of explosion, where 4F is TNTsetFire
- Whether or not to set blocks on firebreakBlocks
- Whether or not to have blocks be destroyedsource
- 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
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
BlockPopulator
s 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 givenLocation
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 theLivingEntity
that is to be spawned.spawnReason
- the reason provided during theCreatureSpawnEvent
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 theMob
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
@NotNull @NotNull FallingBlock spawnFallingBlock(@NotNull @NotNull Location location, @NotNull @NotNull MaterialData data) throws IllegalArgumentException Spawn aFallingBlock
entity at the givenLocation
of the specifiedMaterialData
. 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
- TheLocation
to spawn the FallingBlockdata
- The block data- 返回:
- The spawned
FallingBlock
instance - 抛出:
IllegalArgumentException
- ifLocation
orMaterialData
are null orMaterial
of theMaterialData
is not a block
-
spawnFallingBlock
@NotNull @NotNull FallingBlock spawnFallingBlock(@NotNull @NotNull Location location, @NotNull @NotNull BlockData data) throws IllegalArgumentException -
spawnFallingBlock
@Deprecated @NotNull @NotNull FallingBlock spawnFallingBlock(@NotNull @NotNull Location location, @NotNull @NotNull Material material, byte data) throws IllegalArgumentException 已过时。不安全的参数在指定的位置
根据指定的方块物品
生成一个掉落中的方块
实体. 物品决定下落的东西。当下落方块碰到地时就会放置这个方块.物品必须是一个经过
Material.isBlock()
检验的方块类型,可能不是空气.原文: Spawn a
FallingBlock
entity at the givenLocation
of the specifiedMaterial
. 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. -
playEffect
向以指定位置为圆心的默认半径内的所有玩家施加(给予)一个效果.原文: Plays an effect to all players within a default radius around a given location.
-
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.
-
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.
-
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.
-
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
已过时。1.15更新后生物群系已三维化获取指定方块坐标的生物群系。原文: Gets the biome for the given block coordinates.
- 参数:
x
- 方块的x坐标z
- 方块的z坐标- 返回:
- 所查方块的生物群系
-
setBiome
已过时。1.15更新后生物群系已三维化设置指定方块坐标的生物群系.原文:Sets the biome for the given block coordinates
- 参数:
x
- 方块的x坐标z
- 方块的z坐标bio
- 这个方块的新生物群系类型
-
getTemperature
已过时。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 blocky
- Y coordinate of the blockz
- Z coordinate of the block- 返回:
- Temperature of the requested block
-
getHumidity
已过时。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 blocky
- Y coordinate of the blockz
- 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 thanWorldInfo.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
已过时。使用GameRule.SPAWN_CHUNK_RADIUS
以更好地控制获取世界的出生点是否会在内存中保存加载。原文: Gets whether the world's spawn area should be kept loaded into memory or not.
- 返回:
- 如果世界的出生地区会在内存中保存加载则返回true
-
setKeepSpawnInMemory
已过时。使用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
设置世界的游戏难度。原文: Sets the Difficulty of the world.
- 参数:
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
获取这个世界保存在磁盘的哪个文件夹。原文: 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
已过时。获取世界生成动物的时间间隔(单位为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
已过时。设置世界生成动物的时间间隔(单位为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
已过时。获取世界生成怪物的时间间隔(单位为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
已过时。设置世界生成怪物的时间间隔(单位为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
已过时。Gets the world's ticks per water mob spawns valueThis 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 in favor ofsetTicksPerSpawns(SpawnCategory, int)
Sets the world's ticks per water mob spawns valueThis 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 in favor ofgetTicksPerSpawns(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 in favor ofsetTicksPerSpawns(SpawnCategory, int)
Sets the world's ticks per water ambient mob spawns valueThis 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 in favor ofgetTicksPerSpawns(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) 已过时。Deprecated in favor ofsetTicksPerSpawns(SpawnCategory, int)
Sets the world's ticks per water underground creature spawns valueThis 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 in favor ofgetTicksPerSpawns(SpawnCategory)
Gets the world's ticks per ambient mob spawns valueThis 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 in favor ofsetTicksPerSpawns(SpawnCategory, int)
Sets the world's ticks per ambient mob spawns valueThis 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
Gets the world's ticks perSpawnCategory
mob spawns valueThis 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
- A value of 1 will mean the server will attempt to spawn
-
setTicksPerSpawns
Sets the world's ticks perSpawnCategory
mob spawns valueThis 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 spawnticksPerCategorySpawn
- the ticks perSpawnCategory
mob spawns value you want to set the world to
- A value of 1 will mean the server will attempt to spawn
-
getMonsterSpawnLimit
已过时。获取这个世界一个区块内的怪物生成数限制。原文: Gets limit for number of monsters that can spawn in a chunk in this world
- 返回:
- 怪物生成限制
-
setMonsterSpawnLimit
已过时。设置这个世界一个区块内的怪物生成数限制。注意:如果设置为负数则这个世界会使用服务器普遍的生成限制来代替。
原文: 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
已过时。获取这个世界一个区块内的动物生成数限制。原文: Gets the limit for number of animals that can spawn in a chunk in this world
- 返回:
- 动物生成限制
-
setAnimalSpawnLimit
已过时。设置这个世界一个区块内的动物生成数限制。注意:如果设置为负数则这个世界会使用服务器普遍的生成限制来代替。
原文: 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
已过时。获取这个世界一个区块内的水生动物生成数限制。原文: Gets the limit for number of water animals that can spawn in a chunk in this world
- 返回:
- 水生动物生成限制
-
setWaterAnimalSpawnLimit
已过时。设置这个世界一个区块内的水生动物生成数限制。注意:如果设置为负数则这个世界会使用服务器普遍的生成限制来代替。
原文: 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 in favor ofgetSpawnLimit(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 in favor ofsetSpawnLimit(SpawnCategory, int)
Sets the limit for number of water underground creature that can spawn in a chunk in this worldNote: If set to a negative number the world will use the server-wide spawn limit instead.
- 参数:
limit
- the new mob limit
-
getWaterAmbientSpawnLimit
已过时。Deprecated in favor ofgetSpawnLimit(SpawnCategory)
Gets user-specified limit for number of water ambient mobs that can spawn in a chunk.- 返回:
- the water ambient spawn limit
-
setWaterAmbientSpawnLimit
已过时。Deprecated in favor ofsetSpawnLimit(SpawnCategory, int)
Sets the limit for number of water ambient mobs that can spawn in a chunk in this worldNote: If set to a negative number the world will use the server-wide spawn limit instead.
- 参数:
limit
- the new mob limit
-
getAmbientSpawnLimit
已过时。获取这个世界一个区块内周围的怪物的生成数限制。原文: Gets the limit for number of ambient mobs that can spawn in a chunk in this world
- 返回:
- 周围的怪物的生成限制
-
setAmbientSpawnLimit
已过时。设置这个世界一个区块内周围的怪物的生成数限制。注意:如果设置为负数则这个世界会使用服务器普遍的生成限制来代替。
原文: 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
Gets the limit for number ofSpawnCategory
entities that can spawn in a chunk in this world- 参数:
spawnCategory
- the entity category- 返回:
- The ambient spawn limit
-
setSpawnLimit
Sets the limit for number ofSpawnCategory
entities that can spawn in a chunk in this worldNote: If set to a negative number the world will use the server-wide spawn limit instead.
- 参数:
spawnCategory
- the entity categorylimit
- 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 noteinstrument
- The instrumentnote
- 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 soundsound
- The internal sound name to playvolume
- The volume of the soundpitch
- 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 soundsound
- The sound to playcategory
- the category of the soundvolume
- The volume of the soundpitch
- 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 soundsound
- The internal sound name to playcategory
- The category of the soundvolume
- The volume of the soundpitch
- 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 soundsound
- The sound to playcategory
- the category of the soundvolume
- The volume of the soundpitch
- The pitch of the soundseed
- 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 soundsound
- The internal sound name to playcategory
- the category of the soundvolume
- The volume of the soundpitch
- The pitch of the soundseed
- 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 soundsound
- The sound to playvolume
- The volume of the soundpitch
- 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 soundsound
- The sound to playvolume
- The volume of the soundpitch
- 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 soundsound
- The sound to playcategory
- the category of the soundvolume
- The volume of the soundpitch
- 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 soundsound
- The sound to playcategory
- The category of the soundvolume
- The volume of the soundpitch
- 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 soundsound
- The sound to playcategory
- The category of the soundvolume
- The volume of the soundpitch
- The pitch of the soundseed
- 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 soundsound
- The sound to playcategory
- The category of the soundvolume
- The volume of the soundpitch
- The pitch of the soundseed
- The seed for the sound
-
getGameRules
- 返回:
游戏规则
名列表.
-
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
已过时。将指定的游戏规则设置为指定数值.规则可能会尝试验证值,如果数值被设置则会返回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
检查字符串是否是一个有效的游戏规则.原文: Checks if string is a valid game rule
- 参数:
rule
- 要检测的规则- 返回:
- 如果规则存在则返回true
-
getGameRuleValue
- 类型参数:
T
- 游戏规则数据类型- 参数:
rule
- 游戏规则- 返回:
- 游戏规则值
-
getGameRuleDefault
获取给定游戏规则
的默认值. 不保证该值与当前值匹配.原文:Get the default value for a given
GameRule
. This value is not guaranteed to match the current value.- 类型参数:
T
- 游戏规则数据类型- 参数:
rule
- 游戏规则- 返回:
- 游戏规则默认值
-
setGameRule
- 类型参数:
T
- 对应游戏规则的数据类型- 参数:
rule
- 要更新的游戏规则newValue
- 值- 返回:
- 若设置成功返回true
-
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 spawnlocation
- the location to spawn atcount
- the number of particles
-
spawnParticle
Spawns the particle (the number of times specified by count) at the target location.- 参数:
particle
- the particle to spawnx
- the position on the x axis to spawn aty
- the position on the y axis to spawn atz
- the position on the z axis to spawn atcount
- 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 (seeParticle.getDataType()
- 参数:
particle
- the particle to spawnlocation
- the location to spawn atcount
- the number of particlesdata
- the data to use for the particle or null, the type of this depends onParticle.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 (seeParticle.getDataType()
- 参数:
particle
- the particle to spawnx
- the position on the x axis to spawn aty
- the position on the y axis to spawn atz
- the position on the z axis to spawn atcount
- the number of particlesdata
- the data to use for the particle or null, the type of this depends onParticle.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 spawnlocation
- the location to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- 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 spawnx
- the position on the x axis to spawn aty
- the position on the y axis to spawn atz
- the position on the z axis to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- 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 (seeParticle.getDataType()
- 参数:
particle
- the particle to spawnlocation
- the location to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisdata
- the data to use for the particle or null, the type of this depends onParticle.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 (seeParticle.getDataType()
- 参数:
particle
- the particle to spawnx
- the position on the x axis to spawn aty
- the position on the y axis to spawn atz
- the position on the z axis to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisdata
- the data to use for the particle or null, the type of this depends onParticle.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 spawnlocation
- the location to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisextra
- 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 spawnx
- the position on the x axis to spawn aty
- the position on the y axis to spawn atz
- the position on the z axis to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisextra
- 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 (seeParticle.getDataType()
- 参数:
particle
- the particle to spawnlocation
- the location to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisextra
- 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 onParticle.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 (seeParticle.getDataType()
- 参数:
particle
- the particle to spawnx
- the position on the x axis to spawn aty
- the position on the y axis to spawn atz
- the position on the z axis to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisextra
- 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 onParticle.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 (seeParticle.getDataType()
- 参数:
particle
- the particle to spawnlocation
- the location to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisextra
- 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 onParticle.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 (seeParticle.getDataType()
- 参数:
particle
- the particle to spawnx
- the position on the x axis to spawn aty
- the position on the y axis to spawn atz
- the position on the z axis to spawn atcount
- the number of particlesoffsetX
- the maximum random offset on the X axisoffsetY
- the maximum random offset on the Y axisoffsetZ
- the maximum random offset on the Z axisextra
- 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 onParticle.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 givenStructureType
. 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 structurestructureType
- the type of structure to findradius
- the radius, in chunks, around which to searchfindUnexplored
- 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 givenStructureType
. 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 aStructure
is, that aStructureType
can refer to multipleStructures
while searching for aStructure
while only search for the givenStructure
.- 参数:
origin
- where to start looking for a structurestructureType
- the type of structure to findradius
- the radius, in chunks, around which to searchfindUnexplored
- true to only find unexplored structures- 返回:
- the closest
Location
andStructure
, 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 givenStructure
. 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 aStructure
is, that aStructureType
can refer to multipleStructures
while searching for aStructure
while only search for the givenStructure
. -
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 providedBiome
(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.
-
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 providedBiome
(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 forhorizontalInterval
andverticalInterval
will result in faster searches, but may lead to small biomes being missed.- 参数:
origin
- where to start looking for a biomeradius
- the radius, in blocks, around which to searchhorizontalInterval
- the horizontal distance between each checkverticalInterval
- the vertical distance between each checkbiomes
- the biomes to search for- 返回:
- a BiomeSearchResult containing the closest
Location
andBiome
, or null if no biome was found. - 另请参阅:
-
locateNearestRaid
寻找与给定位置相距最近的袭击.原文:Finds the nearest raid close to the given location.
- 参数:
location
- 源位置radius
- 搜索半径- 返回:
- 最近的
袭击
, 如果没有找到袭击事件返回null.
-
getRaids
获取本世界正在进行的所有袭击.原文:Gets all raids that are going on over this world.
- 返回:
- 本世界所有活跃的袭击
-
getEnderDragonBattle
Get theDragonBattle
associated with this world. If this world's environment is notWorld.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
Get allFeatureFlag
enabled in this world.- 返回:
- all enabled
FeatureFlag
-
getStructures
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 chunkz
- 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 givenStructure
that intersect the chunk at the given coordinates.
If no structures are present an empty collection will be returned.- 参数:
x
- X-coordinate of the chunkz
- Z-coordinate of the chunkstructure
- the structure to find- 返回:
- a collection of placed structures in the chunk at the given coordinates
-