public interface World extends PluginMessageRecipient, Metadatable, net.kyori.adventure.audience.ForwardingAudience, Keyed
Modifier and Type | Interface and Description |
---|---|
static interface |
World.ChunkLoadCallback
Deprecated.
Use either the Future or the Consumer based methods
|
static class |
World.Environment
Represents various map environment types that a world may be
|
static class |
World.Spigot |
Modifier and Type | Method and Description |
---|---|
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.
|
default @NotNull Iterable<? extends net.kyori.adventure.audience.Audience> |
audiences() |
boolean |
canGenerateStructures()
Gets whether or not structures are being generated.
|
boolean |
createExplosion(double x,
double y,
double z,
float power)
Creates explosion at given coordinates with given power
|
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.
|
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.
|
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.
|
default boolean |
createExplosion(@NotNull Entity source,
float power)
Creates explosion at given entities location with given power and optionally
setting blocks on fire, with the specified entity as the source.
|
default boolean |
createExplosion(@NotNull Entity source,
float power,
boolean setFire)
Creates explosion at given entities location with given power and optionally
setting blocks on fire, with the specified entity as the source.
|
default boolean |
createExplosion(@NotNull Entity source,
float power,
boolean setFire,
boolean breakBlocks)
Creates explosion at given entities location with given power and optionally
setting blocks on fire, with the specified entity as the source.
|
default boolean |
createExplosion(@Nullable Entity source,
@NotNull Location loc,
float power)
Creates explosion at given location with given power, with the specified entity as the source.
|
default boolean |
createExplosion(@Nullable Entity source,
@NotNull Location loc,
float power,
boolean setFire)
Creates explosion at given location with given power and optionally
setting blocks on fire, with the specified entity as the source.
|
boolean |
createExplosion(@Nullable Entity source,
@NotNull Location loc,
float power,
boolean setFire,
boolean breakBlocks)
Creates explosion at given location with given power and optionally
setting blocks on fire, with the specified entity as the source.
|
boolean |
createExplosion(@NotNull Location loc,
float power)
Creates explosion at given coordinates with given power
|
boolean |
createExplosion(@NotNull Location loc,
float power,
boolean setFire)
Creates explosion at given coordinates with given power and optionally
setting blocks on fire.
|
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.
|
boolean |
doesBedWork()
Checks if beds work
|
boolean |
doesRespawnAnchorWork()
Checks if respawn anchors work
|
@NotNull Item |
dropItem(@NotNull Location location,
@NotNull ItemStack item)
Drops an item at the specified
Location |
@NotNull Item |
dropItem(@NotNull Location location,
@NotNull ItemStack item,
@Nullable Consumer<Item> function)
Drops an item at the specified
Location
Note that functions will run before the entity is spawned |
@NotNull Item |
dropItemNaturally(@NotNull Location location,
@NotNull ItemStack item)
Drops an item at the specified
Location with a random offset |
@NotNull Item |
dropItemNaturally(@NotNull Location location,
@NotNull ItemStack item,
@Nullable Consumer<Item> function)
Drops an item at the specified
Location with a random offset
Note that functions will run before the entity is spawned |
boolean |
generateTree(@NotNull Location location,
@NotNull TreeType type)
Creates a tree at the given
Location |
boolean |
generateTree(@NotNull Location loc,
@NotNull TreeType type,
@NotNull BlockChangeDelegate delegate)
Creates a tree at the given
Location |
boolean |
getAllowAnimals()
Gets whether animals can spawn in this world.
|
boolean |
getAllowMonsters()
Gets whether monsters can spawn in this world.
|
int |
getAmbientSpawnLimit()
Gets the limit for number of ambient mobs that can spawn in a chunk in
this world
|
int |
getAnimalSpawnLimit()
Gets the limit for number of animals that can spawn in a chunk in this
world
|
@NotNull Biome |
getBiome(int x,
int z)
Deprecated.
biomes are now 3-dimensional
|
@NotNull Biome |
getBiome(int x,
int y,
int z)
Gets the biome for the given block coordinates.
|
@NotNull Block |
getBlockAt(int x,
int y,
int z)
Gets the
Block at the given coordinates |
@NotNull Block |
getBlockAt(@NotNull Location location)
|
default @NotNull Block |
getBlockAtKey(long key)
Gets the
Block at the given block key |
@NotNull Chunk |
getChunkAt(@NotNull Block block)
|
@NotNull Chunk |
getChunkAt(int x,
int z)
Gets the
Chunk at the given coordinates |
@NotNull Chunk |
getChunkAt(@NotNull Location location)
|
default @NotNull Chunk |
getChunkAt(long chunkKey)
Gets the chunk at the specified chunk key, which is the X and Z packed into a long.
|
default CompletableFuture<Chunk> |
getChunkAtAsync(@NotNull Block block)
Requests a
Chunk to be loaded at the given coordinates
This method makes no guarantee on how fast the chunk will load,
and will return the chunk to the callback at a later time. |
default CompletableFuture<Chunk> |
getChunkAtAsync(@NotNull Block block,
boolean gen)
Requests a
Chunk to be loaded at the given coordinates
This method makes no guarantee on how fast the chunk will load,
and will return the chunk to the callback at a later time. |
default void |
getChunkAtAsync(@NotNull Block block,
boolean gen,
Consumer<Chunk> cb)
|
default void |
getChunkAtAsync(@NotNull Block block,
Consumer<Chunk> cb)
|
default void |
getChunkAtAsync(@NotNull Block block,
@NotNull World.ChunkLoadCallback cb)
Deprecated.
Use either the Future or the Consumer based methods
|
default CompletableFuture<Chunk> |
getChunkAtAsync(int x,
int z)
Requests a
Chunk to be loaded at the given coordinates
This method makes no guarantee on how fast the chunk will load,
and will return the chunk to the callback at a later time. |
default CompletableFuture<Chunk> |
getChunkAtAsync(int x,
int z,
boolean gen)
Requests a
Chunk to be loaded at the given coordinates
This method makes no guarantee on how fast the chunk will load,
and will return the chunk to the callback at a later time. |
CompletableFuture<Chunk> |
getChunkAtAsync(int x,
int z,
boolean gen,
boolean urgent) |
default void |
getChunkAtAsync(int x,
int z,
boolean gen,
Consumer<Chunk> cb)
Requests a
Chunk to be loaded at the given coordinates
This method makes no guarantee on how fast the chunk will load,
and will return the chunk to the callback at a later time. |
default void |
getChunkAtAsync(int x,
int z,
Consumer<Chunk> cb)
Requests a
Chunk to be loaded at the given coordinates
This method makes no guarantee on how fast the chunk will load,
and will return the chunk to the callback at a later time. |
default void |
getChunkAtAsync(int x,
int z,
@NotNull World.ChunkLoadCallback cb)
Deprecated.
Use either the Future or the Consumer based methods
|
default CompletableFuture<Chunk> |
getChunkAtAsync(@NotNull Location loc)
Requests a
Chunk to be loaded at the given coordinates
This method makes no guarantee on how fast the chunk will load,
and will return the chunk to the callback at a later time. |
default CompletableFuture<Chunk> |
getChunkAtAsync(@NotNull Location loc,
boolean gen)
Requests a
Chunk to be loaded at the given coordinates
This method makes no guarantee on how fast the chunk will load,
and will return the chunk to the callback at a later time. |
default void |
getChunkAtAsync(@NotNull Location loc,
boolean gen,
Consumer<Chunk> cb)
|
default void |
getChunkAtAsync(@NotNull Location loc,
Consumer<Chunk> cb)
|
default void |
getChunkAtAsync(@NotNull Location loc,
@NotNull World.ChunkLoadCallback cb)
Deprecated.
Use either the Future or the Consumer based methods
|
default CompletableFuture<Chunk> |
getChunkAtAsyncUrgently(@NotNull Block block)
Requests a
Chunk to be loaded at the given coordinates
This method makes no guarantee on how fast the chunk will load,
and will return the chunk to the callback at a later time. |
default CompletableFuture<Chunk> |
getChunkAtAsyncUrgently(@NotNull Block block,
boolean gen)
Requests a
Chunk to be loaded at the given coordinates
This method makes no guarantee on how fast the chunk will load,
and will return the chunk to the callback at a later time. |
default CompletableFuture<Chunk> |
getChunkAtAsyncUrgently(int x,
int z)
Requests a
Chunk to be loaded at the given coordinates
This method makes no guarantee on how fast the chunk will load,
and will return the chunk to the callback at a later time. |
default CompletableFuture<Chunk> |
getChunkAtAsyncUrgently(@NotNull Location loc)
Requests a
Chunk to be loaded at the given coordinates
This method makes no guarantee on how fast the chunk will load,
and will return the chunk to the callback at a later time. |
default CompletableFuture<Chunk> |
getChunkAtAsyncUrgently(@NotNull Location loc,
boolean gen)
Requests a
Chunk to be loaded at the given coordinates
This method makes no guarantee on how fast the chunk will load,
and will return the chunk to the callback at a later time. |
int |
getChunkCount() |
int |
getClearWeatherDuration()
Get the clear weather duration.
|
double |
getCoordinateScale()
Gets the coordinate scaling of this world.
|
@NotNull Difficulty |
getDifficulty()
Gets the Difficulty of the world.
|
@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.
|
@Nullable DragonBattle |
getEnderDragonBattle()
Get the
DragonBattle associated with this world. |
@NotNull List<Entity> |
getEntities()
Get a list of all entities in this World
|
<T extends Entity> |
getEntitiesByClass(Class<T>... classes)
Deprecated.
|
<T extends Entity> |
getEntitiesByClass(@NotNull Class<T> cls)
Get a collection of all entities in this World matching the given
class/interface
|
@NotNull Collection<Entity> |
getEntitiesByClasses(Class<?>... classes)
Get a collection of all entities in this World matching any of the
given classes/interfaces
|
@Nullable Entity |
getEntity(@NotNull UUID uuid)
Gets an entity in this world by its UUID
|
int |
getEntityCount() |
@NotNull World.Environment |
getEnvironment()
Gets the
World.Environment type of this world |
@NotNull Collection<Chunk> |
getForceLoadedChunks()
Returns all force loaded chunks in this world.
|
long |
getFullTime()
Gets the full in-game time on this world
|
<T> T |
getGameRuleDefault(@NotNull GameRule<T> rule)
Get the default value for a given
GameRule . |
@NotNull String[] |
getGameRules()
Get an array containing the names of all the
GameRule s. |
<T> T |
getGameRuleValue(@NotNull GameRule<T> rule)
Get the current value for a given
GameRule . |
@Nullable String |
getGameRuleValue(@Nullable String rule)
Deprecated.
use
getGameRuleValue(GameRule) instead |
long |
getGameTime()
Gets the full in-game time on this world since the world generation
|
@Nullable ChunkGenerator |
getGenerator()
Gets the chunk generator for this world
|
@NotNull Block |
getHighestBlockAt(int x,
int z)
Gets the highest non-empty (impassable) block at the given coordinates.
|
@NotNull Block |
getHighestBlockAt(int x,
int z,
@NotNull HeightMap heightMap)
Gets the highest block corresponding to the
HeightMap at the
given coordinates. |
default @NotNull Block |
getHighestBlockAt(int x,
int z,
HeightmapType heightmap)
Deprecated.
Upstream has added support for this, use
getHighestBlockAt(int, int, HeightMap) |
@NotNull Block |
getHighestBlockAt(@NotNull Location location)
Gets the highest non-empty (impassable) block at the given coordinates.
|
@NotNull Block |
getHighestBlockAt(@NotNull Location location,
@NotNull HeightMap heightMap)
Gets the highest block corresponding to the
HeightMap at the
given coordinates. |
default @NotNull Block |
getHighestBlockAt(@NotNull Location location,
HeightmapType heightmap)
Deprecated.
Upstream has added support for this, use
getHighestBlockAt(Location, HeightMap) |
int |
getHighestBlockYAt(int x,
int z)
Gets the highest non-empty (impassable) coordinate at the given
coordinates.
|
int |
getHighestBlockYAt(int x,
int z,
@NotNull HeightMap heightMap)
Gets the highest coordinate corresponding to the
HeightMap at the
given coordinates. |
int |
getHighestBlockYAt(int x,
int z,
HeightmapType heightmap)
Deprecated.
Upstream has added support for this, use
getHighestBlockYAt(int, int, HeightMap) |
int |
getHighestBlockYAt(@NotNull Location location)
Gets the highest non-empty (impassable) coordinate at the given
Location . |
int |
getHighestBlockYAt(@NotNull Location location,
@NotNull HeightMap heightMap)
|
default int |
getHighestBlockYAt(@NotNull Location location,
HeightmapType heightmap)
Deprecated.
Upstream has added support for this, use
getHighestBlockYAt(Location, HeightMap) |
double |
getHumidity(int x,
int z)
Deprecated.
biomes are now 3-dimensional
|
double |
getHumidity(int x,
int y,
int z)
Gets the humidity for the given block coordinates.
|
@NotNull Collection<Material> |
getInfiniburn()
Gets the collection of materials that burn infinitely in this world.
|
boolean |
getKeepSpawnInMemory()
Gets whether the world's spawn area should be kept loaded into memory
or not.
|
@NotNull NamespacedKey |
getKey()
Get the world's key
|
@NotNull List<LivingEntity> |
getLivingEntities()
Get a list of all living entities in this World
|
@NotNull Chunk[] |
getLoadedChunks()
Gets an array of all loaded
Chunk s |
default @NotNull Location |
getLocationAtKey(long key)
Gets the
Location at the given block key |
int |
getMaxHeight()
Gets the maximum height of this world.
|
int |
getMinHeight()
Gets the minimum height of this world.
|
int |
getMonsterSpawnLimit()
Gets limit for number of monsters that can spawn in a chunk in this
world
|
MoonPhase |
getMoonPhase() |
@NotNull String |
getName()
Gets the unique name of this world
|
@NotNull Collection<Entity> |
getNearbyEntities(@NotNull BoundingBox boundingBox)
Returns a list of entities within the given bounding box.
|
@NotNull Collection<Entity> |
getNearbyEntities(@NotNull BoundingBox boundingBox,
@Nullable Predicate<Entity> filter)
Returns a list of entities within the given bounding box.
|
@NotNull Collection<Entity> |
getNearbyEntities(@NotNull Location location,
double x,
double y,
double z)
Returns a list of entities within a bounding box centered around a
Location.
|
@NotNull Collection<Entity> |
getNearbyEntities(@NotNull Location location,
double x,
double y,
double z,
@Nullable Predicate<Entity> filter)
Returns a list of entities within a bounding box centered around a
Location.
|
default <T extends Entity> |
getNearbyEntitiesByType(@Nullable Class<? extends Entity> clazz,
@NotNull Location loc,
double xRadius,
double yRadius,
double zRadius,
@Nullable Predicate<T> predicate)
Gets all nearby entities of the specified type, within the specified radius (bounding box)
|
default <T extends Entity> |
getNearbyEntitiesByType(@Nullable Class<? extends T> clazz,
@NotNull Location loc,
double radius)
Gets all nearby entities of the specified type, within the specified radius (bounding box)
|
default <T extends Entity> |
getNearbyEntitiesByType(@Nullable Class<? extends T> clazz,
@NotNull Location loc,
double xzRadius,
double yRadius)
Gets all nearby entities of the specified type, within the specified radius, with x and x radius matching (bounding box)
|
default <T extends Entity> |
getNearbyEntitiesByType(@Nullable Class<? extends T> clazz,
@NotNull Location loc,
double xRadius,
double yRadius,
double zRadius)
Gets all nearby entities of the specified type, within the specified radius (bounding box)
|
default <T extends Entity> |
getNearbyEntitiesByType(@Nullable Class<? extends T> clazz,
@NotNull Location loc,
double xzRadius,
double yRadius,
@Nullable Predicate<T> predicate)
Gets all nearby entities of the specified type, within the specified radius, with x and x radius matching (bounding box)
|
default <T extends Entity> |
getNearbyEntitiesByType(@Nullable Class<? extends T> clazz,
@NotNull Location loc,
double radius,
@Nullable Predicate<T> predicate)
Gets all nearby entities of the specified type, within the specified radius (bounding box)
|
default @NotNull Collection<LivingEntity> |
getNearbyLivingEntities(@NotNull Location loc,
double radius)
Gets nearby players within the specified radius (bounding box)
|
default @NotNull Collection<LivingEntity> |
getNearbyLivingEntities(@NotNull Location loc,
double xzRadius,
double yRadius)
Gets nearby players within the specified radius (bounding box)
|
default @NotNull Collection<LivingEntity> |
getNearbyLivingEntities(@NotNull Location loc,
double xRadius,
double yRadius,
double zRadius)
Gets nearby players within the specified radius (bounding box)
|
default @NotNull Collection<LivingEntity> |
getNearbyLivingEntities(@NotNull Location loc,
double xRadius,
double yRadius,
double zRadius,
@Nullable Predicate<LivingEntity> predicate)
Gets nearby players within the specified radius (bounding box)
|
default @NotNull Collection<LivingEntity> |
getNearbyLivingEntities(@NotNull Location loc,
double xzRadius,
double yRadius,
@Nullable Predicate<LivingEntity> predicate)
Gets nearby players within the specified radius (bounding box)
|
default @NotNull Collection<LivingEntity> |
getNearbyLivingEntities(@NotNull Location loc,
double radius,
@Nullable Predicate<LivingEntity> predicate)
Gets nearby players within the specified radius (bounding box)
|
default @NotNull Collection<Player> |
getNearbyPlayers(@NotNull Location loc,
double radius)
Gets nearby players within the specified radius (bounding box)
|
default @NotNull Collection<Player> |
getNearbyPlayers(@NotNull Location loc,
double xzRadius,
double yRadius)
Gets nearby players within the specified radius (bounding box)
|
default @NotNull Collection<Player> |
getNearbyPlayers(@NotNull Location loc,
double xRadius,
double yRadius,
double zRadius)
Gets nearby players within the specified radius (bounding box)
|
default @NotNull Collection<Player> |
getNearbyPlayers(@NotNull Location loc,
double xRadius,
double yRadius,
double zRadius,
@Nullable Predicate<Player> predicate)
Gets nearby players within the specified radius (bounding box)
|
default @NotNull Collection<Player> |
getNearbyPlayers(@NotNull Location loc,
double xzRadius,
double yRadius,
@Nullable Predicate<Player> predicate)
Gets nearby players within the specified radius (bounding box)
|
default @NotNull Collection<Player> |
getNearbyPlayers(@NotNull Location loc,
double radius,
@Nullable Predicate<Player> predicate)
Gets nearby players within the specified radius (bounding box)
|
int |
getNoTickViewDistance()
Returns the no-tick view distance for this world.
|
int |
getPlayerCount() |
@NotNull List<Player> |
getPlayers()
Get a list of all players in this World
|
@NotNull Map<Plugin,Collection<Chunk>> |
getPluginChunkTickets()
Returns a map of which plugins have tickets for what chunks.
|
@NotNull Collection<Plugin> |
getPluginChunkTickets(int x,
int z)
Retrieves a collection specifying which plugins have tickets for the
specified chunk.
|
@NotNull List<BlockPopulator> |
getPopulators()
Gets a list of all applied
BlockPopulator s for this World |
boolean |
getPVP()
Gets the current PVP setting for this world.
|
@NotNull List<Raid> |
getRaids()
Gets all raids that are going on over this world.
|
int |
getSeaLevel()
Gets the sea level for this world.
|
long |
getSeed()
Gets the Seed for this world.
|
@NotNull Location |
getSpawnLocation()
Gets the default spawn
Location of this world |
double |
getTemperature(int x,
int z)
Deprecated.
biomes are now 3-dimensional
|
double |
getTemperature(int x,
int y,
int z)
Gets the temperature for the given block coordinates.
|
int |
getThunderDuration()
Get the thundering duration.
|
int |
getTickableTileEntityCount() |
long |
getTicksPerAmbientSpawns()
Gets the world's ticks per ambient mob spawns value
|
long |
getTicksPerAnimalSpawns()
Gets the world's ticks per animal spawns value
|
long |
getTicksPerMonsterSpawns()
Gets the world's ticks per monster spawns value
|
long |
getTicksPerWaterAmbientSpawns()
Gets the default ticks per water ambient mob spawns value.
|
long |
getTicksPerWaterSpawns()
Gets the world's ticks per water mob spawns value
|
int |
getTileEntityCount() |
long |
getTime()
Gets the relative in-game time of this world.
|
@NotNull UUID |
getUID()
Gets the Unique ID of this world
|
int |
getViewDistance()
Returns the view distance used for this world.
|
int |
getWaterAmbientSpawnLimit()
Gets user-specified limit for number of water ambient mobs that can spawn
in a chunk.
|
int |
getWaterAnimalSpawnLimit()
Gets the limit for number of water animals that can spawn in a chunk in
this world
|
int |
getWeatherDuration()
Get the remaining time in ticks of the current conditions.
|
@NotNull WorldBorder |
getWorldBorder()
Gets the world border for this world.
|
@NotNull File |
getWorldFolder()
Gets the folder of this world on disk.
|
@Nullable WorldType |
getWorldType()
Deprecated.
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 |
hasBedrockCeiling()
Checks if the world has a bedrock ceiling
|
boolean |
hasRaids()
Checks if this world supports raids
|
boolean |
hasSkylight()
Checks if the world has skylight access
|
boolean |
hasStorm()
Returns whether the world has an ongoing storm.
|
boolean |
isAutoSave()
Gets whether or not the world will automatically save
|
boolean |
isChunkForceLoaded(int x,
int z)
Gets whether the chunk at the specified chunk coordinates is force
loaded.
|
boolean |
isChunkGenerated(int x,
int z)
Checks if the
Chunk at the specified coordinates is generated |
default boolean |
isChunkGenerated(long chunkKey)
Checks if a
Chunk has been generated at the specified chunk key,
which is the X and Z packed into a long. |
boolean |
isChunkInUse(int x,
int z)
Deprecated.
This method was added to facilitate chunk garbage collection.
As of the current Minecraft version chunks are now strictly managed and
will not be loaded for more than 1 tick unless they are in use.
|
boolean |
isChunkLoaded(@NotNull Chunk chunk)
Checks if the specified
Chunk is loaded |
boolean |
isChunkLoaded(int x,
int z)
Checks if the
Chunk at the specified coordinates is loaded |
boolean |
isClearWeather()
Returns whether the world has clear weather.
|
boolean |
isDayTime()
Check if it is currently daytime in this world
|
boolean |
isFixedTime()
Checks if this world has a fixed time
|
boolean |
isGameRule(@NotNull String rule)
Checks if string is a valid game rule
|
boolean |
isHardcore()
Gets whether the world is hardcore or not.
|
boolean |
isNatural()
Checks if the world is natural.
|
boolean |
isPiglinSafe()
Checks if piglins will turn into Zombified Piglins in this world
|
boolean |
isThundering()
Returns whether there is thunder.
|
boolean |
isUltrawarm()
Checks if the world:
evaporates water
dries sponges
has lava spread faster and further
|
void |
loadChunk(@NotNull Chunk chunk)
Loads the specified
Chunk . |
void |
loadChunk(int x,
int z)
Loads the
Chunk at the specified coordinates. |
boolean |
loadChunk(int x,
int z,
boolean generate)
Loads the
Chunk at the specified coordinates. |
@Nullable Location |
locateNearestBiome(@NotNull Location origin,
@NotNull Biome biome,
int radius)
Locates the nearest biome based on an origin, biome type, and radius to search.
|
@Nullable Location |
locateNearestBiome(@NotNull Location origin,
@NotNull Biome biome,
int radius,
int step)
Locates the nearest biome based on an origin, biome type, and radius to search
and step
|
@Nullable Raid |
locateNearestRaid(@NotNull Location location,
int radius)
Finds the nearest raid close to the given location.
|
@Nullable Location |
locateNearestStructure(@NotNull Location origin,
@NotNull StructureType structureType,
int radius,
boolean findUnexplored)
Find the closest nearby structure of a given
StructureType . |
void |
playEffect(@NotNull Location location,
@NotNull Effect effect,
int data)
Plays an effect to all players within a default radius around a given
location.
|
void |
playEffect(@NotNull Location location,
@NotNull Effect effect,
int data,
int radius)
Plays an effect to all players within a given radius around a location.
|
<T> void |
playEffect(@NotNull Location location,
@NotNull Effect effect,
T data)
Plays an effect to all players within a default radius around a given
location.
|
<T> void |
playEffect(@NotNull Location location,
@NotNull Effect effect,
T data,
int radius)
Plays an effect to all players within a given radius around a location.
|
void |
playSound(@NotNull Location location,
@NotNull Sound sound,
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)
Play a Sound at the provided Location in the World.
|
void |
playSound(@NotNull Location location,
@NotNull String sound,
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)
Play a Sound at the provided Location in the World.
|
@Nullable RayTraceResult |
rayTrace(@NotNull Location start,
@NotNull Vector direction,
double maxDistance,
@NotNull FluidCollisionMode fluidCollisionMode,
boolean ignorePassableBlocks,
double raySize,
@Nullable Predicate<Entity> filter)
Performs a ray trace that checks for both block and entity collisions.
|
@Nullable RayTraceResult |
rayTraceBlocks(@NotNull Location start,
@NotNull Vector direction,
double maxDistance)
Performs a ray trace that checks for block collisions using the blocks'
precise collision shapes.
|
@Nullable RayTraceResult |
rayTraceBlocks(@NotNull Location start,
@NotNull Vector direction,
double maxDistance,
@NotNull FluidCollisionMode fluidCollisionMode)
Performs a ray trace that checks for block collisions using the blocks'
precise collision shapes.
|
@Nullable RayTraceResult |
rayTraceBlocks(@NotNull Location start,
@NotNull Vector direction,
double maxDistance,
@NotNull FluidCollisionMode fluidCollisionMode,
boolean ignorePassableBlocks)
Performs a ray trace that checks for block collisions using the blocks'
precise collision shapes.
|
@Nullable RayTraceResult |
rayTraceEntities(@NotNull Location start,
@NotNull Vector direction,
double maxDistance)
Performs a ray trace that checks for entity collisions.
|
@Nullable RayTraceResult |
rayTraceEntities(@NotNull Location start,
@NotNull Vector direction,
double maxDistance,
double raySize)
Performs a ray trace that checks for entity collisions.
|
@Nullable RayTraceResult |
rayTraceEntities(@NotNull Location start,
@NotNull Vector direction,
double maxDistance,
double raySize,
@Nullable Predicate<Entity> filter)
Performs a ray trace that checks for entity collisions.
|
@Nullable RayTraceResult |
rayTraceEntities(@NotNull Location start,
@NotNull Vector direction,
double maxDistance,
@Nullable Predicate<Entity> filter)
Performs a ray trace that checks for entity collisions.
|
boolean |
refreshChunk(int x,
int z)
Deprecated.
This method is not guaranteed to work suitably across all client implementations.
|
boolean |
regenerateChunk(int x,
int z)
Deprecated.
regenerating a single chunk is not likely to produce the same
chunk as before as terrain decoration may be spread across chunks. Use of
this method should be avoided as it is known to produce buggy results.
|
boolean |
removePluginChunkTicket(int x,
int z,
@NotNull Plugin plugin)
Removes the specified plugin's ticket for the specified chunk
|
void |
removePluginChunkTickets(@NotNull Plugin plugin)
Removes all plugin tickets for the specified plugin
|
void |
save()
Saves world to disk
|
void |
setAmbientSpawnLimit(int limit)
Sets the limit for number of ambient mobs that can spawn in a chunk in
this world
|
void |
setAnimalSpawnLimit(int limit)
Sets the limit for number of animals that can spawn in a chunk in this
world
|
void |
setAutoSave(boolean value)
Sets whether or not the world will automatically save
|
void |
setBiome(int x,
int z,
@NotNull Biome bio)
Deprecated.
biomes are now 3-dimensional
|
void |
setBiome(int x,
int y,
int z,
@NotNull Biome bio)
Sets the biome for the given block coordinates
|
void |
setChunkForceLoaded(int x,
int z,
boolean forced)
Sets whether the chunk at the specified chunk coordinates is force
loaded.
|
void |
setClearWeatherDuration(int duration)
Set the clear weather duration.
|
void |
setDifficulty(@NotNull Difficulty difficulty)
Sets the Difficulty of the world.
|
void |
setFullTime(long time)
Sets the in-game time on the server
|
<T> boolean |
setGameRule(@NotNull GameRule<T> rule,
T newValue)
Set the given
GameRule 's new value. |
boolean |
setGameRuleValue(@NotNull String rule,
@NotNull String value)
Deprecated.
use
setGameRule(GameRule, Object) instead. |
void |
setHardcore(boolean hardcore)
Sets whether the world is hardcore or not.
|
void |
setKeepSpawnInMemory(boolean keepLoaded)
Sets whether the world's spawn area should be kept loaded into memory
or not.
|
void |
setMonsterSpawnLimit(int limit)
Sets the limit for number of monsters that can spawn in a chunk in this
world
|
void |
setNoTickViewDistance(int viewDistance)
Sets the no-tick view distance for this world.
|
void |
setPVP(boolean pvp)
Sets the PVP setting for this world.
|
void |
setSpawnFlags(boolean allowMonsters,
boolean allowAnimals)
Sets the spawn flags for this.
|
boolean |
setSpawnLocation(int x,
int y,
int z)
Sets the spawn location of the world
|
boolean |
setSpawnLocation(int x,
int y,
int z,
float angle)
Sets the spawn location of the world
|
boolean |
setSpawnLocation(@NotNull Location location)
Sets the spawn location of the world.
|
void |
setStorm(boolean hasStorm)
Set whether there is a storm.
|
void |
setThunderDuration(int duration)
Set the thundering duration.
|
void |
setThundering(boolean thundering)
Set whether it is thundering.
|
void |
setTicksPerAmbientSpawns(int ticksPerAmbientSpawns)
Sets the world's ticks per ambient mob spawns value
|
void |
setTicksPerAnimalSpawns(int ticksPerAnimalSpawns)
Sets the world's ticks per animal spawns value
|
void |
setTicksPerMonsterSpawns(int ticksPerMonsterSpawns)
Sets the world's ticks per monster spawns value
|
void |
setTicksPerWaterAmbientSpawns(int ticksPerAmbientSpawns)
Sets the world's ticks per water ambient mob spawns value
|
void |
setTicksPerWaterSpawns(int ticksPerWaterSpawns)
Sets the world's ticks per water mob spawns value
|
void |
setTime(long time)
Sets the relative in-game time on the server.
|
void |
setViewDistance(int viewDistance)
Sets the view distance for this world.
|
void |
setWaterAmbientSpawnLimit(int limit)
Sets the limit for number of water ambient mobs that can spawn in a chunk
in this world
|
void |
setWaterAnimalSpawnLimit(int limit)
Sets the limit for number of water animals that can spawn in a chunk in
this world
|
void |
setWeatherDuration(int duration)
Set the remaining time in ticks of the current conditions.
|
<T extends Entity> |
spawn(@NotNull Location location,
@NotNull Class<T> clazz)
Spawn an entity of a specific class at the given
Location |
default <T extends Entity> |
spawn(@NotNull Location location,
@NotNull Class<T> clazz,
@Nullable Consumer<T> function)
Spawn an entity of a specific class at the given
Location , with
the supplied function run before the entity is added to the world. |
<T extends Entity> |
spawn(@NotNull Location location,
@NotNull Class<T> clazz,
@Nullable Consumer<T> function,
CreatureSpawnEvent.SpawnReason reason) |
default <T extends Entity> |
spawn(@NotNull Location location,
@NotNull Class<T> clazz,
CreatureSpawnEvent.SpawnReason reason) |
default <T extends Entity> |
spawn(@NotNull Location location,
@NotNull Class<T> clazz,
CreatureSpawnEvent.SpawnReason reason,
@Nullable Consumer<T> function) |
@NotNull Arrow |
spawnArrow(@NotNull Location location,
@NotNull Vector direction,
float speed,
float spread)
|
<T extends AbstractArrow> |
spawnArrow(@NotNull Location location,
@NotNull Vector direction,
float speed,
float spread,
@NotNull Class<T> clazz)
Creates an arrow entity of the given class at the given
Location |
@NotNull Entity |
spawnEntity(@NotNull Location loc,
@NotNull EntityType type)
Creates a entity at the given
Location |
default @NotNull Entity |
spawnEntity(@NotNull Location loc,
@NotNull EntityType type,
CreatureSpawnEvent.SpawnReason reason) |
default @NotNull Entity |
spawnEntity(@NotNull Location loc,
@NotNull EntityType type,
CreatureSpawnEvent.SpawnReason reason,
@Nullable Consumer<Entity> function) |
@NotNull FallingBlock |
spawnFallingBlock(@NotNull Location location,
@NotNull BlockData data)
|
@NotNull FallingBlock |
spawnFallingBlock(@NotNull Location location,
@NotNull Material material,
byte data)
Deprecated.
Magic value
|
@NotNull FallingBlock |
spawnFallingBlock(@NotNull Location location,
@NotNull MaterialData 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.
|
default <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.
|
default <T> void |
spawnParticle(@NotNull Particle particle,
@Nullable List<Player> receivers,
@NotNull Player source,
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,
@Nullable List<Player> receivers,
@Nullable Player source,
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.
|
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.
|
@NotNull World.Spigot |
spigot() |
@NotNull LightningStrike |
strikeLightning(@NotNull Location loc)
Strikes lightning at the given
Location |
@NotNull LightningStrike |
strikeLightningEffect(@NotNull Location loc)
Strikes lightning at the given
Location without doing damage |
boolean |
unloadChunk(@NotNull Chunk chunk)
Safely unloads and saves the
Chunk at the specified coordinates |
boolean |
unloadChunk(int x,
int z)
Safely unloads and saves the
Chunk at the specified coordinates |
boolean |
unloadChunk(int x,
int z,
boolean save)
Safely unloads and optionally saves the
Chunk at the specified
coordinates. |
boolean |
unloadChunkRequest(int x,
int z)
Safely queues the
Chunk at the specified coordinates for
unloading. |
getListeningPluginChannels, sendPluginMessage
getMetadata, hasMetadata, removeMetadata, setMetadata
clearTitle, hideBossBar, openBook, playSound, playSound, resetTitle, sendActionBar, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeaderAndFooter, showBossBar, showTitle, stopSound
audience, audience, empty, openBook, sendActionBar, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeaderAndFooter, toAudience
int getEntityCount()
int getTileEntityCount()
int getTickableTileEntityCount()
int getChunkCount()
int getPlayerCount()
@NotNull MoonPhase getMoonPhase()
@NotNull @NotNull Block getBlockAt(int x, int y, int z)
Block
at the given coordinatesx
- X-coordinate of the blocky
- Y-coordinate of the blockz
- Z-coordinate of the block@NotNull @NotNull Block getBlockAt(@NotNull @NotNull Location location)
location
- Location of the block@NotNull default @NotNull Block getBlockAtKey(long key)
Block
at the given block keykey
- The block key. See Block.getBlockKey()
Block.getBlockKey(int, int, int)
@NotNull default @NotNull Location getLocationAtKey(long key)
Location
at the given block keykey
- The block key. See Location.toBlockKey()
Block.getBlockKey(int, int, int)
int getHighestBlockYAt(int x, int z)
x
- X-coordinate of the blocksz
- Z-coordinate of the blocksint getHighestBlockYAt(@NotNull @NotNull Location location)
Location
.location
- Location of the blocks@NotNull @NotNull Block getHighestBlockAt(int x, int z)
x
- X-coordinate of the blockz
- Z-coordinate of the block@NotNull @NotNull Block getHighestBlockAt(@NotNull @NotNull Location location)
location
- Coordinates to get the highest block@Deprecated int getHighestBlockYAt(int x, int z, @NotNull HeightmapType heightmap) throws UnsupportedOperationException
getHighestBlockYAt(int, int, HeightMap)
implNote: Implementations are recommended to use an iterative search as a fallback before resorting to
throwing an UnsupportedOperationException
.
x
- The block's x-coordinate.z
- The block's z-coordinate.heightmap
- The specified heightmap to use. See HeightmapType
UnsupportedOperationException
- If the heightmap type is not supported.HeightmapType
@Deprecated default int getHighestBlockYAt(@NotNull @NotNull Location location, @NotNull HeightmapType heightmap) throws UnsupportedOperationException
getHighestBlockYAt(Location, HeightMap)
implNote: Implementations are recommended to use an iterative search as a fallback before resorting to
throwing an UnsupportedOperationException
.
location
- The specified block coordinates.heightmap
- The specified heightmap to use. See HeightmapType
location
that matches the specified heightmap's conditions.UnsupportedOperationException
- If the heightmap type is not supported.HeightmapType
@Deprecated @NotNull default @NotNull Block getHighestBlockAt(int x, int z, @NotNull HeightmapType heightmap) throws UnsupportedOperationException
getHighestBlockAt(int, int, HeightMap)
Block
at the specified block coordinates that match the specified heightmap's conditions.
implNote: Implementations are recommended to use an iterative search as a fallback before resorting to
throwing an UnsupportedOperationException
.
x
- The block's x-coordinate.z
- The block's z-coordinate.heightmap
- The specified heightmap to use. See HeightmapType
Block
at (x, z) that matches the specified heightmap's conditions.UnsupportedOperationException
- If the heightmap type is not supported.HeightmapType
@Deprecated @NotNull default @NotNull Block getHighestBlockAt(@NotNull @NotNull Location location, @NotNull HeightmapType heightmap) throws UnsupportedOperationException
getHighestBlockAt(Location, HeightMap)
Block
at the specified block coordinates that match the specified heightmap's conditions.
Note that the y-coordinate of the specified location is ignored.
implNote: Implementations are recommended to use an iterative search as a fallback before resorting to
throwing an UnsupportedOperationException
.
location
- The specified block coordinates.heightmap
- The specified heightmap to use. See HeightmapType
Block
at location
that matches the specified heightmap's conditions.UnsupportedOperationException
- If the heightmap type is not supported.HeightmapType
int getHighestBlockYAt(int x, int z, @NotNull @NotNull HeightMap heightMap)
HeightMap
at the
given coordinates.x
- X-coordinate of the blocksz
- Z-coordinate of the blocksheightMap
- the heightMap that is used to determine the highest
pointHeightMap
int getHighestBlockYAt(@NotNull @NotNull Location location, @NotNull @NotNull HeightMap heightMap)
location
- Location of the blocksheightMap
- the heightMap that is used to determine the highest
pointHeightMap
@NotNull @NotNull Block getHighestBlockAt(int x, int z, @NotNull @NotNull HeightMap heightMap)
HeightMap
at the
given coordinates.x
- X-coordinate of the blockz
- Z-coordinate of the blockheightMap
- the heightMap that is used to determine the highest
pointHeightMap
@NotNull @NotNull Block getHighestBlockAt(@NotNull @NotNull Location location, @NotNull @NotNull HeightMap heightMap)
HeightMap
at the
given coordinates.location
- Coordinates to get the highest blockheightMap
- the heightMap that is used to determine the highest
pointHeightMap
@NotNull @NotNull Chunk getChunkAt(int x, int z)
Chunk
at the given coordinatesx
- X-coordinate of the chunkz
- Z-coordinate of the chunk@NotNull @NotNull Chunk getChunkAt(@NotNull @NotNull Location location)
location
- Location of the chunk@NotNull @NotNull Chunk getChunkAt(@NotNull @NotNull Block block)
block
- Block to get the containing chunk from@NotNull default @NotNull Chunk getChunkAt(long chunkKey)
Chunk.getChunkKey()
for easy access to the key, or you may calculate it as:
long chunkKey = (long) chunkX & 0xffffffffL | ((long) chunkZ & 0xffffffffL) >> 32;chunkKey
- The Chunk Key to look up the chunk bydefault boolean isChunkGenerated(long chunkKey)
Chunk
has been generated at the specified chunk key,
which is the X and Z packed into a long.chunkKey
- The Chunk Key to look up the chunk by@Deprecated default void getChunkAtAsync(int x, int z, @NotNull @NotNull World.ChunkLoadCallback cb)
Chunk
to be loaded at the given coordinates
This method makes no guarantee on how fast the chunk will load,
and will return the chunk to the callback at a later time.
You should use this method if you need a chunk but do not need it
immediately, and you wish to let the server control the speed
of chunk loads, keeping performance in mind.
The World.ChunkLoadCallback
will always be executed synchronously
on the main Server Thread.x
- Chunk X-coordinate of the chunk - (world coordinate / 16)z
- Chunk Z-coordinate of the chunk - (world coordinate / 16)cb
- Callback to receive the chunk when it is loaded.
will be executed synchronously@Deprecated default void getChunkAtAsync(@NotNull @NotNull Location loc, @NotNull @NotNull World.ChunkLoadCallback cb)
Chunk
to be loaded at the given Location
This method makes no guarantee on how fast the chunk will load,
and will return the chunk to the callback at a later time.
You should use this method if you need a chunk but do not need it
immediately, and you wish to let the server control the speed
of chunk loads, keeping performance in mind.
The World.ChunkLoadCallback
will always be executed synchronously
on the main Server Thread.loc
- Location of the chunkcb
- Callback to receive the chunk when it is loaded.
will be executed synchronously@Deprecated default void getChunkAtAsync(@NotNull @NotNull Block block, @NotNull @NotNull World.ChunkLoadCallback cb)
Chunk
to be loaded that contains the given Block
This method makes no guarantee on how fast the chunk will load,
and will return the chunk to the callback at a later time.
You should use this method if you need a chunk but do not need it
immediately, and you wish to let the server control the speed
of chunk loads, keeping performance in mind.
The World.ChunkLoadCallback
will always be executed synchronously
on the main Server Thread.block
- Block to get the containing chunk fromcb
- Callback to receive the chunk when it is loaded.
will be executed synchronouslydefault void getChunkAtAsync(int x, int z, @NotNull Consumer<Chunk> cb)
Chunk
to be loaded at the given coordinates
This method makes no guarantee on how fast the chunk will load,
and will return the chunk to the callback at a later time.
You should use this method if you need a chunk but do not need it
immediately, and you wish to let the server control the speed
of chunk loads, keeping performance in mind.
The Consumer
will always be executed synchronously
on the main Server Thread.x
- Chunk X-coordinate of the chunk - (world coordinate / 16)z
- Chunk Z-coordinate of the chunk - (world coordinate / 16)cb
- Callback to receive the chunk when it is loaded.
will be executed synchronouslydefault void getChunkAtAsync(int x, int z, boolean gen, @NotNull Consumer<Chunk> cb)
Chunk
to be loaded at the given coordinates
This method makes no guarantee on how fast the chunk will load,
and will return the chunk to the callback at a later time.
You should use this method if you need a chunk but do not need it
immediately, and you wish to let the server control the speed
of chunk loads, keeping performance in mind.
The Consumer
will always be executed synchronously
on the main Server Thread.x
- Chunk X-coordinate of the chunk - (world coordinate / 16)z
- Chunk Z-coordinate of the chunk - (world coordinate / 16)gen
- Should we generate a chunk if it doesn't exists or notcb
- Callback to receive the chunk when it is loaded.
will be executed synchronouslydefault void getChunkAtAsync(@NotNull @NotNull Location loc, @NotNull Consumer<Chunk> cb)
Chunk
to be loaded at the given Location
This method makes no guarantee on how fast the chunk will load,
and will return the chunk to the callback at a later time.
You should use this method if you need a chunk but do not need it
immediately, and you wish to let the server control the speed
of chunk loads, keeping performance in mind.
The Consumer
will always be executed synchronously
on the main Server Thread.loc
- Location of the chunkcb
- Callback to receive the chunk when it is loaded.
will be executed synchronouslydefault void getChunkAtAsync(@NotNull @NotNull Location loc, boolean gen, @NotNull Consumer<Chunk> cb)
Chunk
to be loaded at the given Location
This method makes no guarantee on how fast the chunk will load,
and will return the chunk to the callback at a later time.
You should use this method if you need a chunk but do not need it
immediately, and you wish to let the server control the speed
of chunk loads, keeping performance in mind.
The Consumer
will always be executed synchronously
on the main Server Thread.loc
- Location of the chunkgen
- Should the chunk generatecb
- Callback to receive the chunk when it is loaded.
will be executed synchronouslydefault void getChunkAtAsync(@NotNull @NotNull Block block, @NotNull Consumer<Chunk> cb)
Chunk
to be loaded that contains the given Block
This method makes no guarantee on how fast the chunk will load,
and will return the chunk to the callback at a later time.
You should use this method if you need a chunk but do not need it
immediately, and you wish to let the server control the speed
of chunk loads, keeping performance in mind.
The Consumer
will always be executed synchronously
on the main Server Thread.block
- Block to get the containing chunk fromcb
- Callback to receive the chunk when it is loaded.
will be executed synchronouslydefault void getChunkAtAsync(@NotNull @NotNull Block block, boolean gen, @NotNull Consumer<Chunk> cb)
Chunk
to be loaded that contains the given Block
This method makes no guarantee on how fast the chunk will load,
and will return the chunk to the callback at a later time.
You should use this method if you need a chunk but do not need it
immediately, and you wish to let the server control the speed
of chunk loads, keeping performance in mind.
The Consumer
will always be executed synchronously
on the main Server Thread.block
- Block to get the containing chunk fromgen
- Should the chunk generatecb
- Callback to receive the chunk when it is loaded.
will be executed synchronously@NotNull default CompletableFuture<Chunk> getChunkAtAsync(@NotNull @NotNull Location loc)
Chunk
to be loaded at the given coordinates
This method makes no guarantee on how fast the chunk will load,
and will return the chunk to the callback at a later time.
You should use this method if you need a chunk but do not need it
immediately, and you wish to let the server control the speed
of chunk loads, keeping performance in mind.
The future will always be executed synchronously
on the main Server Thread.loc
- Location to load the corresponding chunk from@NotNull default CompletableFuture<Chunk> getChunkAtAsync(@NotNull @NotNull Location loc, boolean gen)
Chunk
to be loaded at the given coordinates
This method makes no guarantee on how fast the chunk will load,
and will return the chunk to the callback at a later time.
You should use this method if you need a chunk but do not need it
immediately, and you wish to let the server control the speed
of chunk loads, keeping performance in mind.
The future will always be executed synchronously
on the main Server Thread.loc
- Location to load the corresponding chunk fromgen
- Should the chunk generate@NotNull default CompletableFuture<Chunk> getChunkAtAsync(@NotNull @NotNull Block block)
Chunk
to be loaded at the given coordinates
This method makes no guarantee on how fast the chunk will load,
and will return the chunk to the callback at a later time.
You should use this method if you need a chunk but do not need it
immediately, and you wish to let the server control the speed
of chunk loads, keeping performance in mind.
The future will always be executed synchronously
on the main Server Thread.block
- Block to load the corresponding chunk from@NotNull default CompletableFuture<Chunk> getChunkAtAsync(@NotNull @NotNull Block block, boolean gen)
Chunk
to be loaded at the given coordinates
This method makes no guarantee on how fast the chunk will load,
and will return the chunk to the callback at a later time.
You should use this method if you need a chunk but do not need it
immediately, and you wish to let the server control the speed
of chunk loads, keeping performance in mind.
The future will always be executed synchronously
on the main Server Thread.block
- Block to load the corresponding chunk fromgen
- Should the chunk generate@NotNull default CompletableFuture<Chunk> getChunkAtAsync(int x, int z)
Chunk
to be loaded at the given coordinates
This method makes no guarantee on how fast the chunk will load,
and will return the chunk to the callback at a later time.
You should use this method if you need a chunk but do not need it
immediately, and you wish to let the server control the speed
of chunk loads, keeping performance in mind.
The future will always be executed synchronously
on the main Server Thread.x
- X Coordz
- Z Coord@NotNull default CompletableFuture<Chunk> getChunkAtAsync(int x, int z, boolean gen)
Chunk
to be loaded at the given coordinates
This method makes no guarantee on how fast the chunk will load,
and will return the chunk to the callback at a later time.
You should use this method if you need a chunk but do not need it
immediately, and you wish to let the server control the speed
of chunk loads, keeping performance in mind.
The future will always be executed synchronously
on the main Server Thread.x
- Chunk X-coordinate of the chunk - (world coordinate / 16)z
- Chunk Z-coordinate of the chunk - (world coordinate / 16)gen
- Should we generate a chunk if it doesn't exists or not@NotNull default CompletableFuture<Chunk> getChunkAtAsyncUrgently(@NotNull @NotNull Location loc)
Chunk
to be loaded at the given coordinates
This method makes no guarantee on how fast the chunk will load,
and will return the chunk to the callback at a later time.
You should use this method if you need a chunk but do not need it
immediately, and you wish to let the server control the speed
of chunk loads, keeping performance in mind.
The future will always be executed synchronously
on the main Server Thread.loc
- Location to load the corresponding chunk from@NotNull default CompletableFuture<Chunk> getChunkAtAsyncUrgently(@NotNull @NotNull Location loc, boolean gen)
Chunk
to be loaded at the given coordinates
This method makes no guarantee on how fast the chunk will load,
and will return the chunk to the callback at a later time.
You should use this method if you need a chunk but do not need it
immediately, and you wish to let the server control the speed
of chunk loads, keeping performance in mind.
The future will always be executed synchronously
on the main Server Thread.loc
- Location to load the corresponding chunk fromgen
- Should the chunk generate@NotNull default CompletableFuture<Chunk> getChunkAtAsyncUrgently(@NotNull @NotNull Block block)
Chunk
to be loaded at the given coordinates
This method makes no guarantee on how fast the chunk will load,
and will return the chunk to the callback at a later time.
You should use this method if you need a chunk but do not need it
immediately, and you wish to let the server control the speed
of chunk loads, keeping performance in mind.
The future will always be executed synchronously
on the main Server Thread.block
- Block to load the corresponding chunk from@NotNull default CompletableFuture<Chunk> getChunkAtAsyncUrgently(@NotNull @NotNull Block block, boolean gen)
Chunk
to be loaded at the given coordinates
This method makes no guarantee on how fast the chunk will load,
and will return the chunk to the callback at a later time.
You should use this method if you need a chunk but do not need it
immediately, and you wish to let the server control the speed
of chunk loads, keeping performance in mind.
The future will always be executed synchronously
on the main Server Thread.block
- Block to load the corresponding chunk fromgen
- Should the chunk generate@NotNull default CompletableFuture<Chunk> getChunkAtAsyncUrgently(int x, int z)
Chunk
to be loaded at the given coordinates
This method makes no guarantee on how fast the chunk will load,
and will return the chunk to the callback at a later time.
You should use this method if you need a chunk but do not need it
immediately, and you wish to let the server control the speed
of chunk loads, keeping performance in mind.
The future will always be executed synchronously
on the main Server Thread.x
- X Coordz
- Z Coord@NotNull CompletableFuture<Chunk> getChunkAtAsync(int x, int z, boolean gen, boolean urgent)
@NotNull @NotNull NamespacedKey getKey()
boolean isChunkLoaded(@NotNull @NotNull Chunk chunk)
Chunk
is loadedchunk
- The chunk to check@NotNull @NotNull Chunk[] getLoadedChunks()
Chunk
svoid loadChunk(@NotNull @NotNull Chunk chunk)
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
- The chunk to loadboolean isChunkLoaded(int x, int z)
Chunk
at the specified coordinates is loadedx
- X-coordinate of the chunkz
- Z-coordinate of the chunkboolean isChunkGenerated(int x, int z)
Chunk
at the specified coordinates is generatedx
- X-coordinate of the chunkz
- Z-coordinate of the chunk@Deprecated boolean isChunkInUse(int x, int z)
Chunk
at the specified coordinates is loaded and
in use by one or more playersx
- X-coordinate of the chunkz
- Z-coordinate of the chunkvoid loadChunk(int x, int z)
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-coordinate of the chunkz
- Z-coordinate of the chunkboolean loadChunk(int x, int z, boolean generate)
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-coordinate of the chunkz
- Z-coordinate of the chunkgenerate
- Whether or not to generate a chunk if it doesn't
already existboolean unloadChunk(@NotNull @NotNull Chunk chunk)
Chunk
at the specified coordinates
This method is analogous to unloadChunk(int, int, boolean)
where save is true.
chunk
- the chunk to unloadboolean unloadChunk(int x, int z)
Chunk
at the specified coordinates
This method is analogous to unloadChunk(int, int, boolean)
where save is true.
x
- X-coordinate of the chunkz
- Z-coordinate of the chunkboolean unloadChunk(int x, int z, boolean save)
Chunk
at the specified
coordinates.x
- X-coordinate of the chunkz
- Z-coordinate of the chunksave
- Whether or not to save the chunkboolean unloadChunkRequest(int x, int z)
Chunk
at the specified coordinates for
unloading.x
- X-coordinate of the chunkz
- Z-coordinate of the chunk@Deprecated boolean regenerateChunk(int x, int z)
Chunk
at the specified coordinatesx
- X-coordinate of the chunkz
- Z-coordinate of the chunk@Deprecated boolean refreshChunk(int x, int z)
Chunk
to all clientsx
- X-coordinate of the chunkz
- Z-coordinate of the chunkboolean isChunkForceLoaded(int x, int z)
A force loaded chunk will not be unloaded due to lack of player activity.
x
- X-coordinate of the chunkz
- Z-coordinate of the chunkvoid setChunkForceLoaded(int x, int z, boolean forced)
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@NotNull @NotNull Collection<Chunk> getForceLoadedChunks()
A force loaded chunk will not be unloaded due to lack of player activity.
boolean addPluginChunkTicket(int x, int z, @NotNull @NotNull Plugin plugin)
A plugin ticket will prevent a chunk from unloading until it is explicitly removed. A plugin instance may only have one ticket per chunk, but each chunk can have multiple plugin tickets.
x
- X-coordinate of the chunkz
- Z-coordinate of the chunkplugin
- Plugin which owns the tickettrue
if a plugin ticket was added, false
if the
ticket already exists for the pluginIllegalStateException
- If the specified plugin is not enabledremovePluginChunkTicket(int, int, Plugin)
boolean removePluginChunkTicket(int x, int z, @NotNull @NotNull Plugin plugin)
A plugin ticket will prevent a chunk from unloading until it is explicitly removed. A plugin instance may only have one ticket per chunk, but each chunk can have multiple plugin tickets.
x
- X-coordinate of the chunkz
- Z-coordinate of the chunkplugin
- Plugin which owns the tickettrue
if the plugin ticket was removed, false
if
there is no plugin ticket for the chunkaddPluginChunkTicket(int, int, Plugin)
void removePluginChunkTickets(@NotNull @NotNull Plugin plugin)
A plugin ticket will prevent a chunk from unloading until it is explicitly removed. A plugin instance may only have one ticket per chunk, but each chunk can have multiple plugin tickets.
plugin
- Specified pluginaddPluginChunkTicket(int, int, Plugin)
,
removePluginChunkTicket(int, int, Plugin)
@NotNull @NotNull Collection<Plugin> getPluginChunkTickets(int x, int z)
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 chunkaddPluginChunkTicket(int, int, Plugin)
,
removePluginChunkTicket(int, int, Plugin)
@NotNull @NotNull Map<Plugin,Collection<Chunk>> getPluginChunkTickets()
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.
addPluginChunkTicket(int, int, Plugin)
,
removePluginChunkTicket(int, int, Plugin)
@NotNull @NotNull Item dropItem(@NotNull @NotNull Location location, @NotNull @NotNull ItemStack item)
Location
location
- Location to drop the itemitem
- ItemStack to drop@NotNull @NotNull Item dropItem(@NotNull @NotNull Location location, @NotNull @NotNull ItemStack item, @Nullable @Nullable Consumer<Item> function)
Location
Note that functions will run before the entity is spawnedlocation
- Location to drop the itemitem
- ItemStack to dropfunction
- the function to be run before the entity is spawned.@NotNull @NotNull Item dropItemNaturally(@NotNull @NotNull Location location, @NotNull @NotNull ItemStack item)
Location
with a random offsetlocation
- Location to drop the itemitem
- ItemStack to drop@NotNull @NotNull Item dropItemNaturally(@NotNull @NotNull Location location, @NotNull @NotNull ItemStack item, @Nullable @Nullable Consumer<Item> function)
Location
with a random offset
Note that functions will run before the entity is spawnedlocation
- Location to drop the itemitem
- ItemStack to dropfunction
- the function to be run before the entity is spawned.@NotNull @NotNull Arrow spawnArrow(@NotNull @NotNull Location location, @NotNull @NotNull Vector direction, float speed, float spread)
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 12@NotNull <T extends AbstractArrow> T spawnArrow(@NotNull @NotNull Location location, @NotNull @NotNull Vector direction, float speed, float spread, @NotNull @NotNull Class<T> clazz)
Location
T
- type of arrow to spawnlocation
- 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 arrow
SpectralArrow
,Arrow
,TippedArrow
boolean generateTree(@NotNull @NotNull Location location, @NotNull @NotNull TreeType type)
Location
location
- Location to spawn the treetype
- Type of the tree to createboolean generateTree(@NotNull @NotNull Location loc, @NotNull @NotNull TreeType type, @NotNull @NotNull BlockChangeDelegate delegate)
Location
loc
- Location to spawn the treetype
- Type of the tree to createdelegate
- A class to call for each block changed as a result of
this method@NotNull @NotNull Entity spawnEntity(@NotNull @NotNull Location loc, @NotNull @NotNull EntityType type)
Location
loc
- The location to spawn the entitytype
- The entity to spawn@NotNull @NotNull LightningStrike strikeLightning(@NotNull @NotNull Location loc)
Location
loc
- The location to strike lightning@NotNull @NotNull LightningStrike strikeLightningEffect(@NotNull @NotNull Location loc)
Location
without doing damageloc
- The location to strike lightning@NotNull @NotNull List<Entity> getEntities()
@NotNull @NotNull List<LivingEntity> getLivingEntities()
@Deprecated @NotNull <T extends Entity> @NotNull Collection<T> getEntitiesByClass(@NotNull Class<T>... classes)
T
- an entity subclassclasses
- The classes representing the types of entity to match@NotNull <T extends Entity> @NotNull Collection<T> getEntitiesByClass(@NotNull @NotNull Class<T> cls)
T
- an entity subclasscls
- The class representing the type of entity to match@NotNull @NotNull Collection<Entity> getEntitiesByClasses(@NotNull Class<?>... classes)
classes
- The classes representing the types of entity to match@NotNull default @NotNull Collection<LivingEntity> getNearbyLivingEntities(@NotNull @NotNull Location loc, double radius)
loc
- Center locationradius
- Radius@NotNull default @NotNull Collection<LivingEntity> getNearbyLivingEntities(@NotNull @NotNull Location loc, double xzRadius, double yRadius)
loc
- Center locationxzRadius
- X/Z RadiusyRadius
- Y Radius@NotNull default @NotNull Collection<LivingEntity> getNearbyLivingEntities(@NotNull @NotNull Location loc, double xRadius, double yRadius, double zRadius)
loc
- Center locationxRadius
- X RadiusyRadius
- Y RadiuszRadius
- Z radius@NotNull default @NotNull Collection<LivingEntity> getNearbyLivingEntities(@NotNull @NotNull Location loc, double radius, @Nullable @Nullable Predicate<LivingEntity> predicate)
loc
- Center locationradius
- X Radiuspredicate
- a predicate used to filter results@NotNull default @NotNull Collection<LivingEntity> getNearbyLivingEntities(@NotNull @NotNull Location loc, double xzRadius, double yRadius, @Nullable @Nullable Predicate<LivingEntity> predicate)
loc
- Center locationxzRadius
- X/Z RadiusyRadius
- Y Radiuspredicate
- a predicate used to filter results@NotNull default @NotNull Collection<LivingEntity> getNearbyLivingEntities(@NotNull @NotNull Location loc, double xRadius, double yRadius, double zRadius, @Nullable @Nullable Predicate<LivingEntity> predicate)
loc
- Center locationxRadius
- X RadiusyRadius
- Y RadiuszRadius
- Z radiuspredicate
- a predicate used to filter results@NotNull default @NotNull Collection<Player> getNearbyPlayers(@NotNull @NotNull Location loc, double radius)
loc
- Center locationradius
- X/Y/Z Radius@NotNull default @NotNull Collection<Player> getNearbyPlayers(@NotNull @NotNull Location loc, double xzRadius, double yRadius)
loc
- Center locationxzRadius
- X/Z RadiusyRadius
- Y Radius@NotNull default @NotNull Collection<Player> getNearbyPlayers(@NotNull @NotNull Location loc, double xRadius, double yRadius, double zRadius)
loc
- Center locationxRadius
- X RadiusyRadius
- Y RadiuszRadius
- Z Radius@NotNull default @NotNull Collection<Player> getNearbyPlayers(@NotNull @NotNull Location loc, double radius, @Nullable @Nullable Predicate<Player> predicate)
loc
- Center locationradius
- X/Y/Z Radiuspredicate
- a predicate used to filter results@NotNull default @NotNull Collection<Player> getNearbyPlayers(@NotNull @NotNull Location loc, double xzRadius, double yRadius, @Nullable @Nullable Predicate<Player> predicate)
loc
- Center locationxzRadius
- X/Z RadiusyRadius
- Y Radiuspredicate
- a predicate used to filter results@NotNull default @NotNull Collection<Player> getNearbyPlayers(@NotNull @NotNull Location loc, double xRadius, double yRadius, double zRadius, @Nullable @Nullable Predicate<Player> predicate)
loc
- Center locationxRadius
- X RadiusyRadius
- Y RadiuszRadius
- Z Radiuspredicate
- a predicate used to filter results@NotNull default <T extends Entity> @NotNull Collection<T> getNearbyEntitiesByType(@Nullable @Nullable Class<? extends T> clazz, @NotNull @NotNull Location loc, double radius)
T
- the entity typeclazz
- Type to filter byloc
- Center locationradius
- X/Y/Z radius to search within@NotNull default <T extends Entity> @NotNull Collection<T> getNearbyEntitiesByType(@Nullable @Nullable Class<? extends T> clazz, @NotNull @NotNull Location loc, double xzRadius, double yRadius)
T
- the entity typeclazz
- Type to filter byloc
- Center locationxzRadius
- X/Z radius to search withinyRadius
- Y radius to search within@NotNull default <T extends Entity> @NotNull Collection<T> getNearbyEntitiesByType(@Nullable @Nullable Class<? extends T> clazz, @NotNull @NotNull Location loc, double xRadius, double yRadius, double zRadius)
T
- the entity typeclazz
- Type to filter byloc
- Center locationxRadius
- X RadiusyRadius
- Y RadiuszRadius
- Z Radius@NotNull default <T extends Entity> @NotNull Collection<T> getNearbyEntitiesByType(@Nullable @Nullable Class<? extends T> clazz, @NotNull @NotNull Location loc, double radius, @Nullable @Nullable Predicate<T> predicate)
T
- the entity typeclazz
- Type to filter byloc
- Center locationradius
- X/Y/Z radius to search withinpredicate
- a predicate used to filter results@NotNull default <T extends Entity> @NotNull Collection<T> getNearbyEntitiesByType(@Nullable @Nullable Class<? extends T> clazz, @NotNull @NotNull Location loc, double xzRadius, double yRadius, @Nullable @Nullable Predicate<T> predicate)
T
- the entity typeclazz
- Type to filter byloc
- Center locationxzRadius
- X/Z radius to search withinyRadius
- Y radius to search withinpredicate
- a predicate used to filter results@NotNull default <T extends Entity> @NotNull Collection<T> getNearbyEntitiesByType(@Nullable @Nullable Class<? extends Entity> clazz, @NotNull @NotNull Location loc, double xRadius, double yRadius, double zRadius, @Nullable @Nullable Predicate<T> predicate)
T
- the entity typeclazz
- Type to filter byloc
- Center locationxRadius
- X RadiusyRadius
- Y RadiuszRadius
- Z Radiuspredicate
- a predicate used to filter results@NotNull @NotNull List<Player> getPlayers()
@NotNull default @NotNull Iterable<? extends net.kyori.adventure.audience.Audience> audiences()
audiences
in interface net.kyori.adventure.audience.ForwardingAudience
@NotNull @NotNull Collection<Entity> getNearbyEntities(@NotNull @NotNull Location location, double x, double y, double z)
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 axis@Nullable @Nullable Entity getEntity(@NotNull @NotNull UUID uuid)
uuid
- the UUID of the entity@NotNull @NotNull Collection<Entity> getNearbyEntities(@NotNull @NotNull Location location, double x, double y, double z, @Nullable @Nullable Predicate<Entity> filter)
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,
or null
to consider all entities@NotNull @NotNull Collection<Entity> getNearbyEntities(@NotNull @NotNull BoundingBox boundingBox)
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@NotNull @NotNull Collection<Entity> getNearbyEntities(@NotNull @NotNull BoundingBox boundingBox, @Nullable @Nullable Predicate<Entity> filter)
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,
or null
to consider all entities@Nullable @Nullable RayTraceResult rayTraceEntities(@NotNull @NotNull Location start, @NotNull @NotNull Vector direction, double maxDistance)
This may not consider entities in currently unloaded chunks. Some implementations may impose artificial restrictions on the maximum distance.
start
- the start positiondirection
- the ray directionmaxDistance
- the maximum distancenull
if there
is no hitrayTraceEntities(Location, Vector, double, double, Predicate)
@Nullable @Nullable RayTraceResult rayTraceEntities(@NotNull @NotNull Location start, @NotNull @NotNull Vector direction, double maxDistance, double raySize)
This may not consider entities in currently unloaded chunks. Some implementations may impose artificial restrictions on the maximum distance.
start
- the start positiondirection
- the ray directionmaxDistance
- the maximum distanceraySize
- entity bounding boxes will be uniformly expanded (or
shrinked) by this value before doing collision checksnull
if there
is no hitrayTraceEntities(Location, Vector, double, double, Predicate)
@Nullable @Nullable RayTraceResult rayTraceEntities(@NotNull @NotNull Location start, @NotNull @NotNull Vector direction, double maxDistance, @Nullable @Nullable Predicate<Entity> filter)
This may not consider entities in currently unloaded chunks. Some implementations may impose artificial restrictions on the maximum distance.
start
- the start positiondirection
- the ray directionmaxDistance
- the maximum distancefilter
- only entities that fulfill this predicate are considered,
or null
to consider all entitiesnull
if there
is no hitrayTraceEntities(Location, Vector, double, double, Predicate)
@Nullable @Nullable RayTraceResult rayTraceEntities(@NotNull @NotNull Location start, @NotNull @NotNull Vector direction, double maxDistance, double raySize, @Nullable @Nullable Predicate<Entity> filter)
This may not consider entities in currently unloaded chunks. Some implementations may impose artificial restrictions on the maximum distance.
start
- the start positiondirection
- the ray directionmaxDistance
- the maximum distanceraySize
- entity bounding boxes will be uniformly expanded (or
shrinked) by this value before doing collision checksfilter
- only entities that fulfill this predicate are considered,
or null
to consider all entitiesnull
if there
is no hit@Nullable @Nullable RayTraceResult rayTraceBlocks(@NotNull @NotNull Location start, @NotNull @NotNull Vector direction, double maxDistance)
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
- the start locationdirection
- the ray directionmaxDistance
- the maximum distancenull
if there is no hitrayTraceBlocks(Location, Vector, double, FluidCollisionMode, boolean)
@Nullable @Nullable RayTraceResult rayTraceBlocks(@NotNull @NotNull Location start, @NotNull @NotNull Vector direction, double maxDistance, @NotNull @NotNull FluidCollisionMode fluidCollisionMode)
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
- the start locationdirection
- the ray directionmaxDistance
- the maximum distancefluidCollisionMode
- the fluid collision modenull
if there is no hitrayTraceBlocks(Location, Vector, double, FluidCollisionMode, boolean)
@Nullable @Nullable RayTraceResult rayTraceBlocks(@NotNull @NotNull Location start, @NotNull @NotNull Vector direction, double maxDistance, @NotNull @NotNull FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks)
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
- the start locationdirection
- the ray directionmaxDistance
- the maximum distancefluidCollisionMode
- the fluid collision modeignorePassableBlocks
- whether to ignore passable but collidable
blocks (ex. tall grass, signs, fluids, ..)null
if there is no hit@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<Entity> filter)
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
- the start locationdirection
- the ray directionmaxDistance
- the maximum distancefluidCollisionMode
- the fluid collision modeignorePassableBlocks
- whether to ignore passable but collidable
blocks (ex. tall grass, signs, fluids, ..)raySize
- entity bounding boxes will be uniformly expanded (or
shrinked) by this value before doing collision checksfilter
- only entities that fulfill this predicate are considered,
or null
to consider all entitiesnull
if there is no hit@NotNull @NotNull String getName()
@NotNull @NotNull UUID getUID()
@NotNull @NotNull Location getSpawnLocation()
Location
of this worldboolean setSpawnLocation(@NotNull @NotNull Location location)
location
- The Location
to set the spawn for this world at.boolean setSpawnLocation(int x, int y, int z, float angle)
x
- X coordinatey
- Y coordinatez
- Z coordinateangle
- the angleboolean setSpawnLocation(int x, int y, int z)
x
- X coordinatey
- Y coordinatez
- Z coordinatelong getTime()
The relative time is analogous to hours * 1000
Returns an absolute time of this world
void setTime(long time)
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
- The new relative time to set the in-game time to (in
hours*1000)Sets the absolute time of this world
long getFullTime()
Returns a relative time of this world
void setFullTime(long time)
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
- The new absolute time to set this world toSets the relative time of this world
boolean isDayTime()
long getGameTime()
Returns a relative time of this world
,
Returns an absolute time of this world
boolean hasStorm()
void setStorm(boolean hasStorm)
setClearWeatherDuration(int)
with 0
ticks to reset the world's clear weather.hasStorm
- Whether there is rain and snowint getWeatherDuration()
void setWeatherDuration(int duration)
duration
- Time in ticksboolean isThundering()
void setThundering(boolean thundering)
setClearWeatherDuration(int)
with 0
ticks to reset the world's clear weather.thundering
- Whether it is thunderingint getThunderDuration()
void setThunderDuration(int duration)
duration
- Duration in ticksboolean isClearWeather()
isThundering()
and
hasStorm()
are both false.void setClearWeatherDuration(int duration)
/weather clear
with a set
amount of ticks.duration
- duration in ticksint getClearWeatherDuration()
boolean createExplosion(double x, double y, double z, float power)
x
- X coordinatey
- Y coordinatez
- Z coordinatepower
- The power of explosion, where 4F is TNTboolean createExplosion(double x, double y, double z, float power, boolean setFire)
x
- X coordinatey
- Y coordinatez
- Z coordinatepower
- The power of explosion, where 4F is TNTsetFire
- Whether or not to set blocks on fireboolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks)
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 destroyedboolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks, @Nullable @Nullable Entity source)
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 damageboolean createExplosion(@NotNull @NotNull Location loc, float power)
loc
- Location to blow uppower
- The power of explosion, where 4F is TNTboolean createExplosion(@NotNull @NotNull Location loc, float power, boolean setFire)
loc
- Location to blow uppower
- The power of explosion, where 4F is TNTsetFire
- Whether or not to set blocks on fireboolean createExplosion(@Nullable @Nullable Entity source, @NotNull @NotNull Location loc, float power, boolean setFire, boolean breakBlocks)
source
- The source entity of the explosionloc
- 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 destroyeddefault boolean createExplosion(@Nullable @Nullable Entity source, @NotNull @NotNull Location loc, float power, boolean setFire)
source
- The source entity of the explosionloc
- Location to blow uppower
- The power of explosion, where 4F is TNTsetFire
- Whether or not to set blocks on firedefault boolean createExplosion(@Nullable @Nullable Entity source, @NotNull @NotNull Location loc, float power)
source
- The source entity of the explosionloc
- Location to blow uppower
- The power of explosion, where 4F is TNTdefault boolean createExplosion(@NotNull @NotNull Entity source, float power, boolean setFire, boolean breakBlocks)
source
- The source entity of the explosionpower
- The power of explosion, where 4F is TNTsetFire
- Whether or not to set blocks on firebreakBlocks
- Whether or not to have blocks be destroyeddefault boolean createExplosion(@NotNull @NotNull Entity source, float power, boolean setFire)
source
- The source entity of the explosionpower
- The power of explosion, where 4F is TNTsetFire
- Whether or not to set blocks on firedefault boolean createExplosion(@NotNull @NotNull Entity source, float power)
source
- The source entity of the explosionpower
- The power of explosion, where 4F is TNTboolean createExplosion(@NotNull @NotNull Location loc, float power, boolean setFire, boolean breakBlocks)
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 destroyedboolean createExplosion(@NotNull @NotNull Location loc, float power, boolean setFire, boolean breakBlocks, @Nullable @Nullable Entity source)
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@NotNull @NotNull World.Environment getEnvironment()
World.Environment
type of this worldlong getSeed()
boolean getPVP()
void setPVP(boolean pvp)
pvp
- True/False whether PVP should be Enabled.@Nullable @Nullable ChunkGenerator getGenerator()
void save()
@NotNull @NotNull List<BlockPopulator> getPopulators()
BlockPopulator
s for this World@NotNull <T extends Entity> T spawn(@NotNull @NotNull Location location, @NotNull @NotNull Class<T> clazz) throws IllegalArgumentException
Location
T
- the class of the Entity
to spawnlocation
- the Location
to spawn the entity atclazz
- the class of the Entity
to spawnEntity
IllegalArgumentException
- if either parameter is null or the
Entity
requested cannot be spawned@NotNull default <T extends Entity> T spawn(@NotNull @NotNull Location location, @NotNull @NotNull Class<T> clazz, @NotNull CreatureSpawnEvent.SpawnReason reason) throws IllegalArgumentException
IllegalArgumentException
@NotNull default <T extends Entity> T spawn(@NotNull @NotNull Location location, @NotNull @NotNull Class<T> clazz, @Nullable @Nullable Consumer<T> function) throws IllegalArgumentException
Location
, with
the supplied function run before the entity is added to the world.
T
- the class of the Entity
to spawnlocation
- the Location
to spawn the entity atclazz
- the class of the Entity
to spawnfunction
- the function to be run before the entity is spawned.Entity
IllegalArgumentException
- if either parameter is null or the
Entity
requested cannot be spawned@NotNull default <T extends Entity> T spawn(@NotNull @NotNull Location location, @NotNull @NotNull Class<T> clazz, @NotNull CreatureSpawnEvent.SpawnReason reason, @Nullable @Nullable Consumer<T> function) throws IllegalArgumentException
IllegalArgumentException
@NotNull default @NotNull Entity spawnEntity(@NotNull @NotNull Location loc, @NotNull @NotNull EntityType type, @NotNull CreatureSpawnEvent.SpawnReason reason)
@NotNull default @NotNull Entity spawnEntity(@NotNull @NotNull Location loc, @NotNull @NotNull EntityType type, @NotNull CreatureSpawnEvent.SpawnReason reason, @Nullable @Nullable Consumer<Entity> function)
@NotNull <T extends Entity> T spawn(@NotNull @NotNull Location location, @NotNull @NotNull Class<T> clazz, @Nullable @Nullable Consumer<T> function, @NotNull CreatureSpawnEvent.SpawnReason reason) throws IllegalArgumentException
IllegalArgumentException
@NotNull @NotNull FallingBlock spawnFallingBlock(@NotNull @NotNull Location location, @NotNull @NotNull MaterialData data) throws IllegalArgumentException
FallingBlock
entity at the given Location
of
the specified Material
. The material dictates what is falling.
When the FallingBlock hits the ground, it will place that block.
The Material must be a block type, check with material.isBlock()
. The Material may not be air.
location
- The Location
to spawn the FallingBlockdata
- The block dataFallingBlock
instanceIllegalArgumentException
- if Location
or MaterialData
are null or Material
of the MaterialData
is not a block@NotNull @NotNull FallingBlock spawnFallingBlock(@NotNull @NotNull Location location, @NotNull @NotNull BlockData data) throws IllegalArgumentException
FallingBlock
entity at the given Location
of
the specified Material
. The material dictates what is falling.
When the FallingBlock hits the ground, it will place that block.
The Material must be a block type, check with material.isBlock()
. The Material may not be air.
location
- The Location
to spawn the FallingBlockdata
- The block dataFallingBlock
instanceIllegalArgumentException
- if Location
or BlockData
are null@Deprecated @NotNull @NotNull FallingBlock spawnFallingBlock(@NotNull @NotNull Location location, @NotNull @NotNull Material material, byte data) throws IllegalArgumentException
FallingBlock
entity at the given Location
of the
specified Material
. The material dictates what is falling.
When the FallingBlock hits the ground, it will place that block.
The Material must be a block type, check with material.isBlock()
. The Material may not be air.
location
- The Location
to spawn the FallingBlockmaterial
- The block Material
typedata
- The block dataFallingBlock
instanceIllegalArgumentException
- if Location
or Material
are null or Material
is not a blockvoid playEffect(@NotNull @NotNull Location location, @NotNull @NotNull Effect effect, int data)
void playEffect(@NotNull @NotNull Location location, @NotNull @NotNull Effect effect, int data, int radius)
<T> void playEffect(@NotNull @NotNull Location location, @NotNull @NotNull Effect effect, @Nullable T data)
<T> void playEffect(@NotNull @NotNull Location location, @NotNull @NotNull Effect effect, @Nullable T data, int radius)
@NotNull @NotNull ChunkSnapshot getEmptyChunkSnapshot(int x, int z, boolean includeBiome, boolean includeBiomeTemp)
x
- - chunk x coordinatez
- - chunk z coordinateincludeBiome
- - if true, snapshot includes per-coordinate biome
typeincludeBiomeTemp
- - if true, snapshot includes per-coordinate
raw biome temperaturevoid setSpawnFlags(boolean allowMonsters, boolean allowAnimals)
allowMonsters
- - if true, monsters are allowed to spawn in this
world.allowAnimals
- - if true, animals are allowed to spawn in this
world.boolean getAllowAnimals()
boolean getAllowMonsters()
@NotNull @Deprecated @NotNull Biome getBiome(int x, int z)
x
- X coordinate of the blockz
- Z coordinate of the block@NotNull @NotNull Biome getBiome(int x, int y, int z)
x
- X coordinate of the blocky
- Y coordinate of the blockz
- Z coordinate of the block@Deprecated void setBiome(int x, int z, @NotNull @NotNull Biome bio)
x
- X coordinate of the blockz
- Z coordinate of the blockbio
- new Biome type for this blockvoid setBiome(int x, int y, int z, @NotNull @NotNull Biome bio)
x
- X coordinate of the blocky
- Y coordinate of the blockz
- Z coordinate of the blockbio
- new Biome type for this block@Deprecated double getTemperature(int x, int z)
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 blockz
- Z coordinate of the blockdouble getTemperature(int x, int y, int z)
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@Deprecated double getHumidity(int x, int z)
It is safe to run this method when the block does not exist, it will not create the block.
x
- X coordinate of the blockz
- Z coordinate of the blockdouble getHumidity(int x, int y, int z)
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 blockint getMinHeight()
If the min height is 0, there are only blocks from y=0.
int getMaxHeight()
If the max height is 100, there are only blocks from y=0 to y=99.
int getSeaLevel()
This is often half of getMaxHeight()
boolean getKeepSpawnInMemory()
void setKeepSpawnInMemory(boolean keepLoaded)
keepLoaded
- if true then the world's spawn area will be kept
loaded into memory.boolean isAutoSave()
void setAutoSave(boolean value)
value
- true if the world should automatically save, otherwise
falsevoid setDifficulty(@NotNull @NotNull Difficulty difficulty)
difficulty
- the new difficulty you want to set the world to@NotNull @NotNull Difficulty getDifficulty()
@NotNull @NotNull File getWorldFolder()
@Nullable @Deprecated @Nullable WorldType getWorldType()
boolean canGenerateStructures()
boolean isHardcore()
void setHardcore(boolean hardcore)
hardcore
- Whether the world is hardcorelong getTicksPerAnimalSpawns()
This value determines how many ticks there are between attempts to spawn animals.
Example Usage:
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.
void setTicksPerAnimalSpawns(int ticksPerAnimalSpawns)
This value determines how many ticks there are between attempts to spawn animals.
Example Usage:
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
- the ticks per animal spawns value you want
to set the world tolong getTicksPerMonsterSpawns()
This value determines how many ticks there are between attempts to spawn monsters.
Example Usage:
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.
void setTicksPerMonsterSpawns(int ticksPerMonsterSpawns)
This value determines how many ticks there are between attempts to spawn monsters.
Example Usage:
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
- the ticks per monster spawns value you
want to set the world tolong getTicksPerWaterSpawns()
This value determines how many ticks there are between attempts to spawn water mobs.
Example Usage:
Note: If set to 0, water mobs spawning will be disabled for this world.
Minecraft default: 1.
void setTicksPerWaterSpawns(int ticksPerWaterSpawns)
This value determines how many ticks there are between attempts to spawn water mobs.
Example Usage:
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 tolong getTicksPerWaterAmbientSpawns()
Example Usage:
Note: If set to 0, ambient mobs spawning will be disabled.
Minecraft default: 1.
void setTicksPerWaterAmbientSpawns(int ticksPerAmbientSpawns)
This value determines how many ticks there are between attempts to spawn water ambient mobs.
Example Usage:
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 tolong getTicksPerAmbientSpawns()
This value determines how many ticks there are between attempts to spawn ambient mobs.
Example Usage:
Note: If set to 0, ambient mobs spawning will be disabled for this world.
Minecraft default: 1.
void setTicksPerAmbientSpawns(int ticksPerAmbientSpawns)
This value determines how many ticks there are between attempts to spawn ambient mobs.
Example Usage:
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 toint getMonsterSpawnLimit()
void setMonsterSpawnLimit(int limit)
Note: If set to a negative number the world will use the server-wide spawn limit instead.
limit
- the new mob limitint getAnimalSpawnLimit()
void setAnimalSpawnLimit(int limit)
Note: If set to a negative number the world will use the server-wide spawn limit instead.
limit
- the new mob limitint getWaterAnimalSpawnLimit()
void setWaterAnimalSpawnLimit(int limit)
Note: If set to a negative number the world will use the server-wide spawn limit instead.
limit
- the new mob limitint getWaterAmbientSpawnLimit()
void setWaterAmbientSpawnLimit(int limit)
Note: If set to a negative number the world will use the server-wide spawn limit instead.
limit
- the new mob limitint getAmbientSpawnLimit()
void setAmbientSpawnLimit(int limit)
Note: If set to a negative number the world will use the server-wide spawn limit instead.
limit
- the new mob limitvoid playSound(@NotNull @NotNull Location location, @NotNull @NotNull Sound sound, float volume, float pitch)
This function will fail silently if Location or Sound are null.
location
- The location to play the soundsound
- The sound to playvolume
- The volume of the soundpitch
- The pitch of the soundvoid playSound(@NotNull @NotNull Location location, @NotNull @NotNull String sound, float volume, float pitch)
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 soundvoid playSound(@NotNull @NotNull Location location, @NotNull @NotNull Sound sound, @NotNull @NotNull SoundCategory category, float volume, float pitch)
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 soundvoid playSound(@NotNull @NotNull Location location, @NotNull @NotNull String sound, @NotNull @NotNull SoundCategory category, float volume, float pitch)
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@NotNull @NotNull String[] getGameRules()
GameRule
s.GameRule
names.@Deprecated @Contract(value="null -> null; !null -> !null") @Nullable @Nullable String getGameRuleValue(@Nullable @Nullable String rule)
getGameRuleValue(GameRule)
insteadWill return null if rule passed is null
rule
- Rule to look up value of@Deprecated boolean setGameRuleValue(@NotNull @NotNull String rule, @NotNull @NotNull String value)
setGameRule(GameRule, Object)
instead.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
- Rule to setvalue
- Value to set rule toboolean isGameRule(@NotNull @NotNull String rule)
rule
- Rule to check@Nullable <T> T getGameRuleValue(@NotNull @NotNull GameRule<T> rule)
GameRule
.T
- the GameRule's typerule
- the GameRule to check@Nullable <T> T getGameRuleDefault(@NotNull @NotNull GameRule<T> rule)
GameRule
. This value is not
guaranteed to match the current value.T
- the type of GameRulerule
- the rule to return a default value for<T> boolean setGameRule(@NotNull @NotNull GameRule<T> rule, @NotNull T newValue)
GameRule
's new value.T
- the value type of the GameRulerule
- the GameRule to updatenewValue
- the new value@NotNull @NotNull WorldBorder getWorldBorder()
void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count)
particle
- the particle to spawnlocation
- the location to spawn atcount
- the number of particlesvoid spawnParticle(@NotNull @NotNull Particle particle, double x, double y, double z, int count)
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<T> void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count, @Nullable T data)
T
- type of particle data (see Particle.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 on Particle.getDataType()
<T> void spawnParticle(@NotNull @NotNull Particle particle, double x, double y, double z, int count, @Nullable T data)
T
- type of particle data (see Particle.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 on Particle.getDataType()
void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ)
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 axisvoid spawnParticle(@NotNull @NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ)
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<T> void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, @Nullable T data)
T
- type of particle data (see Particle.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 on Particle.getDataType()
<T> void spawnParticle(@NotNull @NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, @Nullable T data)
T
- type of particle data (see Particle.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 on Particle.getDataType()
void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, double extra)
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)void spawnParticle(@NotNull @NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra)
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)<T> void spawnParticle(@NotNull @NotNull Particle particle, @NotNull @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data)
T
- type of particle data (see Particle.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 on Particle.getDataType()
default <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)
T
- type of particle data (see Particle.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 on Particle.getDataType()
default <T> void spawnParticle(@NotNull @NotNull Particle particle, @Nullable @Nullable List<Player> receivers, @NotNull @NotNull Player source, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data)
T
- Typeparticle
- the particle to spawnreceivers
- List of players to receive the particles, or null for all in worldsource
- Source of the particles to be used in visibility checks, or null if no player sourcex
- 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 on Particle.getDataType()
<T> void spawnParticle(@NotNull @NotNull Particle particle, @Nullable @Nullable List<Player> receivers, @Nullable @Nullable Player source, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data, boolean force)
T
- Typeparticle
- the particle to spawnreceivers
- List of players to receive the particles, or null for all in worldsource
- Source of the particles to be used in visibility checks, or null if no player sourcex
- 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 on Particle.getDataType()
force
- allows the particle to be seen further away from the player
and shows to players using any vanilla client particle settings<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)
T
- type of particle data (see Particle.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 on Particle.getDataType()
force
- whether to send the particle to players within an extended
range and encourage their client to render it regardless of
settings<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)
T
- type of particle data (see Particle.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 on Particle.getDataType()
force
- whether to send the particle to players within an extended
range and encourage their client to render it regardless of
settings@Nullable @Nullable Location locateNearestStructure(@NotNull @NotNull Location origin, @NotNull @NotNull StructureType structureType, int radius, boolean findUnexplored)
StructureType
.
Finding unexplored structures can, and will, block if the world is
looking in chunks that gave not generated yet. This can lead to the world
temporarily freezing while locating an unexplored structure.
The radius
is not a rigid square radius. Each structure may alter
how many chunks to check for each iteration. Do not assume that only a
radius x radius chunk area will be checked. For example,
StructureType.WOODLAND_MANSION
can potentially check up to 20,000
blocks away (or more) regardless of the radius used.
This will not load or generate chunks. This can also lead to instances where the server can hang if you are only looking for unexplored structures. This is because it will keep looking further and further out in order to find the structure.
origin
- where to start looking for a structurestructureType
- the type of structure to findradius
- the radius, in chunks, around which to searchfindUnexplored
- true to only find unexplored structuresLocation
, or null if no structure of the
specified type exists.@Nullable @Nullable Location locateNearestBiome(@NotNull @NotNull Location origin, @NotNull @NotNull Biome biome, int radius)
8
.origin
- Origin locationbiome
- Biome to findradius
- radius to search@Nullable @Nullable Location locateNearestBiome(@NotNull @NotNull Location origin, @NotNull @NotNull Biome biome, int radius, int step)
origin
- Origin locationbiome
- Biome to findradius
- radius to searchstep
- Search step 1 would mean checking every block, 8 would be every 8th blockboolean isUltrawarm()
boolean isNatural()
If false
, compasses will spin randomly in the world.
If true
, nether portals will spawn zombified piglins.
double getCoordinateScale()
boolean hasSkylight()
boolean hasBedrockCeiling()
boolean isPiglinSafe()
boolean doesBedWork()
boolean doesRespawnAnchorWork()
boolean hasRaids()
boolean isFixedTime()
@NotNull @NotNull Collection<Material> getInfiniburn()
int getViewDistance()
void setViewDistance(int viewDistance)
viewDistance
- view distance in [2, 32]int getNoTickViewDistance()
No-tick view distance is the view distance where chunks will load, however the chunks and their entities will not be set to tick.
void setNoTickViewDistance(int viewDistance)
No-tick view distance is the view distance where chunks will load, however the chunks and their entities will not be set to tick.
viewDistance
- view distance in [2, 32]@NotNull @NotNull World.Spigot spigot()
@Nullable @Nullable Raid locateNearestRaid(@NotNull @NotNull Location location, int radius)
location
- the origin locationradius
- the radiusRaid
, or null if no raids were found@NotNull @NotNull List<Raid> getRaids()
@Nullable @Nullable DragonBattle getEnderDragonBattle()
DragonBattle
associated with this world.
If this world's environment is not World.Environment.THE_END
, null will
be returned.
If an end world, a dragon battle instance will be returned regardless of whether or not a dragon is present in the world or a fight sequence has been activated. The dragon battle instance acts as a state holder.
Copyright © 2021. All rights reserved.