Skip to content

Skygrid Configuration Files

Niklas Widmann edited this page Jul 28, 2022 · 6 revisions

Every dimension can be configured to generate a skygrid. There are several default configurations, including the vanilla dimensions.

Additional or modified configurations can be included using Datapacks.

For example the configuration for the dimension somemod:thedimensions would be placed at data/somemod/skygrid/dimensions/thedimension.xml

XML Syntax

These config files are XML files with the <dimension> element as a root tag. The value of the property replace defines, how duplicate config files with this ID will be handled. If false, they will be merged, if true, the last one replaces the previous, similar to JSON Format of tag files.

The <blocks> element contains a list of Block Providers to be generated. The <loot> element contains a list loot tables that are generated in chests & other containers. The <mobs> element contains a list of mobs that will be placed in generated spawners.

All of the above's children elements have the weight attribute, which defaults to 1.0. This value is a decimal point number defining the probability. An element with a weight of 3.0 is 2 times more likely to occur than one with a weight of 1.5.

<dimension replace="false" >
   <blocks>
      <block id="stone" />
      <!-- More block providers -->
   </blocks>
   <loot>
      <table id="chests/spawn_bonus_chest" weight="2.0" />
      <!-- More loot tables -->
   </loot>
   <mobs>
      <mob id="minecraft:creeper" />
      <mob id="ghast" weight="0.1" />
      <!-- More mobs -->
   </mobs>
</dimension>

Block Providers

There are multiple block providers which can be used to define what kind of blocks should be generated.

Block

The <block> element defines a single block, including the id and mod (default: "minecraft")

<block id="iron_ore" mod="minecraft" weight="1.0" />

Tag

The <tag> element defines a block tag, including the id and mod (default: "minecraft")

<tag id="#logs" mod="minecraft" weight="1.0" random="true" />

The random property (default: "true") defines wether the provider should use all blocks defined for the tag, or only the first one found ("false").

The following usages are therefor equal:

<fallback weight="2.0">
   <tag id="logs" random="true">
</fallback>
<!-- or -->
<tag id="#logs" weight="2.0" random="false">

A tag can also include any amount of filters using the <except> element. They can be filtered by a specific mod, a pattern in their ID or another tag.

<tag id="saplings">
   <except>
      <name pattern="nether_" />
      <mod id="endergetic" />
      <tag id="other_tag" mod="some_mod" />
   </except>
</tag>

List

The <list> element can contain multiple block providers and group them.

Lists provide a way to structure your blocks and can be nested indefinitely.

<list name="very good stuff" weight="3.0">
   <block id="diamond_block" />
   <block id="netherite_block" weight="0.1" />
   <block id="clay" weight="0.0001" />
   <reference id="other_good_stuff" weight="2.0" />
</list>

In this example, the resulting real weight of a netherite block would be 3.0 * 0.1.

Fallback

Fallbacks are similar to lists, but only use the first valid block provider.

<fallback name="ender watcher" weight="3.0">
   <block id="non_existent_block" />
   <block mod="quark" id="ender_watcher" />
   <block mod="botania" id="ender_eye_block" />
</list>

The above example will only generate the Ender Watcher block from quark, if quark is present. If only Botania is installed, it will instead generate the Ender Overseer from Botania.

Reference

The <reference> element is a link to a Preset file. Presets can be used to extract a block provider into a seperate file. This way, if a more complex block provider is used mulitple times or in multiple config files, it only needs to be defined once.

<reference mod="my_namespace" id="flowers" weight="2.0" />
<!-- links to `data/my_namespace/skygrid/presets/flowers.xml` -->

Extras

Any kind of block provider can also contain any amount of extras. Extras generate an additional block somewhere around to the provider.

There are two types of extras, the <offset> and the <side>. All use cases of sides could also be done with offsets.

  • The <side> requires an on property which can be one of up, down, north, east, south or west and an optional offset (default: "1") defining the distance from the base block.

  • The <cardinal> uses of the cardinal directions (north, east, south, west) at random to place a block on. Otherwise, it acts like the <side>. It also rotates the attached block relative to the direction it has choosen. This can be disabled by setting the rotate property to false

  • The <offset> can be given any of x, y and z as coordinate offsets.

Both accept the optional probability property (default: "1.0")

<block id="dirt">
   <offset y="1" probability="0.2">
      <block id="hanging_roots"/>
   </offset>
   <side on="up" offset="1" probability="0.5">
      <tag id="small_flowers" />
   </side>
</block>

Property Transformers

Similar to Extras, a block provider can also contain any amount of property transformers.

These are able to modify a blockstate's properties such as a log's axis or a carrots age. Any property transformers referencing properties the generated block does not have will simply be ignored.

There are two property transformers available.

  • The <set> sets the property to a specific value.
  • The <cycle> gives the state a random allowed value
<block id="wheat">
   <cycle key="age" />
   <set key="half" value="upper"> 
   <!-- 'half' will be ignored because wheat has no 'half' property -->
</block>

<tag id="logs">
   <set key="axis" value="y">
</tag>

Using the XSD Schema

When using a text editor that supports XML validation, like VS Code or IDEA you can include the schema in the header to get validation and type suggestions while editing.

<?xml version="1.0" encoding="UTF-8"
    xmlns="https://www.w3schools.com"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="https://www.w3schools.com https://raw.githubusercontent.com/PssbleTrngle/Skygrid/1.18.x/Common/src/main/resources/schema.xsd" ?>
Clone this wiki locally