Package io.papermc.paper.world.generation

# Interface ProtoWorld

@Deprecated(forRemoval=true) public interface ProtoWorld
Deprecated, for removal: This API element is subject to removal in a future version.
see `RegionAccessor` and `LimitedRegion`
Represents a small grid of chunks in a `World` with rudimentary block and entity access, for use during world generation.

A ProtoWorld is guaranteed read/write access to a 3x3 grid of chunks, but may have access to a grid as large as 17x17. It is safest to assume that there is only read/write access to 3x3 chunks. Some chunks outside of the 3x3 area may be readable but not writable.

ProtoWorlds should not be stored! After they are used during chunk generation they should be disposed of.

See Also:
  - `BlockPopulator.populate(WorldInfo, Random, int, int, LimitedRegion)`

## Method Summary

Modifier and Type
Method
Description
`@NotNull BlockData`
`getBlockData(int x, int y, int z)`
Deprecated, for removal: This API element is subject to removal in a future version.
Get the `BlockData` of the block at the provided coordinates.
`default @NotNull BlockData`
`getBlockData(@NotNull Vector vector)`
Deprecated, for removal: This API element is subject to removal in a future version.
Get the `BlockData` of the block at the provided coordinates.
`@NotNull BlockState`
`getBlockState(int x, int y, int z)`
Deprecated, for removal: This API element is subject to removal in a future version.
Gets the `BlockState` at a location.
`default @NotNull BlockState`
`getBlockState(@NotNull Vector location)`
Deprecated, for removal: This API element is subject to removal in a future version.
Gets the `BlockState` at a location.
`default int`
`getCenterBlockX()`
Deprecated, for removal: This API element is subject to removal in a future version.
Get the X-coordinate of the block in the center of this `ProtoWorld`
`default int`
`getCenterBlockZ()`
Deprecated, for removal: This API element is subject to removal in a future version.
Get the Z-coordinate of the block in the center of this `ProtoWorld`
`int`
`getCenterChunkX()`
Deprecated, for removal: This API element is subject to removal in a future version.
Get the X-coordinate of the chunk in the center of this ProtoWorld
`int`
`getCenterChunkZ()`
Deprecated, for removal: This API element is subject to removal in a future version.
Get the Z-coordinate of the chunk in the center of this `ProtoWorld`
`@NotNull World`
`getWorld()`
Deprecated, for removal: This API element is subject to removal in a future version.
Get the `World` object this ProtoWorld represents.
`void`
`scheduleBlockUpdate(int x, int y, int z)`
Deprecated, for removal: This API element is subject to removal in a future version.
Schedule a block update at (x, y, z).
`default void`
`scheduleBlockUpdate(@NotNull Vector location)`
Deprecated, for removal: This API element is subject to removal in a future version.
Schedule a block update at a vector location
`void`
`scheduleFluidUpdate(int x, int y, int z)`
Deprecated, for removal: This API element is subject to removal in a future version.
Schedule a fluid update at (x, y, z).
`default void`
`scheduleFluidUpdate(@NotNull Vector location)`
Deprecated, for removal: This API element is subject to removal in a future version.
Schedule a fluid update at a vector location
`void`
`setBlockData(int x, int y, int z, @NotNull BlockData data)`
Deprecated, for removal: This API element is subject to removal in a future version.
Sets the block at (x, y, z) to the provided `BlockData`.
`default void`
`setBlockData(@NotNull Vector vector, @NotNull BlockData data)`
Deprecated, for removal: This API element is subject to removal in a future version.
Sets the block at a vector location to the provided `BlockData`.
`void`
`setBlockState(int x, int y, int z, @NotNull BlockState state)`
Deprecated, for removal: This API element is subject to removal in a future version.
Sets the `BlockState` at a location.
`default void`
`setBlockState(@NotNull Vector location, @NotNull BlockState state)`
Deprecated, for removal: This API element is subject to removal in a future version.
Sets the `BlockState` at a location.
`default <T extends Entity>
T`
`spawn(@NotNull Vector location, @NotNull Class<T> clazz)`
Deprecated, for removal: This API element is subject to removal in a future version.
Spawn an entity of a specific class at location represented by the given `Vector`
`default <T extends Entity>
T`
`spawn(@NotNull Vector location, @NotNull Class<T> clazz, @Nullable Consumer<T> function)`
Deprecated, for removal: This API element is subject to removal in a future version.
Spawn an entity of a specific class at the location represented by the given `Vector`, with the supplied function run before the entity is added to the world.
`<T extends Entity>
T`
`spawn(@NotNull Vector location, @NotNull Class<T> clazz, @Nullable Consumer<T> function, CreatureSpawnEvent.SpawnReason reason)`
Deprecated, for removal: This API element is subject to removal in a future version.
`default <T extends Entity>
T`
`spawn(@NotNull Vector location, @NotNull Class<T> clazz, CreatureSpawnEvent.SpawnReason reason)`
Deprecated, for removal: This API element is subject to removal in a future version.
Spawn an entity of a specific class at location represented by the given `Vector`
`default <T extends Entity>
T`
`spawn(@NotNull Vector location, @NotNull Class<T> clazz, CreatureSpawnEvent.SpawnReason reason, @Nullable Consumer<T> function)`
Deprecated, for removal: This API element is subject to removal in a future version.
Spawn an entity of a specific class at the location represented by the given `Vector`, with the supplied function run before the entity is added to the world.
`default @NotNull Entity`
`spawnEntity(@NotNull Vector loc, @NotNull EntityType type)`
Deprecated, for removal: This API element is subject to removal in a future version.
Creates an entity at the location represented by the given `Vector`
`default @NotNull Entity`
`spawnEntity(@NotNull Vector loc, @NotNull EntityType type, CreatureSpawnEvent.SpawnReason reason)`
Deprecated, for removal: This API element is subject to removal in a future version.
Creates an entity at the location represented by the given `Vector`
`default @NotNull Entity`
`spawnEntity(@NotNull Vector loc, @NotNull EntityType type, CreatureSpawnEvent.SpawnReason reason, @Nullable Consumer<Entity> function)`
Deprecated, for removal: This API element is subject to removal in a future version.
Creates an entity at the location represented by the given `Vector`, with the supplied function run before the entity is added to the world.

