Skip to content

Commit 2f9a669

Browse files
otectusclaude
andcommitted
Effective Instruments v1.2.1: Hardening, performance, and UX improvements
Address 24 findings from full code review: fix logout effect cleanup, add packet rate limiting, clamp JSON amplifiers, cache pet allowlist and enabled presets, optimize tick handler to iterate only active musicians, add effect listing to tooltips, add button row wrapping, validate aura IDs, add file size limits, fix compact icon overflow, update tests and docs. Also includes v1.2.0 textures and icon generation tool. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b1dfaaf commit 2f9a669

52 files changed

Lines changed: 834 additions & 128 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,58 @@
22

33
All notable changes to Effective Instruments will be documented in this file.
44

5+
## [1.2.1] - 2026-03-26
6+
7+
### Bug Fixes
8+
- Fixed player logout not cleaning up aura effects on buffed targets in abrupt disconnection scenarios
9+
- Fixed effect cleanup incorrectly stripping long-duration effects from other sources (e.g. beacons) that matched the aura's amplifier — now also checks remaining duration
10+
- Fixed `onInstrumentClose` bypassing debug logging when clearing aura selection
11+
- Fixed compact mode icon (16px) overflowing the 14px button — icon now scales to fit
12+
13+
### Security & Hardening
14+
- Added 5-tick (~250ms) rate limiting on `SelectAuraC2SPacket` and `InstrumentOpenC2SPacket` to prevent packet spam
15+
- Effect amplifiers in aura JSON files are now clamped to 0–4 (Level I–V) with a warning if exceeded
16+
- Aura JSON files over 64KB are skipped with a warning to guard against maliciously large files
17+
- Aura IDs derived from filenames are validated against `[a-z0-9_]+` — non-conforming files are skipped
18+
- Suspicious instrument IDs from unknown namespaces are logged at WARN level
19+
20+
### Performance
21+
- Pet entity allowlist is now cached statically instead of being re-parsed every tick interval per musician
22+
- Tick handler now iterates only active musicians instead of all players in the level
23+
- Enabled presets list is pre-computed on load instead of being rebuilt on every call
24+
25+
### Improvements
26+
- Aura button tooltips now show actual effects with levels (e.g. "Speed I, Regeneration I")
27+
- Aura selector buttons now wrap into multiple rows when total width exceeds 60% of screen width
28+
- Replaced misleading `ConcurrentHashMap` with `HashMap` (all access is on the main server thread)
29+
- Documented dimension-change cleanup limitation (effects expire naturally within 13 seconds)
30+
- Updated test data from obsolete aura names to current v1.2.0 names
31+
- Added link to INSTRUMENT_AURAS.md design reference in README
32+
- Added server admin note in README about disabling Smoky Allure's Hero of the Village effect
33+
534
## [1.2.0] - 2026-03-23
635

