HSA: Read and write HardcodedSpawnArea (HSA) data

HSAR Documentation

Read and write HardcodedSpawnArea (HSA) data

Description

HardcodedSpawnArea (HSA) data (tag 57) stores information about any structure spawning locations in a chunk. An HSA is defined by a bounding box that specifies the location of an HSA in a chunk and a tag that specifies the type: 1 = NetherFortress, 2 = SwampHut, 3 = OceanMonument, and 5 = PillagerOutpost.

get_hsa_data() loads HardcodedSpawnArea data from a bedrockdb. It will silently drop and keys not representing HSA data. get_hsa_values() is a synonym for get_hsa_data().

get_hsa_value() loads HSA data from a bedrockdb. It only supports loading a single value.

read_hsa_value() decodes HSA data.

put_hsa_data() puts HSA data into a bedrockdb. HSA bounding boxes will be split across chunks and

put_hsa_values() and put_hsa_value() store HSA data into a bedrockdb.

write_hsa_value() encodes HSA data.

Usage

get_hsa_data(db, x, z, dimension)

get_hsa_values(db, x, z, dimension)

get_hsa_value(db, x, z, dimension)

read_hsa_value(rawdata)

put_hsa_data(db, data, merge = TRUE)

put_hsa_values(db, x, z, dimension, values)

put_hsa_value(db, x, z, dimension, value)

write_hsa_value(value)

Arguments

db

A bedrockdb object.

x, z, dimension

Chunk coordinates to extract data from. x can also be a character vector of db keys.

rawdata

A scalar raw.

data

A table containing HSA coordinates.

merge

Merge the new HSAs with existing HSAs.

values

A list of tables containing HSA coordinates and tags.

value

A table containing HSA coordinates

Value

get_hsa_data() returns a table in the same format as get_hsa_value().

get_hsa_value() and read_hsa_value() return a table with columns indicating the coordinates of the HSA bounding box and the location of the HSS at the center of the bounding box. get_hsa_value() also records the dimension of the bounding box.

Examples

dbpath <- rbedrock_example_world("example1.mcworld")
db <- bedrockdb(dbpath)
# view all HSA in a world
hsa <- get_hsa_data(db, get_keys(db))
hsa
# add an HSA to a world
dat <- data.frame(x1 = 0, x2 = 15, z1 = 0, z2 = 15,
                  y1 = 40, y2 = 60, tag = "SwampHut")
put_hsa_data(db, dat, merge = TRUE)
close(db)

rbedrock documentation built on Oct. 7, 2023, 1:07 a.m.