## Method Details

### setBlockData

void setBlockData(int x, int y, int z, @NotNull @NotNull BlockData data)
Deprecated, for removal: This API element is subject to removal in a future version.
Sets the block at (x, y, z) to the provided `BlockData`.

Parameters:
  `x` - X coordinate in this ProtoWorld
  `y` - Y coordinate in this ProtoWorld
  `z` - Z coordinate in this ProtoWorld
  `data` - `BlockData` to set the block at the provided coordinates to.

### setBlockData

default void setBlockData(@NotNull @NotNull Vector vector, @NotNull @NotNull BlockData data)
Deprecated, for removal: This API element is subject to removal in a future version.
Sets the block at a vector location to the provided `BlockData`.

Parameters:
  `vector` - `Vector` representing the position of the block to set.
  `data` - `BlockData` to set the block at the provided coordinates to.

### setBlockState

void setBlockState(int x, int y, int z, @NotNull @NotNull BlockState state)
Deprecated, for removal: This API element is subject to removal in a future version.
Sets the `BlockState` at a location.

Parameters:
  `x` - X coordinate.
  `y` - Y coordinate.
  `z` - Z coordinate.
  `state` - The block state.

### setBlockState

default void setBlockState(@NotNull @NotNull Vector location, @NotNull @NotNull BlockState state)
Deprecated, for removal: This API element is subject to removal in a future version.
Sets the `BlockState` at a location.

Parameters:
  `location` - Location to set block state.
  `state` - The block state.

### getBlockState

@NotNull @NotNull BlockState getBlockState(int x, int y, int z)
Deprecated, for removal: This API element is subject to removal in a future version.
Gets the `BlockState` at a location.

Parameters:
  `x` - X coordinate.
  `y` - Y coordinate.
  `z` - Z coordinate.
Returns:
  The block state.

### getBlockState

@NotNull default @NotNull BlockState getBlockState(@NotNull @NotNull Vector location)
Deprecated, for removal: This API element is subject to removal in a future version.
Gets the `BlockState` at a location.

Parameters:
  `location` - Location to get block state from.
Returns:
  The block state.

### scheduleBlockUpdate

void scheduleBlockUpdate(int x, int y, int z)
Deprecated, for removal: This API element is subject to removal in a future version.
Schedule a block update at (x, y, z).

