2020-03-12 13:36:54 +01:00
|
|
|
# Lua API: Sky
|
|
|
|
|
|
|
|
## Example
|
|
|
|
|
|
|
|
```lua
|
|
|
|
mod:sky {
|
2020-03-12 13:48:11 +01:00
|
|
|
id = "sky_overworld", -- mandatory
|
2020-03-12 13:36:54 +01:00
|
|
|
|
|
|
|
color = {
|
|
|
|
day = {50, 153, 204},
|
|
|
|
},
|
|
|
|
|
|
|
|
fog_color = {
|
|
|
|
day = {50, 153, 204},
|
|
|
|
},
|
2020-07-17 05:47:48 +02:00
|
|
|
|
2020-07-17 06:05:12 +02:00
|
|
|
daylight_cycle = {
|
|
|
|
speed = 1.0
|
|
|
|
},
|
|
|
|
|
2020-07-17 05:47:48 +02:00
|
|
|
objects = {
|
|
|
|
sun = {
|
|
|
|
texture = "texture-sun",
|
|
|
|
size = 256,
|
|
|
|
},
|
|
|
|
|
|
|
|
moon = {
|
|
|
|
texture = "texture-moon_phases",
|
|
|
|
size = 256,
|
|
|
|
phases = {
|
|
|
|
count = 8,
|
|
|
|
size = 32
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
stars = {
|
|
|
|
count = 1000,
|
|
|
|
size = 4,
|
|
|
|
}
|
|
|
|
}
|
2020-03-12 13:36:54 +01:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Attributes
|
|
|
|
|
|
|
|
### `color`
|
|
|
|
|
|
|
|
Sky color.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
```lua
|
|
|
|
color = {
|
|
|
|
day = {154, 50, 33}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2020-07-17 06:05:12 +02:00
|
|
|
Attributes:
|
|
|
|
|
|
|
|
- `day`: sky color at midday
|
|
|
|
|
|
|
|
### `daylight_cycle`
|
|
|
|
|
|
|
|
Day/night cycle parameters.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
```lua
|
|
|
|
daylight_cycle = {
|
|
|
|
speed = 1.0
|
|
|
|
}
|
|
|
|
```
|
2020-03-12 15:17:21 +01:00
|
|
|
|
2020-07-17 06:05:12 +02:00
|
|
|
The example above is the minimal code required to add a day/night cycle to a sky.
|
|
|
|
|
|
|
|
Attributes:
|
|
|
|
|
|
|
|
- `speed`: speed of the cycle (default: `1.0`)
|
2020-03-12 13:36:54 +01:00
|
|
|
|
|
|
|
### `fog_color`
|
|
|
|
|
|
|
|
Fog color.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
```lua
|
|
|
|
fog_color = {
|
|
|
|
day = {154, 50, 33}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2020-07-17 06:05:12 +02:00
|
|
|
Attributes:
|
2020-03-12 15:17:21 +01:00
|
|
|
|
2020-07-17 19:44:28 +02:00
|
|
|
- `day`: fog color at midday
|
2020-03-12 13:36:54 +01:00
|
|
|
|
2020-03-12 13:48:11 +01:00
|
|
|
### `id`
|
|
|
|
|
|
|
|
ID of the sky. **Mandatory field.**
|
|
|
|
|
|
|
|
Example:
|
|
|
|
```lua
|
|
|
|
id = "sky_nether"
|
|
|
|
```
|
|
|
|
|
|
|
|
IDs are usually of the form `mod:sky` but the `mod:` prefix is prepended automatically so it's not needed.
|
|
|
|
|
2020-07-17 05:47:48 +02:00
|
|
|
### `objects`
|
|
|
|
|
|
|
|
#### `moon`
|
|
|
|
|
2020-07-17 06:05:12 +02:00
|
|
|
Moon attributes table.
|
|
|
|
|
|
|
|
Example:
|
2020-07-17 05:47:48 +02:00
|
|
|
```lua
|
|
|
|
moon = {
|
|
|
|
texture = "texture-moon_phases"
|
|
|
|
size = 256,
|
|
|
|
phases = {
|
|
|
|
count = 8,
|
|
|
|
size = 32
|
|
|
|
}
|
|
|
|
},
|
|
|
|
```
|
|
|
|
|
|
|
|
Attributes:
|
|
|
|
|
|
|
|
- `texture`: texture to use (without texture, the moon will use this color: (240, 240, 240))
|
|
|
|
- `size`: size of the moon (default: `256`)
|
|
|
|
- `phases`
|
|
|
|
- `count`: amount of phases (default: `1`)
|
|
|
|
- `size`: size of the phase texture (default: `32`)
|
|
|
|
|
|
|
|
#### `sun`
|
|
|
|
|
2020-07-17 06:05:12 +02:00
|
|
|
Sun attribute table.
|
|
|
|
|
|
|
|
Example:
|
2020-07-17 05:47:48 +02:00
|
|
|
```lua
|
|
|
|
sun = {
|
|
|
|
texture = "texture-sun",
|
|
|
|
size = 256,
|
|
|
|
},
|
|
|
|
```
|
|
|
|
|
|
|
|
Attributes:
|
|
|
|
|
|
|
|
- `texture`: texture to use (without texture, the sun will use this color: (255, 255, 0))
|
|
|
|
- `size`: size of the sun (default: `256`)
|
|
|
|
|
|
|
|
#### `stars`
|
|
|
|
|
2020-07-17 06:05:12 +02:00
|
|
|
Stars attribute table.
|
|
|
|
|
|
|
|
Example:
|
2020-07-17 05:47:48 +02:00
|
|
|
```lua
|
|
|
|
stars = {
|
|
|
|
count = 1000,
|
|
|
|
size = 4,
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Attributes:
|
|
|
|
|
|
|
|
- `count`: size of the sun (default: `1000`)
|
|
|
|
- `size`: size of the sun (default: `4`)
|
|
|
|
|