SubchunkBlocks {rbedrock} | R Documentation |
Load and store SubchunkBlocks data
Description
SubchunkBlocks data (tag 47) holds information about the blocks in a subchunks. Each chunk is divided into multiple 16x16x16 subchunks, and each subchunk is stored separately and indicated by the use of the subtag. Blocks are stored in a palette-based format. Subchunks can have two layers of blocks, and the extra layer is most-often used to store water for water-logged blocks.
These functions return block data as strings containing the
block name and block states. The strings' format is
blockname@state1=value1@state2=value2
etc.
Blocks may have 0 or more states.
get_subchunk_blocks_data()
loads SubchunkBlocks data from a bedrockdb
.
It will silently drop and keys not representing SubchunkBlocks data.
get_subchunk_blocks_values()
is a synonym for get_subchunk_blocks_data()
.
get_subchunk_blocks_value()
loads SubchunkBlocks data from a bedrockdb
.
It only supports loading a single value.
get_subchunk_blocks_from_chunk()
loads SubchunkBlocks data from a
bedrockdb
. It supports efficiently loading subchunk block data from a
single chunk.
put_subchunk_blocks_data()
, put_subchunk_blocks_values()
, and
put_subchunk_blocks_value()
store SubchunkBlocks data into a bedrockdb
.
read_subchunk_blocks_value()
decodes binary SubchunkBlock data.
subchunk_origins()
returns a matrix containing the block coordinate of the
lower NW corner of subchunk keys
subchunk_coords()
determines the block coordinates of blocks based on their
array indexes and their subchunk origins.
Usage
get_subchunk_blocks_data(
db,
x,
z,
dimension,
subchunk,
names_only = FALSE,
extra_block = FALSE
)
get_subchunk_blocks_values(
db,
x,
z,
dimension,
subchunk,
names_only = FALSE,
extra_block = FALSE
)
get_subchunk_blocks_value(
db,
x,
z,
dimension,
subchunk,
names_only = FALSE,
extra_block = FALSE
)
get_subchunk_blocks_from_chunk(
db,
x,
z,
dimension,
names_only = FALSE,
extra_block = FALSE
)
put_subchunk_blocks_data(db, data, version = 9L)
put_subchunk_blocks_values(db, x, z, dimension, subchunk, values, version = 9L)
put_subchunk_blocks_value(db, x, z, dimension, subchunk, value, version = 9L)
read_subchunk_blocks_value(
rawdata,
missing_offset = NA,
names_only = FALSE,
extra_block = FALSE
)
write_subchunk_blocks_value(object, version = 9L, missing_offset = NA_integer_)
subchunk_origins(keys)
subchunk_coords(ind, origins = subchunk_origins(names(ind)))
Arguments
db |
A bedrockdb object. |
x , z , dimension |
Chunk coordinates to extract data from.
|
subchunk |
Subchunk indexes to extract data from. |
names_only |
A logical scalar. Return only the names of the blocks, ignoring block states. |
extra_block |
A logical scalar. Append the extra block layer to the output (separated by ";"). This is mostly useful if you have waterlogged blocks. If the extra block is air, it will not be appended. |
data |
A named list of 16x16x16 character() arrays |
version |
Which format of subchunk data to use |
values |
A list of 16x16x16 character() arrays |
value |
A 16x16x16 character array |
rawdata |
a raw vector holding binary SubchunkBlock data |
missing_offset |
subchunk offset to use if one is not found in |
object |
A 16x16x16 character array. |
keys |
A character vector of database keys. |
ind |
Numeric vector or a named list of numeric vectors containing indexes for blocks in a subchunk. |
origins |
A matrix of subchunk origins. |
Details
If a subchunk contains only air it will not be stored in the database, and missing subchunks are considered air.
Value
get_subchunk_blocks_data()
returns a list of the of the values
returned by read_subchunk_blocks_value()
.
get_subchunk_blocks_value()
and read_subchunk_blocks_value()
return a 16x16x16 character array. The axes represent the x
, y
, and z
dimensions in that order.
get_subchunk_blocks_from_chunk()
returns a list of the of the
values returned by read_subchunk_blocks_value()
.
read_subchunk_blocks_value()
returns a 16x16x16 character array.
The axes represent the x
, y
, and z
dimensions in that order.
subchunk_coords()
returns a 3-column matrix of block coordinates.