Skip to content

Add block group limits#287

Merged
tastybento merged 1 commit into
masterfrom
feat/12-block-group-limits
Jul 10, 2026
Merged

Add block group limits#287
tastybento merged 1 commit into
masterfrom
feat/12-block-group-limits

Conversation

@tastybento

Copy link
Copy Markdown
Member

Fixes #12 — the block half of group limits (entity groups shipped earlier). This is what #84 (piston + sticky piston) and #132 (grass→dirt conversion bypass) were closed into.

Config

blockgrouplimits:
  Pistons:
    icon: PISTON
    limit: 10
    materials:
    - PISTON
    - STICKY_PISTON
  Soil:
    icon: GRASS_BLOCK
    limit: 200
    materials:
    - GRASS_BLOCK
    - DIRT
    - DIRT_PATH
    - FARMLAND

blockgrouplimits-nether:
  Pistons: 5

Mirrors entitygrouplimits exactly: named group, icon, member list, shared limit, per-environment overrides (limit only). Member names normalise through the existing variant map, so e.g. a piston head resolves to its piston.

Behaviour

  • At placement (and every path that funnels through process() — grow, spread, form), the counts of all group members are summed and checked against the group limit. Converting grass→dirt no longer escapes the limit because both count into the same pool.
  • The individual-limit cascade (island → world → env default) runs first and still applies inside a group, so a tighter per-material limit wins.
  • The recount tracks group members even when they carry no individual limit; the config comment tells admins to recount after adding a group.
  • The limits GUI gains a row per group: icon, member list, summed count/limit with the usual colouring.

Notes / deliberate v1 scope

  • The hit-limit message names the placed material with the group's limit value. Naming the group in the message (like entity groups do) needs process()'s int-return contract reworked across all state-transition handlers — worth doing separately if wanted.
  • Permission-based block group limits (<gm>.island.limit.<groupname>.<n>) and group offsets are not included; both need IslandBlockCount data-model additions and can follow if there's demand.

Tests

Settings parsing (definitions, env overrides, unknown material, undefined-group override), group-full cancels without double-count, under-limit allows and counts, tighter individual limit still applies. Full suite green (262).

In-game test plan

  1. Define the Pistons group above, restart, place 6 pistons + 4 sticky pistons.
  2. The 11th of either kind is blocked; /is limits shows a Pistons row at 10/10.
  3. Break one piston → a sticky piston can now be placed (9→10 again).
  4. Set blocklimits: PISTON: 3 as well → the 4th piston is blocked even with the group at 7/10.
  5. /is limits recount → group count matches reality (including blocks placed before the group existed).
  6. Nether: with the -nether override at 5, verify the pool is 5 there and 10 in the overworld.

🤖 Generated with Claude Code

https://claude.ai/code/session_015dbJyrv2uxHfTmiWkqGUJB

@tastybento tastybento force-pushed the feat/12-block-group-limits branch 2 times, most recently from 1391c67 to 24ab79b Compare July 10, 2026 20:37
Completes #12: entity groups shipped earlier; this adds the block half.
A blockgrouplimits config section (mirroring entitygrouplimits) defines
named groups of materials sharing one limit - the counts of all members
are summed and checked at placement, so players cannot dodge a limit by
converting between related blocks (grass->dirt, #132) or splitting
across variants (piston/sticky piston, #84).

- Settings parses group definitions plus blockgrouplimits-nether/-end
  per-environment limit overrides; member names normalise through the
  existing variant map.
- checkLimit consults groups after the individual limit cascade, so a
  tighter individual limit still applies inside a group.
- The recount tracks group members even when they have no individual
  limit, and the limits GUI shows a row per group (icon, member list,
  summed count/limit).

Fixes #12

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015dbJyrv2uxHfTmiWkqGUJB
@tastybento tastybento force-pushed the feat/12-block-group-limits branch from 24ab79b to 2f8d8ce Compare July 10, 2026 20:43
@tastybento tastybento merged commit 6cbca12 into master Jul 10, 2026
1 check passed
@sonarqubecloud

Copy link
Copy Markdown

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