Skip to content

Enhance backend PacketEvents and improve documentation - #18

Open
RedSavant wants to merge 7 commits into
mainfrom
dev
Open

Enhance backend PacketEvents and improve documentation#18
RedSavant wants to merge 7 commits into
mainfrom
dev

Conversation

@RedSavant

Copy link
Copy Markdown
Owner

This pull request updates the documentation to reflect new backend support and usage patterns in BDApi, and adds a custom 404 error page for the documentation site. The most important changes are grouped below.

Documentation updates for backend support and usage:

  • Updated the README.md to document support for two backends (PAPER and PACKET_EVENTS), including configuration, per-display backend selection, per-player/global display visibility, and backend requirements. [1] [2] [3]
  • Clarified how visibility and viewer management methods work for each backend, and described coordinate behavior and anchor options for display positioning. [1] [2]
  • Updated the dependency version in the installation instructions to 1.1.0-beta.1 and clarified requirements for PacketEvents. [1] [2]
  • Updated the status section to reflect the new version.

Documentation site improvement:

  • Added a custom 404.html page for the documentation site to provide a branded not found page.

el211 and others added 6 commits September 10, 2026 13:51
…ockDisplay (#12)

* chore: ignore local editor and tooling folders

* build: add PacketEvents, JUnit 5 and Mockito dependencies

* feat: add backend enum and centering anchor

* feat: add display handle abstraction and paper handle

* feat: add packet display state, sender interface and id allocator

* refactor: back DisplayCrate with DisplayHandle

* refactor: key registry by uuid and route transforms through handle

* refactor: decouple animator from Bukkit entities

* refactor: decouple physics engine from Bukkit entities

* feat: add config and optional packet backend detection

* feat: add PacketEvents sender and metadata codec

* feat: add backend selection and viewers to builder

* feat: wire packet backend and global viewer lifecycle

* test: cover anchor offset semantics and id allocator

* test: cover packet viewer lifecycle and paper handle

* test: cover backend selection and registry cleanup

* refactor: extract physics force integration

* test: cover animation and physics on packet backend

* feat: add paper, packet and offset demo commands

* docs: document backends, viewers and coordinate behavior

* fix: correct BDApi name in init error messages

* fix: prevent packet entity id overflow into negatives

* fix: warn when packet display spawns with no viewers
Add logo image and center alignment to README
* Add static docs

* Fix base

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved critical and moderate issues remain in PacketEvents metadata, lifecycle, transforms, world handling, and backend configuration.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

This PR adds optional PacketEvents support alongside Paper, expands display/viewer/transform handling, adds tests, and updates the README and documentation site.

Changes:

  • Adds backend selection, packet display lifecycle, anchors, animations, and transforms.
  • Adds backend, packet, physics, and animation tests.
  • Updates build configuration, examples, generated documentation, and adds a custom 404 page.
File summaries
File Summary
test-plugin/src/main/resources/plugin.yml Updates test-plugin commands and backend usage.
test-plugin/src/main/java/fr/redsavant/Main.java Adds backend and transform demonstration commands.
src/test/java/fr/redsavant/bdapi/support/RecordingPacketDisplaySender.java Adds a packet sender test double.
src/test/java/fr/redsavant/bdapi/PhysicsStateTest.java Tests physics forces.
src/test/java/fr/redsavant/bdapi/packet/PacketEntityIdAllocatorTest.java Tests packet entity ID allocation.
src/test/java/fr/redsavant/bdapi/display/PaperDisplayHandleTest.java Tests Paper display handles.
src/test/java/fr/redsavant/bdapi/display/PacketDisplayHandleTest.java Tests packet display handles.
src/test/java/fr/redsavant/bdapi/display/AnchorTest.java Tests anchor compensation.
src/test/java/fr/redsavant/bdapi/BackendSelectionTest.java Tests backend selection and cleanup.
src/test/java/fr/redsavant/bdapi/AnimationBackendTest.java Tests backend animations.
src/main/java/fr/redsavant/bdapi/transform/TransformHandle.java Provides direct transform operations.
src/main/java/fr/redsavant/bdapi/packet/PacketEventsProbe.java Probes PacketEvents initialization.
src/main/java/fr/redsavant/bdapi/packet/PacketEventsDisplaySender.java Sends display packets.
src/main/java/fr/redsavant/bdapi/packet/PacketEntityIdAllocator.java Allocates fake entity IDs.
src/main/java/fr/redsavant/bdapi/packet/PacketDisplaySender.java Defines packet sender operations.
src/main/java/fr/redsavant/bdapi/packet/PacketDisplayMetadataCodec.java Encodes display metadata.
src/main/java/fr/redsavant/bdapi/packet/PacketDisplayListener.java Handles packet display viewer lifecycle.
src/main/java/fr/redsavant/bdapi/packet/PacketBackendSupport.java Detects PacketEvents support.
src/main/java/fr/redsavant/bdapi/internal/PhysicsEngine.java Routes physics through display handles.
src/main/java/fr/redsavant/bdapi/internal/DisplayRegistry.java Registers backend-independent displays.
src/main/java/fr/redsavant/bdapi/internal/Animator.java Animates display handles.
src/main/java/fr/redsavant/bdapi/internal/ActiveAnimation.java Stores animation state.
src/main/java/fr/redsavant/bdapi/Displays.java Stores display backend services and configuration.
src/main/java/fr/redsavant/bdapi/DisplayCrate.java Exposes backend-independent display operations.
src/main/java/fr/redsavant/bdapi/display/PaperDisplayHandle.java Implements Paper displays.
src/main/java/fr/redsavant/bdapi/display/PacketDisplayHandle.java Implements client-side displays.
src/main/java/fr/redsavant/bdapi/display/DisplayHandle.java Defines the display handle contract.
src/main/java/fr/redsavant/bdapi/display/DisplayBackend.java Defines supported backends.
src/main/java/fr/redsavant/bdapi/display/Anchor.java Defines transform anchors.
src/main/java/fr/redsavant/bdapi/builder/BlockDisplayBuilder.java Adds backend, viewer, and anchor configuration.
src/main/java/fr/redsavant/bdapi/BDApiConfig.java Adds backend configuration.
src/main/java/fr/redsavant/bdapi/BDApi.java Initializes backend services and listeners.
src/main/java/fr/redsavant/bdapi/animation/AnimationBuilder.java Builds backend-independent animations.
README.md Documents backends and usage.
docs/markdown-examples.html Adds generated documentation examples.
docs/mark.svg Adds documentation branding.
docs/hashmap.json Adds generated page hashes.
docs/assets/markdown-examples.md.BCG_9Bgl.lean.js Adds generated documentation assets.
docs/assets/markdown-examples.md.BCG_9Bgl.js Adds generated documentation assets.
docs/assets/index.md.BkF2v_em.lean.js Adds generated index assets.
docs/assets/en_index.md.DqtUWZmL.lean.js Adds generated English index assets.
docs/assets/chunks/VPLocalSearchBox.Curd1UgX.js Adds generated search assets.
docs/assets/chunks/metadata.e00ad133.js Adds generated site metadata.
docs/assets/chunks/@localSearchIndexroot.B-XFEoKZ.js Adds the root search index.
docs/assets/chunks/@localSearchIndexen.DkdoG2EJ.js Adds the English search index.
docs/assets/app.BRDBJunw.js Adds generated documentation app assets.
docs/assets/api-examples.md.DBzYl0HB.lean.js Adds generated API documentation assets.
docs/assets/api-examples.md.DBzYl0HB.js Adds generated API documentation assets.
docs/api-examples.html Adds generated API documentation.
docs/404.html Adds a custom documentation 404 page.
build.gradle.kts Updates version and dependencies.
.gitignore Ignores additional IDE files.
Review details

Files not reviewed (12)

  • docs/assets/api-examples.md.DBzYl0HB.js: Generated file
  • docs/assets/api-examples.md.DBzYl0HB.lean.js: Generated file
  • docs/assets/app.BRDBJunw.js: Generated file
  • docs/assets/chunks/@localSearchIndexen.DkdoG2EJ.js: Generated file
  • docs/assets/chunks/@localSearchIndexroot.B-XFEoKZ.js: Generated file
  • docs/assets/chunks/VPLocalSearchBox.Curd1UgX.js: Generated file
  • docs/assets/chunks/metadata.e00ad133.js: Generated file
  • docs/assets/chunks/theme.8kX2sHLp.js: Generated file
  • docs/assets/en_index.md.DqtUWZmL.js: Generated file
  • docs/assets/en_index.md.DqtUWZmL.lean.js: Generated file
  • docs/assets/index.md.BkF2v_em.js: Generated file
  • docs/assets/index.md.BkF2v_em.lean.js: Generated file

Suppressed comments (8)

docs/en/index.html:26

  • The published English documentation still renders fr.redsavant:bdapi:1.0.0-beta.1, while this PR updates the README and project version to 1.1.0-beta.1. Users following the documentation site will copy a stale dependency; regenerate the site output from the updated documentation source.
    docs/index.html:26
  • The published French documentation still renders fr.redsavant:bdapi:1.0.0-beta.1, while this PR updates the README and project version to 1.1.0-beta.1. Users following the documentation site will copy a stale dependency; regenerate the site output from the updated documentation source.
    src/main/java/fr/redsavant/bdapi/builder/BlockDisplayBuilder.java:230
  • Global packet entities are sent to every online player without checking location.getWorld(). Spawn packets do not carry a dimension, so a viewer in another world can render this fake display at the same coordinates in their current world, unlike a Paper entity. Limit the initial send to viewers in the display's world and resynchronize when viewers change worlds.
    src/main/java/fr/redsavant/bdapi/builder/BlockDisplayBuilder.java:226
  • The packet handle receives only the material and transformation here, so the existing builder options for brightness, billboard, view range, and shadow are silently ignored by the PACKET_EVENTS backend; those same options are applied in configure() for Paper. Encode the corresponding metadata or explicitly reject/document these options as unsupported for packet displays.
    src/main/java/fr/redsavant/bdapi/internal/Animator.java:103
  • This applies interpolated raw transformation values without reapplying the display's Anchor. A default CENTER display starts with compensated translation, so scaleTo or rotateTo interpolates to an uncompensated endpoint and its visual center drifts, contrary to the documented anchor behavior. Carry the anchor into animations and compute compensation for each interpolated scale/rotation.
    src/main/java/fr/redsavant/bdapi/packet/PacketDisplayMetadataCodec.java:50
  • Every metadata update performs a fresh Bukkit block-data conversion here, even when only a transform changed. Animations invoke metadata updates every tick for each viewer, so this repeated conversion scales with displays × viewers × ticks unnecessarily. Cache the block-state ID or send block-state metadata only on spawn/material changes.
    src/main/java/fr/redsavant/bdapi/packet/PacketEventsDisplaySender.java:43
  • EntityTeleport carries coordinates but no dimension. If an animation or direct teleport moves a packet display to a different World, this still sends the same-world teleport packet, leaving the fake entity in the wrong client world; reject cross-world moves or destroy and respawn the display for each viewer when the world changes.
    test-plugin/src/main/resources/plugin.yml:8
  • The new packet test commands rely on PacketEvents being initialized before Main.onEnable, but this plugin descriptor does not declare a softdepend/load-order entry for it. If PacketEvents loads afterward, BDApi.init caches no sender and /bdtest packet and /bdtest packetprivate remain unavailable; declare the optional dependency or defer backend initialization.
  • Files reviewed: 42/75 changed files
  • Comments generated: 8
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/main/java/fr/redsavant/bdapi/packet/PacketDisplayMetadataCodec.java Outdated
Comment on lines +40 to +42
if (packetSender != null) {
plugin.getServer().getPluginManager().registerEvents(new PacketDisplayListener(registry), plugin);
}
Comment on lines +49 to +50
if (PacketBackendSupport.available()) {
return PacketBackendSupport.createSender();
@@ -90,8 +90,8 @@ public void play() {
Transformation endTransform = new Transformation(endTranslation, endRotation, endScale, new Quaternionf());
Comment on lines +25 to +29
for (DisplayCrate crate : registry.all()) {
DisplayHandle handle = crate.handle();
if (handle.global() && handle.backend() == fr.redsavant.bdapi.display.DisplayBackend.PACKET_EVENTS) {
handle.show(uuid);
}
Comment on lines +41 to +45
data.add(new EntityData<>(TRANSLATION, EntityDataTypes.VECTOR3F, new Vector3f(translation.x, translation.y, translation.z)));
data.add(new EntityData<>(SCALE, EntityDataTypes.VECTOR3F, new Vector3f(scale.x, scale.y, scale.z)));
data.add(new EntityData<>(LEFT_ROTATION, EntityDataTypes.QUATERNION, new Quaternion4f(left.x, left.y, left.z, left.w)));
data.add(new EntityData<>(RIGHT_ROTATION, EntityDataTypes.QUATERNION, new Quaternion4f(right.x, right.y, right.z, right.w)));
data.add(new EntityData<>(BLOCK_STATE, EntityDataTypes.BLOCK_STATE, blockStateId(display)));
}

public int next() {
return counter.updateAndGet(current -> current == Integer.MAX_VALUE ? base + 1 : current + 1);
Comment on lines +14 to +16
private final Vector3f translation = new Vector3f(0f, 0f, 0f);
private final Vector3f eulerRotation = new Vector3f(0f, 0f, 0f);
private Anchor anchor = Anchor.CENTER;
@RedSavant RedSavant added the enhancement New feature or request label Sep 11, 2026
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants