Go: Custom dimensions¶
Functions¶
AddGeneratedDimension¶
| Go | |
|---|---|
AddGeneratedDimension registers a dimension whose terrain fill writes, and returns its id.
fill runs on the host's chunk worker threads, several at once: it must be safe to run concurrently, give the same answer for the same chunk forever, and call nothing on this package but the request itself. Returning false leaves the chunk to air. materials[0] must be "minecraft:air". The function is kept for the dimension's whole life.
- Parameters:
- name :
string - spec :
string - materials :
[]string - biomes :
[]string - fill :
func(*ChunkRequest) bool
- name :
- Return type:
(int32, error) - Slots:
md_add_dimension_generated
DimensionsAvailable¶
| Go | |
|---|---|
DimensionsAvailable reports whether this host can register custom dimensions.
- Return type:
(bool, error) - Slots:
md_is_available
AddDimension¶
| Go | |
|---|---|
AddDimension registers a dimension from spec SNBT and returns its id.
- Parameters:
- name :
string - spec :
string
- name :
- Return type:
(int32, error) - Slots:
md_add_dimension
DimensionID¶
| Go | |
|---|---|
DimensionID is the id of a registered dimension.
- Parameters:
- name :
string
- name :
- Return type:
(int32, error) - Slots:
md_get_dimension_id
ListDimensions¶
| Go | |
|---|---|
ListDimensions lists the registered custom dimensions.
- Return type:
([]string, error) - Slots:
md_list_dimensions
SetDimensionRule¶
| Go | |
|---|---|
SetDimensionRule sets one rule, a PIER_DIMRULE_* value, for one dimension.
- Parameters:
- dim :
int32 - rule :
int32 - allow :
bool
- dim :
- Return type:
error - Slots:
md_set_dimension_rule
DimensionRule¶
| Go | |
|---|---|
DimensionRule reads one rule; set is false when the dimension follows vanilla for it, which a host older than the rule also answers.
- Parameters:
- dim :
int32 - rule :
int32
- dim :
- Return type:
(allow, set bool, err error) - Slots:
md_get_dimension_rule
ExistingDimensions¶
| Go | |
|---|---|
ExistingDimensions lists every registered custom dimension.
- Return type:
([]ExistingDimension, error) - Slots:
md_list_dimensions
AddDimensionPack¶
| Go | |
|---|---|
AddDimensionPack adds a custom dimension whose terrain is a terrain pack: a directory with a config file and a binary built by tools/pier-pack. configPath is relative to the server root, with forward slashes, no .. and not absolute. A refusal is a *PackError.
- Parameters:
- name :
string - configPath :
string - specSNBT :
string
- name :
- Return type:
(int32, error) - Slots:
md_add_dimension_pack
InspectPack¶
| Go | |
|---|---|
InspectPack reads what a terrain pack asks for, as a JSON document, without registering anything. A refusal is a *PackError.
- Parameters:
- configPath :
string
- configPath :
- Return type:
(string, error) - Slots:
md_pack_inspect
RetireDimension¶
| Go | |
|---|---|
RetireDimension retires a custom dimension: it is dropped from the host's tables and from dimension_config.json, so nothing registers it on the next boot. The chunks it wrote stay. It reports whether one by that name was registered.
- Parameters:
- name :
string
- name :
- Return type:
(bool, error) - Slots:
md_retire_dimension
ClearDimensionRules¶
| Go | |
|---|---|
ClearDimensionRules clears every rule of a dimension, for when its world was deleted.
- Parameters:
- dim :
int32
- dim :
- Return type:
error - Slots:
md_clear_dimension_rules
SetDimensionCells¶
| Go | |
|---|---|
SetDimensionCells gives a generated dimension the cell geometry its confinement rules use: cell is the edge of a cell and gap the space between cells, both in blocks. A cell of 0 removes the geometry.
- Parameters:
- dimID :
int32 - cell :
int32 - gap :
int32
- dimID :
- Return type:
error - Slots:
md_set_dimension_cells
NewPlotMerge¶
| Go | |
|---|---|
NewPlotMerge assembles a mask from the four directions in the order north, east, south, west.
- Parameters:
- x :
int32 - z :
int32 - north :
bool - east :
bool - south :
bool - west :
bool
- x :
- Return type:
PlotMerge
SetPlotMerges¶
| Go | |
|---|---|
SetPlotMerges replaces the merge marks of a dimension as a whole. Only plots that carry a marker need to be listed.
- Parameters:
- dim :
int32 - merges :
[]PlotMerge
- dim :
- Return type:
error - Slots:
md_set_plot_merges
PackError¶
PackError is the refusal of a terrain pack: the PIER_PACK_* status the host gave and, when it wrote one, its reasons.
PackError.Error¶
| Go | |
|---|---|
- Return type:
string
ChunkRequest¶
| Go | |
|---|---|
ChunkRequest is one chunk a supplied-terrain generator fills. Materials has 256*Height entries indexed (x*16+z)*Height + (y-MinY), and Biomes 256, one per column; both hold indices into the palettes given at registration, and material 0 is air.
ExistingDimension¶
| Go | |
|---|---|
ExistingDimension is one custom dimension that has been registered.
PlotMerge¶
| Go | |
|---|---|
PlotMerge holds the merge marks of one plot.