Parameters:
  `x` - X coordinate in this ProtoWorld
  `y` - Y coordinate in this ProtoWorld
  `z` - Z coordinate in this ProtoWorld

### scheduleBlockUpdate

default void scheduleBlockUpdate(@NotNull @NotNull Vector location)
Deprecated, for removal: This API element is subject to removal in a future version.
Schedule a block update at a vector location

Parameters:
  `location` - `Vector` representing the position of the block to update.

### scheduleFluidUpdate

void scheduleFluidUpdate(int x, int y, int z)
Deprecated, for removal: This API element is subject to removal in a future version.
Schedule a fluid update at (x, y, z).

Parameters:
  `x` - X coordinate in this ProtoWorld
  `y` - Y coordinate in this ProtoWorld
  `z` - Z coordinate in this ProtoWorld

### scheduleFluidUpdate

default void scheduleFluidUpdate(@NotNull @NotNull Vector location)
Deprecated, for removal: This API element is subject to removal in a future version.
Schedule a fluid update at a vector location

Parameters:
  `location` - `Vector` representing the position of the block to update.

### getWorld

@NotNull @NotNull World getWorld()
Deprecated, for removal: This API element is subject to removal in a future version.
Get the `World` object this ProtoWorld represents.

Do not attempt to read from/write to this world! Doing so during generation will cause a deadlock!

Returns:
  The `World` object that this ProtoWorld represents.

### getBlockData

@NotNull @NotNull BlockData getBlockData(int x, int y, int z)
Deprecated, for removal: This API element is subject to removal in a future version.
Get the `BlockData` of the block at the provided coordinates.

Parameters:
  `x` - X coordinate in this ProtoWorld
  `y` - Y coordinate in this ProtoWorld
  `z` - Z coordinate in this ProtoWorld
Returns:
  `BlockData` at the coordinates

### getBlockData

@NotNull default @NotNull BlockData getBlockData(@NotNull @NotNull Vector vector)
Deprecated, for removal: This API element is subject to removal in a future version.
Get the `BlockData` of the block at the provided coordinates.

Parameters:
  `vector` - `Vector` representing the position of the block to get.
Returns:
  `BlockData` at the coordinates

### getCenterChunkX

int getCenterChunkX()
Deprecated, for removal: This API element is subject to removal in a future version.
Get the X-coordinate of the chunk in the center of this ProtoWorld

Returns:
  The center chunk's X coordinate.

### getCenterBlockX

default int getCenterBlockX()
Deprecated, for removal: This API element is subject to removal in a future version.
Get the X-coordinate of the block in the center of this `ProtoWorld`

Returns:
  The center chunk's X coordinate.

### getCenterChunkZ

int getCenterChunkZ()
Deprecated, for removal: This API element is subject to removal in a future version.
Get the Z-coordinate of the chunk in the center of this `ProtoWorld`

Returns:
  The center chunk's Z coordinate.

### getCenterBlockZ

default int getCenterBlockZ()
Deprecated, for removal: This API element is subject to removal in a future version.
Get the Z-coordinate of the block in the center of this `ProtoWorld`

Returns:
  The center chunk's Z coordinate.

### spawnEntity

@NotNull default @NotNull Entity spawnEntity(@NotNull @NotNull Vector loc, @NotNull @NotNull EntityType type)
Deprecated, for removal: This API element is subject to removal in a future version.
Creates an entity at the location represented by the given `Vector`

Parameters:
  `loc` - The `Vector` representing the location to spawn the entity
  `type` - The entity to spawn
Returns:
  Resulting Entity of this method

### spawn

@NotNull default <T extends Entity> T spawn(@NotNull @NotNull Vector location, @NotNull @NotNull Class<T> clazz) throws IllegalArgumentException
Deprecated, for removal: This API element is subject to removal in a future version.
Spawn an entity of a specific class at location represented by the given `Vector`

Type Parameters:
  `T` - The class of the `Entity` to spawn
Parameters:
  `location` - The `Vector` representing the location to spawn the entity at
  `clazz` - The class of the `Entity` to spawn
Returns:
  An instance of the spawned `Entity`
Throws:
  `IllegalArgumentException` - if either parameter is null or the `Entity` requested cannot be spawned

### spawn

