Skip to content

Fix palette resize panic, particle options, bees and styled number format - #399

Open
Nuulz wants to merge 4 commits into
azalea-rs:mainfrom
Nuulz:fix-stress-test-bugs
Open

Nuulz wants to merge 4 commits into
azalea-rs:mainfrom
Nuulz:fix-stress-test-bugs

Conversation

@Nuulz

@Nuulz Nuulz commented Oct 16, 2026

Copy link
Copy Markdown

Fixes #398. One commit per bug. Every fix has a test that fails without it, and the full stress run from the issue passes on a vanilla 26.2 server.

1. Global palette bit width (azalea-world)

  1. Add global_bits_per_entry() to PalletedContainerKind.
  2. BlockState: ceillog2(MAX_STATE + 1), which is 15 in 26.2 and matches vanilla's ceillog2(registry size).
  3. Biome: 16. azalea doesn't know the biome registry size at compile time, and 16 bits covers any datapack.
  4. In on_resize, when the new kind is Global, use max(requested, global_bits_per_entry()) instead of bits_per_entry + 1.

Test test_resize_to_global_fits_any_state: fill 256 states, set MAX_STATE, check the palette is global at 15 bits and every value reads back. Without the fix it hits the same panic as the live bot.

Live: the bot used to die around the 188th distinct block. It now gets through all 1200 setblocks.

2. Particle options (azalea-entity)

  1. Add PowerParticle { power }, SpellParticle { color, power } and TrailParticle { target, color, duration }.
  2. Give data to the eight variants: DragonBreath(PowerParticle), Effect / InstantEffect(SpellParticle), TintedLeaves / Flash(ColorParticle), Trail(Box<TrailParticle>), DustPillar / BlockCrumble(BlockParticle).
  3. Box TrailParticle like VibrationParticle, so EntityDataValue stays at 24 bytes (there's a const assert for that).
  4. Update From<ParticleKind> to use Default for the new data.

Tests: read flash with an ARGB int and check nothing is left over, plus a trail roundtrip.

Live: all eight particle kinds are received and parsed, with 0 errors (it was 7 Leftover data errors before).

3. Beehive occupants (azalea-inventory)

  1. Change BeehiveOccupant::entity_data from NbtCompound to EntityData (entity kind + compound, same as vanilla's TypedEntityData).
  2. Drop the skip_serializing_if = "is_default", since EntityData has no default and vanilla always writes it.

Test: a Bees roundtrip that checks the bee's entity type id goes on the wire.

Live: the beehive[bees=...] item no longer errors.

4. Styled number format (azalea-chat)

  1. Read NumberFormat::Styled with Nbt::azalea_read (unnamed), matching the existing write.

Test: a styled roundtrip. Without the fix it fails with UnexpectedEof.

Live: all six set_objective packets from the scoreboard commands parse.

Breaking changes

  • The eight Particle variants above now carry data, so matches need Particle::Flash(_), and so on.
  • BeehiveOccupant::entity_data is now EntityData.
  • PalletedContainerKind has a new required method.

Nuulz added 4 commits October 16, 2026 16:54
Filling a hashmap palette bumped bits_per_entry to 9 and switched to the
global palette, but global ids need 15 bits for block states. Debug builds
panicked in BitStorage::set and release builds silently masked the ids.
Eight particle types carry options in 26.2 but were unit variants, so any
level_particles packet with one of them failed with leftover data.
In 26.2 the occupant's entity_data is a TypedEntityData (entity type id plus
a compound), not a bare compound, so any bees component broke the item.
The style was read with a named root but written unnamed, so set_objective
packets with a styled format ran out of data.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Four bugs found by stress-testing against vanilla 26.2 (palette panic, particles, bees, styled number format)

1 participant