Commit feee0b9
Add base file support for general data to preserve potion type values across scrapes (#271)
The scraper was overwriting `potion_types.ts` with an empty array on
each run because `General` had no base-loading mechanism — unlike BP/RP
containers which seed from `src/base/` before scraping.
## Changes
- **New base JSON files** in
`packages/bedrock-vanilla-data/src/base/general/`:
- `potion_types.json` — seeds the known values `["Consume",
"ThrownLingering", "ThrownSplash"]`
- `potion_modifiers.json` — empty placeholder following the same pattern
- **`General.load(folder)`** — new static method on the `General` class
that reads base values from JSON files before scraping populates the
rest
- **`Output.load()`** — updated to call
`General.load(baseFolder/general)` alongside the existing
`edu`/`vanilla` OutputSet loads
- **`loadStringArray(filepath)`** — new helper in `json.ts` for loading
plain string arrays; `loadEnsure<string>` silently wraps string items
into `{ id }` objects (by design for BP/RP data), which is incorrect for
simple string fields on `General`
The flow is now consistent with BP/RP containers: base values are loaded
first, scraped values are merged on top, and `cleanStrings()`
deduplicates before saving.
<!-- START COPILOT CODING AGENT TIPS -->
---
✨ Let Copilot coding agent [set things up for
you](https://github.com/Blockception/minecraft-bedrock-language-server/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot)
— coding agent works faster and does higher quality work when set up for
your repo.
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: DaanV2 <2393905+DaanV2@users.noreply.github.com>1 parent 15d1ae0 commit feee0b9
5 files changed
Lines changed: 44 additions & 0 deletions
File tree
- packages/bedrock-vanilla-data/src/base/general
- tools/vanilla-scraper/src
- classes
- static
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
26 | 37 | | |
27 | 38 | | |
28 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
51 | 81 | | |
52 | 82 | | |
53 | 83 | | |
| |||
0 commit comments