@NotNull default <T extends Entity> T spawn(@NotNull @NotNull Vector location, @NotNull @NotNull Class<T> clazz, @NotNull CreatureSpawnEvent.SpawnReason reason) throws IllegalArgumentException
Deprecated, for removal: This API element is subject to removal in a future version.
Spawn an entity of a specific class at location represented by the given `Vector`

Type Parameters:
  `T` - The class of the `Entity` to spawn
Parameters:
  `location` - The `Vector` representing the location to spawn the entity at
  `clazz` - The class of the `Entity` to spawn
  `reason` - The reason for the entity's spawn.
Returns:
  An instance of the spawned `Entity`
Throws:
  `IllegalArgumentException` - if either parameter is null or the `Entity` requested cannot be spawned

### spawn

@NotNull default <T extends Entity> T spawn(@NotNull @NotNull Vector location, @NotNull @NotNull Class<T> clazz, @Nullable @Nullable Consumer<T> function) throws IllegalArgumentException
Deprecated, for removal: This API element is subject to removal in a future version.
Spawn an entity of a specific class at the location represented by the given `Vector`, with the supplied function run before the entity is added to the world.
Note that when the function is run, the entity will not be actually in the world. Any operation involving such as teleporting the entity is undefined until after this function returns.

Type Parameters:
  `T` - The class of the `Entity` to spawn
Parameters:
  `location` - The `Vector` representing the location to spawn the entity at
  `clazz` - The class of the `Entity` to spawn
  `function` - The function to be run before the entity is spawned.
Returns:
  An instance of the spawned `Entity`
Throws:
  `IllegalArgumentException` - if either parameter is null or the `Entity` requested cannot be spawned

### spawn

@NotNull default <T extends Entity> T spawn(@NotNull @NotNull Vector location, @NotNull @NotNull Class<T> clazz, @NotNull CreatureSpawnEvent.SpawnReason reason, @Nullable @Nullable Consumer<T> function) throws IllegalArgumentException
Deprecated, for removal: This API element is subject to removal in a future version.
Spawn an entity of a specific class at the location represented by the given `Vector`, with the supplied function run before the entity is added to the world.
Note that when the function is run, the entity will not be actually in the world. Any operation involving such as teleporting the entity is undefined until after this function returns.

Type Parameters:
  `T` - The class of the `Entity` to spawn
Parameters:
  `location` - The `Vector` representing the location to spawn the entity at
  `clazz` - The class of the `Entity` to spawn
  `reason` - The reason for the entity's spawn.
  `function` - The function to be run before the entity is spawned.
Returns:
  An instance of the spawned `Entity`
Throws:
  `IllegalArgumentException` - if either parameter is null or the `Entity` requested cannot be spawned

### spawnEntity

@NotNull default @NotNull Entity spawnEntity(@NotNull @NotNull Vector loc, @NotNull @NotNull EntityType type, @NotNull CreatureSpawnEvent.SpawnReason reason)
Deprecated, for removal: This API element is subject to removal in a future version.
Creates an entity at the location represented by the given `Vector`

Parameters:
  `loc` - The `Vector` representing the location to spawn the entity
  `type` - The entity to spawn
  `reason` - The reason for the entity's spawn.
Returns:
  Resulting Entity of this method

### spawnEntity

@NotNull default @NotNull Entity spawnEntity(@NotNull @NotNull Vector loc, @NotNull @NotNull EntityType type, @NotNull CreatureSpawnEvent.SpawnReason reason, @Nullable @Nullable Consumer<Entity> function)
Deprecated, for removal: This API element is subject to removal in a future version.
Creates an entity at the location represented by the given `Vector`, with the supplied function run before the entity is added to the world.
Note that when the function is run, the entity will not be actually in the world. Any operation involving such as teleporting the entity is undefined until after this function returns.

Parameters:
  `loc` - The `Vector` representing the location to spawn the entity
  `type` - The entity to spawn
  `reason` - The reason for the entity's spawn.
  `function` - The function to be run before the entity is spawned.
Returns:
  Resulting Entity of this method

### spawn

@NotNull <T extends Entity> T spawn(@NotNull @NotNull Vector location, @NotNull @NotNull Class<T> clazz, @Nullable @Nullable Consumer<T> function, @NotNull CreatureSpawnEvent.SpawnReason reason) throws IllegalArgumentException
Deprecated, for removal: This API element is subject to removal in a future version.

Throws:
  `IllegalArgumentException`