Skip to content

new legacy hologram#53

Open
InstantlyMoist wants to merge 1 commit intoTofaa2:masterfrom
InstantlyMoist:fix/legacy-hologram
Open

new legacy hologram#53
InstantlyMoist wants to merge 1 commit intoTofaa2:masterfrom
InstantlyMoist:fix/legacy-hologram

Conversation

@InstantlyMoist
Copy link
Copy Markdown
Contributor

@InstantlyMoist InstantlyMoist commented Apr 15, 2026

rewritten it to not depend on passenger stuff

Summary by CodeRabbit

  • Bug Fixes

    • Hologram marker states now correctly propagate to all entities and trigger position updates.
    • Teleportation positioning improved with consistent offset calculations and proper line ordering.
    • Line removal now properly maintains hologram alignment when spawned.
    • Hologram grouping behavior made more reliable.
  • Performance

    • Hologram line updates optimized with faster in-bounds modification handling.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 15, 2026

📝 Walkthrough

Walkthrough

The LegacyHologram class receives updates to marker state propagation, teleportation positioning logic, and line management. Changes include revised iteration order in teleport operations, addition of a fast path for in-bounds line updates, conditional re-teleportation behaviors, simplified passenger assignment, and adjusted offset constants.

Changes

Cohort / File(s) Summary
Hologram Logic Updates
api/src/main/java/me/tofaa/entitylib/wrapper/hologram/LegacyHologram.java
Modified setMarker to propagate flag to existing entities and re-teleport when spawned; updated teleport to iterate forward with per-line Y offset calculations; added fast-path optimization in setLine for in-bounds updates; added conditional re-teleport to removeLine; simplified setParent to add only first line as passenger; adjusted lineOffset and markerOffset constants; removed unused import.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 Hologram lines now dance with grace,
Teleporting through time and space,
Markers propagate with care,
While offsets float through the air,
A rabbit's code, precisely placed!

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'new legacy hologram' is vague and generic; it does not clearly indicate that this is a refactor to remove passenger/riding mechanics dependency. Use a more descriptive title that captures the key change, such as 'Rewrite legacy hologram to remove riding mechanics dependency' or similar.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@api/src/main/java/me/tofaa/entitylib/wrapper/hologram/LegacyHologram.java`:
- Around line 234-240: LegacyHologram.setParent currently only attaches
lines.get(0) and does not store the parent, causing other lines to stop
following after show()/setLine()/removeLine(); change LegacyHologram to persist
the parent reference (e.g., a private WrapperEntity parent field) when
setParent(WrapperEntity) is called, attach the whole passenger chain similarly
to ModernHologram.setParent (rebind all existing lines to follow the parent, not
just lines.get(0)), and ensure show(), setLine(), and removeLine() reapply the
follow/attach logic from the stored parent so updates maintain the binding for
all lines.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f79638c0-036a-440a-8ff9-ed8ac7e128bc

📥 Commits

Reviewing files that changed from the base of the PR and between 35ea12d and 9dfa0a7.

📒 Files selected for processing (1)
  • api/src/main/java/me/tofaa/entitylib/wrapper/hologram/LegacyHologram.java

Comment on lines 234 to 240
public void setParent(@NotNull WrapperEntity parent) {
if (lines.isEmpty()) return;

WrapperEntity first = lines.get(0);
for (WrapperEntity e : lines) {
if (e.getUuid().equals(first.getUuid())) continue;
try {
first.addPassenger(e);
} catch (Exception ignored) {}
}
if (!first.getUuid().equals(parent.getUuid())) {
try {
parent.addPassenger(first);
} catch (Exception ignored) {}
parent.addPassenger(first);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Parent-following regresses to a single line.

setParent() now attaches only lines.get(0) and does not retain the parent anywhere. Compared with ModernHologram.setParent() in api/src/main/java/me/tofaa/entitylib/wrapper/hologram/ModernHologram.java:72-87, the rest of the hologram is never rebound after show(), setLine(), or removeLine(). If the parent moves, or the first line is replaced/removed, the remaining lines can be left behind. Please persist the parent and reapply whatever follow mechanism replaces the old passenger chain after structural updates.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@api/src/main/java/me/tofaa/entitylib/wrapper/hologram/LegacyHologram.java`
around lines 234 - 240, LegacyHologram.setParent currently only attaches
lines.get(0) and does not store the parent, causing other lines to stop
following after show()/setLine()/removeLine(); change LegacyHologram to persist
the parent reference (e.g., a private WrapperEntity parent field) when
setParent(WrapperEntity) is called, attach the whole passenger chain similarly
to ModernHologram.setParent (rebind all existing lines to follow the parent, not
just lines.get(0)), and ensure show(), setLine(), and removeLine() reapply the
follow/attach logic from the stored parent so updates maintain the binding for
all lines.

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