Описание
# ReadStar — NeoForge Astronomy Mod

A Minecraft sky mod driven by real celestial mechanics and star catalog data, featuring planetary orbital systems, star catalogs, FOV-aware rendering, and server-synchronized celestial configuration.
**Author**: FrozenStream
## Features
- **Real Star Catalog** — 12,000+ real stars from Gaia DR3 (color) + BSC5 (bright star fallback), with per-star brightness and glow
- **Real Celestial Mechanics** — Keplerian orbital system with unlimited nesting depth
- **Atmospheric Scattering** — HSV-based atmosphere color & glow computation with full-sky overlay and stellar halo
- **Comet Rendering** — Bézier dust + ion dual-tail structure with dynamic wobble
- **FOV-Aware Rendering** — Custom shader keeps star screen size constant across FOV changes
- **Zero-Code Customization** — Add 8 moon phases to any body by simply placing PNGs
- **Server Sync** — Celestial config managed server-side, auto-synced to all clients
---
## Quick Start
```bash
./gradlew build # Build
./gradlew runClient # Run client
./gradlew runData # Data generation (atlas config)
./gradlew runServer # Run server
```
The celestial system is defined via **data pack** at `data/readstar/celestial/system.json`, and the star catalog via **resource pack** at `assets/readstar/custom/stars/stars.json`.
Config changes take effect with F3+T. Data pack changes require `/reload` or restart.
---
## Configuration
Config file: `run/config/readstar-common.toml`
| Option | Default | Description |
|--------|---------|-------------|
| `starCoreSize` | `0.648` | Star core quad size multiplier |
| `starGlowSize` | `1.5` | Bright star glow quad size multiplier |
| `starFovCompensationStrength` | `0.8` | Star **size** FOV compensation. `1.0` = full, `0.0` = none |
| `starFovBrightnessStrength` | `1.0` | Star **brightness** boost when zoomed in. `0.0` = none |
| `celestialApparentSizeFactor` | `4000.0` | Celestial body apparent size factor |
| `celestialApparentSizeMin` | `1.024` | Minimum apparent size clamp |
### FOV-Aware Rendering
Stars use a custom shader that separates each point into **position** and **offset**:
| Attribute | Meaning | Behavior |
|-----------|---------|----------|
| `Position` (vec3) | Celestial sphere coordinate, shared by 4 vertices | Transformed by MVP, naturally affected by FOV |
| `Offset` (vec3) | Billboard corner offset, unique per vertex | Multiplied by `FovCompensation` for size correction |
Formula: `FovCompensation = tan(fov/2) / tan(35°) × strength + (1 - strength)`
Shader: `worldPos = Position + Offset × FovCompensation`
### Per-Star Brightness
Based on Vmag with independent decay thresholds:
| Parameter | Formula | Notes |
|-----------|---------|-------|
| Alpha | `clamp(1 - max(0, Vmag-3)/12, 0.4, 1)` | Full brightness at Vmag ≤ 3 |
| RGB | `clamp(1 - max(0, Vmag-1)/19, 0.7, 1)` | Full brightness at Vmag ≤ 1 |
| Size | `clamp(1 - Vmag/12, 0.5, 1) × starCoreSize` | Larger Vmag = smaller dot |
Glow quads only for Vmag < 2.0: `< 0.5 → high / < 1.5 → medium / < 2.0 → low`.
---
## Data Pack — Celestial System
**Path**: `data/readstar/celestial/system.json`
Place at `saves//datapacks//data/readstar/celestial/system.json` or server `world/datapacks/`.
### Structure
```json
{
"System": {
"": {
"mass": ,
"radius": ,
"luminance": ,
"unstableDirtySnowball": ,
"hasAtmosphere": ,
"atmosphereHSV": ,
"starHSV": ,
"axis": [, , ],
"orbit": {
"semiMajorAxis": ,
"eccentricity": ,
"inclination": ,
"argumentOfPeriapsis": ,
"longitudeOfAscendingNode": ,
"initialMeanAnomaly":
},
"children": { "": { ... } }
}
}
}
```
### Field Reference
| Field | Description |
|-------|-------------|
| `mass` | Mass (kg). 0 = fixed at parent position |
| `radius` | Radius (m). Apparent size = `max(1.024, radius / distance × factor)` |
| `luminance` | Self-luminosity 0~15. >0 = star; children auto-resolve `hostStar` upward |
| `unstableDirtySnowball` | Comet flag. `true` renders dual-tail structure |
| `hasAtmosphere` | Has atmosphere (controls overlay and glow rendering) |
| `atmosphereHSV` | Atmosphere HSV color, packed int (H