Data2D {rbedrock} | R Documentation |
Read and write Data2D data
Description
Data2D data (tag 45) stores information about surface heights and biomes in a chunk. Data2D data is 768 bytes long and consists of a 256 int16s (heights) followed by 256 uint8s (biomes).
get_data2d_data()
loads Data2D data from a bedrockdb
.
It will silently drop and keys not representing Data2D data.
get_data2d_value()
loads Data2D data from a bedrockdb
.
It only supports loading a single value.
read_data2d_value
decodes binary Data2D data.
put_data2d_data()
, put_data2d_values()
, and
put_data2d_value()
store Data2D data into a bedrockdb
.
write_data2d_value
encodes Data2D data into a raw vector.
Usage
get_data2d_data(db, x, z, dimension)
get_data2d_values(db, x, z, dimension)
get_data2d_value(db, x, z, dimension)
read_data2d_value(rawdata)
put_data2d_data(db, data)
put_data2d_values(db, x, z, dimension, height_maps, biome_maps)
put_data2d_value(db, x, z, dimension, height_map, biome_map)
write_data2d_value(height_map, biome_map)
Arguments
db |
A bedrockdb object. |
x , z , dimension |
Chunk coordinates to extract data from.
|
rawdata |
A raw vector. |
data |
A named-vector of key-value pairs for Data2D data. |
height_maps , biome_maps |
Lists of height and biome data.
Values will be recycled if necessary to match the number of keys
to be written to. If |
height_map , biome_map |
16x16 arrays containing height and biome data.
Values will be recycled if necessary. If |
Value
get_data2d_data()
returns a list of the of the values returned by
get_data2d_value()
.
get_data2d_value()
returns a list with components "height_map"
and "biome_map".
Examples
heights <- matrix(63,16,16)
biomes <- matrix(1,16,16)
# Pass heights and biomes as separate parameters
dat <- write_data2d_value(heights, biomes)
# Pass them as a list.
obj <- list(height_map = heights, biome_map = biomes)
dat <- write_data2d_value(obj)
# Pass them as scalars
dat <- write_data2d_value(63, 1)