@ThreadSafe public interface World extends Cloneable
Worlds can be created using the following code:
WorldLoader loader = WorldLoader.newLoader();
// Set world settings
loader.createWorld("New world");
You can use your own generator using WorldLoader.newLoader(Class)
A collection of the worlds on the server can be obtained using Registered.worlds()
Modifier and Type | Method and Description |
---|---|
Block |
blockAt(Position position)
Gets the block on the given position
|
WorldBorder |
border()
Obtains the world border properties of this world
|
Chunk |
chunkAt(ChunkLocation loc,
boolean generateIfNotFound)
Gets the chunk on the given position, and generates the chunk if it does not exist.
|
Chunk |
chunkAt(int x,
int z,
boolean generateIfNotFound)
Gets the chunk on the given x and z , and generates the chunk if it does not exist
|
Collection<Chunk> |
chunks()
Obtains the loaded chunks in the world
|
Set<Entity> |
entities()
Get the entities currently in this world
|
Chunk |
generateChunk(ChunkLocation position)
Generates the chunk on the given position
|
Chunk |
generateChunk(int x,
int z)
Generates the chunk on the given position
|
ArrayList<Entity> |
getEntities(Entity exclude,
BoundingBox boundingBox,
java.util.function.Predicate<? super Entity> predicate)
Find all entities that are colliding with the bounding box
|
void |
lightning(Position location,
boolean isEffect)
Strikes lightning at the given location.
|
WorldLoader |
loader()
Obtains the loading handler which created this object, passed in from the constructor
|
String |
name()
Gets the name of the world
|
SoundEffect |
playSound(SoundEffectType sound)
Creates a new sound effect
|
void |
setTime(long time)
Sets the time of the world
|
WorldSettings |
settings()
Obtains the settings which modify the behavior of the world
|
Entity |
spawn(EntityType type,
Position spawnPosition)
Spawns an entity in the world
|
ParticleEffect |
spawnParticle(ParticleEffectType particle)
Creates a new particle effect
|
Position |
spawnPosition()
Gets the spawn position of the world
|
VisualEffect |
spawnVisual(VisualEffectType visual)
Creates a new visual effect
|
long |
time()
Gets the time in the world
|
WeatherConditions |
weather()
Obtains the weather controller for the world
|
Collection<Chunk> chunks()
Chunk chunkAt(ChunkLocation loc, boolean generateIfNotFound)
Chunk chunkAt(int x, int z, boolean generateIfNotFound)
Chunk generateChunk(int x, int z)
Chunk generateChunk(ChunkLocation position)
Block blockAt(Position position)
WorldLoader loader()
long time()
Position spawnPosition()
WeatherConditions weather()
WorldSettings settings()
WorldBorder border()
Entity spawn(EntityType type, Position spawnPosition)
type
- the type of entity to spawnSet<Entity> entities()
ArrayList<Entity> getEntities(Entity exclude, BoundingBox boundingBox, java.util.function.Predicate<? super Entity> predicate)
exclude
- the entity to exclude from searchingboundingBox
- The bounding box to search inpredicate
- Predicate to filter resultsParticleEffect spawnParticle(ParticleEffectType particle)
particle
- The particle to spawnVisualEffect spawnVisual(VisualEffectType visual)
visual
- The visual to spawnSoundEffect playSound(SoundEffectType sound)
sound
- The sound to playvoid lightning(Position location, boolean isEffect)
location
- the location that the lightning will hitisEffect
- determines if the lightning is just a effect or can cause damagevoid setTime(long time)
time
- the new time of the worldCopyright © 2016. All rights reserved.