736
### Features
8-
- **Instrument-specific auras:** Each instrument can have its own aura (or set of allowed auras) configured via `config/effective_instruments/instrument_auras.json`. The selector only shows auras allowed for the current instrument.
37+
- **15 unique instrument auras** replacing the original 4 generic presets — each instrument now has its own thematic aura (Zephyr's Blessing, Warcry Cadence, Moonlit Passage, Smoky Allure, Ghost Flame, and more)
38+
- **Instrument-specific aura filtering:** Each instrument can have its own set of allowed auras configured via `config/effective_instruments/instrument_auras.json`. The selector only shows auras allowed for the current instrument.
39+
- **All EMI Note Block Instrument variants mapped** — all 16 variants (basedrum, bass, bell, bit, chime, etc.) now have assigned auras instead of showing all auras
940
- **Per-instrument aura memory:** Manual aura overrides are remembered per-instrument within the session (forgotten on logout)
1041
- **`/effectiveinstruments status [player]`** command to view aura state (selected aura, instrument, active status, buffed target count)
1142
- CI workflow for automated builds via GitHub Actions
1243
- Unit test scaffolding with JUnit 5
1344

1445
### Changes
1546
- **Aura selection now clears when closing an instrument** (previously persisted across close/reopen). The instrument-specific default will auto-select on next open.
47+
- **Old aura presets replaced:** Soothing Hymn, Invigorating March, Guardian Chorus, and Luminous Nocturne have been replaced by 15 instrument-specific auras. Existing installs keep their old files (marker-based generation).
1648
- Network protocol bumped to version 3 (clients and servers must use matching mod versions)
1749
- `/effectiveinstruments reload` now also reloads instrument-aura mappings and reports mapping count
50+
- Server-side validation: players can only select auras allowed for their current instrument
1851

1952
### Technical
2053
- New `InstrumentOpenC2SPacket`: client sends instrument ID to server when opening an instrument screen
2154
- New `SyncAuraSelectionS2CPacket`: server syncs auto-selected aura back to client
2255
- `NoteActivityHandler` now captures instrument ID from note metadata as a fallback
56+
- `InstrumentAuraMapping` supports both string shorthand and object form (with `default` + `allowed` list)
2357

2458
## [1.1.0] - 2026-03-23
2559

CURSEFORGE_DESCRIPTION.md

Lines changed: 78 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,53 @@
11
# Effective Instruments
22

3-
**Play music. Empower allies.** Effective Instruments adds a magical aura system to [Genshin Instruments](https://www.curseforge.com/minecraft/mc-mods/genshin-instruments), letting musicians grant potion effects to nearby players and tamed pets while they perform. Pick an aura, play your instrument, and watch enchanted music notes drift outward as your allies receive buffs.
3+
**Play music. Empower allies.** Effective Instruments adds a magical aura system to [Genshin Instruments](https://www.curseforge.com/minecraft/mc-mods/genshin-instruments), letting musicians grant potion effects to nearby players and tamed pets while they perform. Every instrument has its own unique aura — pick up a Windsong Lyre and feel the breeze quicken your step, or pound the Glorious Drum to steel your allies for battle.
44

55
---
66

77
## How It Works
88

99
1. **Open any instrument** from Genshin Instruments (or Even More Instruments).
10-
2. **Select an aura** from the icon buttons that appear in the top-right corner of the instrument screen.
10+
2. **Your instrument's aura auto-selects.** Each instrument has a default aura mapped to it — no manual selection needed.
1111
3. **Start playing.** As long as you're actively playing notes, your aura applies its potion effects to all valid targets within range. Colored music note particles float outward to show the aura's reach.
12-
4. **Stop playing** and the aura deactivates after a short grace window (configurable, default 5 seconds). Effects are applied with a set duration and will naturally expire on their own.
12+
4. **Stop playing** and the aura deactivates after a short grace window (configurable, default 5 seconds). Effects will naturally expire on their own.
13+
5. **Close the instrument** and the aura clears. Open the same instrument again and it remembers your last selection for that session.
1314

14-
Switching to a different aura **immediately clears** the previous aura's effects from all targets before the new one kicks in — no stacking exploits, clean transitions.
15+
If an instrument has multiple allowed auras, use the selector buttons in the top-right corner of the instrument screen to switch between them.
1516

1617
---
1718

18-
## Built-In Auras
19+
## Instrument Auras
1920

20-
Effective Instruments ships with four aura presets out of the box:
21+
Every instrument ships with its own unique, thematic aura:
2122

22-
| Aura | Effects | Color |
23+
### Genshin Instruments
24+
25+
| Instrument | Aura | Effects |
26+
|---|---|---|
27+
| **Windsong Lyre** | Zephyr's Blessing | Speed I |
28+
| **Vintage Lyre** | Echoes of Antiquity | Regeneration I |
29+
| **Floral Zither** | Bloom Veil | Absorption I + Saturation I |
30+
| **Glorious Drum** | Warcry Cadence | Strength I + Resistance I |
31+
| **Nightwind Horn** | Moonlit Passage | Night Vision + Slow Falling |
32+
| **Ukulele** | Sunkissed Serenade | Luck I |
33+
| **Djem Djem Drum** | Rhythm of the Earth | Haste I + Jump Boost I |
34+
35+
### Even More Instruments
36+
37+
| Instrument | Aura | Effects |
2338
|---|---|---|
24-
| **Soothing Hymn** | Regeneration I | Green |
25-
| **Invigorating March** | Speed I + Haste I | Orange |
26-
| **Guardian Chorus** | Resistance I + Absorption I | Blue |
27-
| **Luminous Nocturne** | Night Vision | Lavender |
39+
| **Guitar** | Wanderer's Anthem | Speed I + Jump Boost I |
40+
| **Keyboard** | Harmonic Resonance | Regeneration I + Haste I |
41+
| **Koto** | Tranquil Current | Water Breathing + Dolphin's Grace |
42+
| **Pipa** | Silk Road Vigor | Speed I + Strength I |
43+
| **Saxophone** | Smoky Allure | Hero of the Village I |
44+
| **Shamisen** | Ghost Flame | Fire Resistance + Strength I |
45+
| **Trombone** | Bulwark Fanfare | Resistance I + Absorption II |
46+
| **Violin** | Heartstring Aria | Regeneration I + Absorption I |
47+
48+
Note Block Instrument variants (basedrum, bass, bell, etc.) are also mapped to thematically matching auras — see `_README_INSTRUMENTS.txt` in your config folder for the full list.
2849

29-
Each has its own unique icon in the instrument UI, with a highlighted variant when selected. All four can be freely customized, disabled, or deleted entirely.
50+
All auras can be freely customized, disabled, or deleted. Add your own by creating new JSON files.
3051

3152
---
3253

@@ -38,7 +59,7 @@ Every aura is defined by a simple JSON file in your config folder:
3859
config/effective_instruments/auras/
3960
```
4061

41-
On first launch, the mod generates the four default aura JSON files and a `_README.txt` reference guide. From there, you have full control:
62+
On first launch, the mod generates 15 default aura JSON files and a `_README.txt` reference guide. From there, you have full control:
4263

4364
- **Edit** any default aura — change its effects, duration, radius, color, name, or description
4465
- **Disable** an aura by setting `"enabled": false` — it stays on disk but won't appear in-game
@@ -83,9 +104,39 @@ Each entry in the `effects` array takes:
83104

84105
If `icon`/`iconSelected` are omitted, the button displays the first letter of the display name as a fallback — so custom auras don't require any texture work.
85106

86-
### Hot Reload
107+
---
108+
109+
## Instrument-Aura Mapping
110+
111+
The file `config/effective_instruments/instrument_auras.json` controls which auras are available for each instrument and which one auto-selects when opened.
112+
113+
**Two formats are supported per entry:**
87114

88-
Use the command `/effectiveinstruments reload` (requires operator permission level 2) to reload all aura JSON files without restarting the game. If a player has an aura selected that no longer exists or was disabled after reload, their selection is automatically cleared.
115+
**String shorthand** — single aura, default and only option:
116+
```json
117+
"genshinstrument:windsong_lyre": "zephyrs_blessing"
118+
```
119+
120+
**Object form** — default aura + additional allowed auras in the selector:
121+
```json
122+
"genshinstrument:windsong_lyre": {
123+
"default": "zephyrs_blessing",
124+
"allowed": ["zephyrs_blessing", "echoes_of_antiquity", "bloom_veil"]
125+
}
126+
```
127+
128+
- If an instrument is **not listed**, all enabled auras are shown (backwards-compatible)
129+
- The default aura is always included in the allowed list automatically
130+
- Use `/effectiveinstruments reload` to apply changes without restarting
131+
132+
---
133+
134+
## Commands
135+
136+
| Command | Permission | Description |
137+
|---|---|---|
138+
| `/effectiveinstruments reload` | OP (level 2) | Reload all aura presets and instrument mappings |
139+
| `/effectiveinstruments status [player]` | OP (level 2) | Show a player's current aura state |
89140

90141
---
91142

@@ -112,7 +163,6 @@ All config files live under a single folder: `config/effective_instruments/`.
112163
| `includeOtherPlayers` | `true` | Whether other players in range receive effects |
113164
| `includeTamedPets` | `true` | Whether tamed animals in range receive effects |
114165
| `petEntityTypeAllowlist` | `[]` | Extra entity type IDs to treat as pets (e.g. `["alexsmobs:crow"]`) |
115-
| `screenClassAllowlist` | `[]` | Fully-qualified class names for instrument screens from other mods that don't extend Genshin Instruments' `InstrumentScreen` |
116166

117167
### Client Config (`client.toml`)
118168

@@ -122,31 +172,33 @@ All config files live under a single folder: `config/effective_instruments/`.
122172
| `overlayScale` | `1.0` | Scale factor for overlay buttons (0.5 - 2.0) |
123173
| `compactMode` | `false` | Use a compact button layout |
124174
| `particlesMode` | `ALL` | Floating music note particles: `ALL`, `MINIMAL`, or `NONE` |
175+
| `screenClassAllowlist` | `[]` | Fully-qualified class names for instrument screens from other mods that don't extend Genshin Instruments' `InstrumentScreen` |
125176

126177
---
127178

128179
## Visual Effects
129180

130-
When an aura is active, colored **floating music note particles** spawn across the full radius of the aura's effect range. The particles are tinted to match the aura's configured color — green drifting notes for Soothing Hymn, orange for Invigorating March, and so on. They gently rise, drift, pulse in size, and fade out.
181+
When an aura is active, colored **floating music note particles** spawn across the full radius of the aura's effect range. The particles are tinted to match the aura's configured color — teal drifting notes for Zephyr's Blessing, crimson for Warcry Cadence, violet for Moonlit Passage, and so on. They gently rise, drift, pulse in size, and fade out.
131182

132-
Particle rendering is entirely client-side. If particles cause performance issues, use the `particlesMode` client config option to reduce or disable them. The server always sends particle data; the client decides whether to render it.
183+
Particle rendering is entirely client-side. If particles cause performance issues, use the `particlesMode` client config option to reduce or disable them.
133184

134185
---
135186

136187
## Smart Buff Handling
137188

138189
- **Strongest wins:** If a target already has a stronger version of the same effect from another source (e.g. a beacon or potion), the aura won't overwrite it.
139190
- **Clean switching:** Changing auras instantly strips the old aura's effects from all targets. The mod tracks exactly which effects it applied to which entities and only removes its own.
191+
- **Clean close:** Closing an instrument clears the aura and strips tracked effects. The instrument's default aura will auto-select next time it's opened.
140192
- **Ambient effects:** Aura-applied effects use the ambient flag (subtle swirling particles) to distinguish them from potions and to keep the visual clutter low.
141-
- **Deselecting:** Clicking the active aura button to deselect lets existing effects expire naturally rather than stripping them immediately.
193+
- **Per-instrument memory:** If you override the default aura for an instrument, your choice is remembered for that instrument within the session (forgotten on logout).
142194

143195
---
144196

145197
## Compatibility
146198

147199
- **Genshin Instruments** (required) — all instrument screens are automatically detected
148-
- **Even More Instruments** (optional) — all EMI screens extend Genshin Instruments' `InstrumentScreen` and are automatically supported
149-
- **Other instrument mods** — use the `screenClassAllowlist` server config to add support for screens from mods that don't extend `InstrumentScreen`
200+
- **Even More Instruments** (optional) — all EMI screens extend Genshin Instruments' `InstrumentScreen` and are automatically supported, including all 16 Note Block Instrument variants
201+
- **Other instrument mods** — use the `screenClassAllowlist` client config to add support for screens from mods that don't extend `InstrumentScreen`
150202

151203
Effects from other mods (potion effects, beacons, etc.) are never stripped or overwritten unless the aura provides a stronger or equal version.
152204

@@ -163,7 +215,8 @@ Effects from other mods (potion effects, beacons, etc.) are never stripped or ov
163215
## Quick Start
164216

165217
1. Install the mod alongside Genshin Instruments.
166-
2. Open any instrument in-game. You'll see four aura icons in the top-right corner.
167-
3. Click one to select it, then start playing. Nearby allies will receive the buff.
168-
4. To customize or add auras, edit the JSON files in `config/effective_instruments/auras/`.
169-
5. Use `/effectiveinstruments reload` to apply changes without restarting.
218+
2. Open any instrument in-game. Its unique aura auto-selects and the corresponding button appears in the top-right corner.
219+
3. Start playing. Nearby allies will receive the buff.
220+
4. To customize auras, edit the JSON files in `config/effective_instruments/auras/`.
221+
5. To change instrument mappings, edit `config/effective_instruments/instrument_auras.json`.
222+
6. Use `/effectiveinstruments reload` to apply changes without restarting.

0 commit comments

Comments
 (0)