Style Reference¶
TL;DR
styles/<name>.json is not a visual theme. It is a random palette picker. Each slot rolls one palette from a weighted list, and the mod merges every rolled palette. code review
Keys¶
| Key code review | Required | Meaning |
|---|---|---|
randompalettes |
yes | A list of lists. Each inner list is one slot, and every slot rolls independently |
Each entry inside a slot takes two keys, both required: code review
| Key | Required | Meaning code review |
|---|---|---|
palette |
yes | The name of a Palette. Resolved with getOrThrow, so a wrong namespace throws rather than falling through to another choice |
factor |
yes | The weight of this choice within its slot. Weights are relative to the others in the same slot, not to 1.0 |
Example: two independent slots¶
{
"randompalettes": [
[
{ "factor": 1.0, "palette": "bricks_standard" },
{ "factor": 1.0, "palette": "bricks_gray" }
],
[
{ "factor": 3.0, "palette": "glass_pane" },
{ "factor": 1.0, "palette": "glass_full" }
]
]
}
The two slots roll independently and the results are merged. The wall slot picks bricks_standard or bricks_gray with equal probability, and the glass slot picks glass_pane three times as often as glass_full. code review
Every palette named here goes through getOrThrow, so a name in the wrong namespace throws rather than falling through to the next choice. code review
Two styles are in play, and which one applies depends on the chunk¶
A Style is named in two different places, and a world uses both at once: game test
| Named by | Key | Applies to game test |
|---|---|---|
| City Style | style |
Chunks that are city chunks |
| World Style | outsidestyle |
Every chunk that is not |
A chunk compiles its palette from one or the other, never from both, so a character defined in only one of them resolves in half the world and is undefined in the rest. game test
A city sphere's shell is drawn on non-city chunks
Which makes it the case that catches people out. The shell character comes from
the city style, and it is placed on chunks that resolve against the outside
style. Define it only in the city style's style and the lookup returns null,
and the sphere feature has no null check: the server goes down with a bare
NullPointerException during feature placement, naming no file, no part and no
character. game test
A pack that uses its own characters anywhere outside a building wants the same palette layered into both styles. game test
When the roll happens¶
Every slot rolls once per chunk, from a random source seeded by the chunk coordinate, so the same chunk in the same world always lands on the same palette. code review
A normal building occupies one chunk, which makes that the same as once per building. Two neighbouring buildings under one city style do not have to match, which is where a city gets its variety without anyone authoring every combination. code review
A multi-building rolls once per chunk, not once per structure
Each chunk of a Multi-Building rolls its palette on its own, so the quarters of a large structure can land on different palettes. code review
A multi-chunk structure that has to be uniform needs its parts to carry a refpalette, which takes precedence over the style's palettes. See Collisions and merge order. game test
See also¶
- The Content Model
- Palette Reference for what a resolved palette contains
- City Style Reference and World Style Reference, the two assets that point at a Style