Skip to content

Optimize retained rendering and harden renderer state handling#59

Merged
TWME-TW merged 11 commits into
TWME-TW:masterfrom
twme-ai:fix/pr58-integrated-review
Jul 13, 2026
Merged

Optimize retained rendering and harden renderer state handling#59
TWME-TW merged 11 commits into
TWME-TW:masterfrom
twme-ai:fix/pr58-integrated-review

Conversation

@twme-ai

@twme-ai twme-ai commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Context

This is a reviewed replacement for #58. It contains every commit from #58 through 6dde5d0, plus the fixes found while reviewing and validating that PR as an integrated change.

The goal remains to reduce display-entity churn while making renderer state, CUI forwarding, commands, persistence, shared selections, and tests behave consistently.

Combined summary

Retained rendering and diagnostics

  • Retain line shapes across render passes for cuboid, cylinder, ellipsoid, polygon, and polyhedron selections.
  • Key retained lines by geometry and visual style so unchanged lines are reused, changed lines are replaced, and stale lines are removed.
  • Keep fill faces and other transient shapes outside the retained pool so they are recreated cleanly.
  • Track retained-line reuse, spawn, removal, line, and entity counts for debug output.
  • Rebase display origins when the viewer moves far enough, with per-renderer error isolation and localized debug reporting.

Renderer and CUI state

  • Centralize the decision for whether the server renderer should consume WorldEdit CUI packets.
  • Preserve client-side CUI forwarding when the server renderer is disabled, while still handling Bedrock and particle fallback modes.
  • Make outbound CUI parsing more defensive and avoid stream allocations in packet filtering paths.
  • Implement CUI update events and mark affected selections dirty so retained renderers refresh correctly.
  • Refresh renderer state after per-player settings and render-mode changes.

Commands, permissions, and persistence

  • Refine permissions for render, share, view, label, list, and hide operations.
  • Validate renderer setting names and values before applying them.
  • Persist accepted share relationships and improve share/view cleanup behavior.
  • Keep dirty player settings available for retry when a save fails instead of discarding unsaved state.
  • Improve error logging and reload behavior for player settings and language/config state.

Shared selection lifecycle

  • Generate deterministic shared-selection colors and retain color/component caches only while live renderer or label references exist.
  • Keep TextDisplay and particle shared renderers aligned with active-share and view-all visibility.
  • Remove stale renders and labels when a sharer becomes hidden, leaves loading distance, goes offline, loses its selection, changes world, or has missing player data.
  • Apply particle max_render_distance and view-all distance rules both during normal viewer updates and during sharer-triggered push updates.
  • Prevent cross-world TextDisplay shares and prevent push updates from recreating shared renders for viewers who disabled server rendering.
  • Centralize single-viewer/single-sharer cleanup so text renderers, particle renderers, labels, colors, and component caches are released in the correct order.
  • Clean label-only references and empty per-viewer maps, including sharer disconnect and view-all teardown paths.

Build, dependencies, and tests

  • Update EntityLib to 3.3.4+b54a52a-SNAPSHOT as in Optimize retained line rendering and renderer state handling #58.
  • Configure Maven Surefire 3.5.4, so the added JUnit 5 suite is actually discovered by the normal Maven lifecycle.
  • Cover CUI parsing/forwarding, CUI updates, settings persistence, permission routing, share persistence, color parsing, and shared-cache cleanup.

Review fixes added after #58

  • Fix the Maven configuration that previously reported a successful build while executing zero JUnit 5 tests.
  • Allow users with only worldeditdisplay.use.view.hide to enter the view command route.
  • Fix shared color/component cache leaks caused by releasing caches before removing the final label reference.
  • Fix label-only references surviving viewer or sharer cleanup.
  • Remove already-rendered view-all selections after they leave the configured loading distance.
  • Make sharer-triggered updates obey the same distance, world, visibility, and renderer-enabled rules as normal viewer updates.
  • Avoid removing the owning per-viewer map while an update pass is still using it.

Validation

  • mvn -B clean verify (Paper): 30 tests, 0 failures/errors/skips; shaded JAR produced.
  • mvn -B clean verify -Pspigot: 30 tests, 0 failures/errors/skips; shaded JAR produced.
  • git diff --check: clean.

The existing Maven Shade warnings about overlapping EntityLib/annotation classes and resources remain unchanged and do not fail either build profile.

Supersedes #58.

@TWME-TW TWME-TW merged commit 5f6aa22 into TWME-TW:master Jul 13, 2026
1 check 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.

2 participants