Skip to content

Separate block and entity limits per dimension (fixes #43)#261

Merged
tastybento merged 1 commit intodevelopfrom
worktree-nether-end-limits
May 6, 2026
Merged

Separate block and entity limits per dimension (fixes #43)#261
tastybento merged 1 commit intodevelopfrom
worktree-nether-end-limits

Conversation

@tastybento
Copy link
Copy Markdown
Member

Summary

  • Block counts, entity counts, limits, and offsets now track independently per World.Environment (overworld / nether / end). A HOPPER: 10 limit means 10 in each env — 30 total — instead of 10 shared.
  • Entity counts become persistent (stored on the island, maintained by spawn / EntityRemoveEvent / EntityPortalEvent listeners) so the panel reads correctly even when nether/end chunks are unloaded — the original bug in Limits don't show count in nether island or end island #43.
  • New optional config sections override env defaults: blocklimits-nether, blocklimits-end, entitylimits-nether, entitylimits-end, entitygrouplimits-nether, entitygrouplimits-end.
  • New 6-segment permission form <gm>.island.limit.<env>.<KEY>.<N> targets one env. Existing 5-segment perms apply the limit independently to every env.
  • /<gm> limits shows one tab per env (skipped if the gamemode doesn't generate that env). New env-suffixed PlaceholderAPI variants _overworld_count, _nether_count, _end_count (and _limit, _base_limit); the unsuffixed forms remain as cross-env sums for back-compat.
  • Pre-env data on disk migrates lazily into Environment.NORMAL on first access; existing servers should run /<gm> admin limits calc <player> to redistribute counts.

Test plan

  • mvn test — 230/230 passing (was 222 before; +8 new tests for migration, env-prefixed perms, env-isolated counts, per-env panel display).
  • Manual: built jar tested on a live BSkyBlock server. Three tabs (Overworld / Nether / End) show in /is limits, hopper placement increments only the active env's count, panel title and icons reflect the env.
  • Reviewer: verify migration on a server with significant existing IslandBlockCount data. The legacy data is moved to NORMAL only — admins may need to run /admin limits calc to repopulate nether/end counts that were previously lumped together.
  • Reviewer: confirm EntityRemoveEvent.Cause.UNLOAD exclusion is correct (we don't decrement on chunk unload).
  • Reviewer: consider whether the env-agnostic /offset admin command should grow an env-specific variant (currently it writes the same offset to all envs uniformly via setBlockLimitsOffsetAllEnvs).

🤖 Generated with Claude Code

Track block counts, entity counts, limits, and offsets independently per
World.Environment so overworld, nether, and end no longer share a single
count. Counts are now persistent rather than derived from getNearbyEntities,
so they stay accurate when nether/end chunks are unloaded — the original
bug in #43.

- IslandBlockCount: every map keyed by Environment first; legacy data
  migrates lazily into Environment.NORMAL on first access.
- BlockLimitsListener: env-aware tracking; resolution priority is island-env,
  world-named, env-default. New blocklimits-nether and blocklimits-end
  config sections override the env default for one env each.
- EntityLimitListener: persistent per-env counts maintained via spawn-handler
  increments and EntityRemoveEvent decrements (UNLOAD cause excluded so
  chunk unload doesn't drop the count). EntityPortalEvent migrates counts
  between envs to prevent the obvious portal exploit.
- JoinListener: permission format extended. 5-segment perms still apply
  the limit to all envs independently; new 6-segment form
  '<gm>.island.limit.<env>.<KEY>.<N>' targets one env (overworld/nether/end).
- LimitPanel: one tab per env (skipped for envs the gamemode doesn't
  generate). LimitTab reads counts from the IBC.
- Placeholders: env-suffixed variants added (_overworld_count etc.); the
  unsuffixed forms remain as sums for back-compat.
- RecountCalculator: rebuilds counts per-env, including a loaded-entity
  scan to seed migrated servers' nether/end entity counts.
- Tests: 230/230 passing, including new coverage for migration, env-prefixed
  perms, env-isolated counts, and per-env panel display.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 6, 2026

@tastybento tastybento merged commit 8fce44e into develop May 6, 2026
3 checks passed
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.

1 participant