Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log Sign Editing and Waxing #243

Merged

Conversation

TheDeathlyCow
Copy link
Contributor

@TheDeathlyCow TheDeathlyCow commented Mar 15, 2024

Implements #214

Adds logging for sign (and hanging sign) text editing and item-based interactions including waxing, dyeing, ink, and glow ink, with rollback support.

Editing signs mutates the block entity instance which makes it difficult to properly log for rollbacks. My solution is a bit of a hack that captures the old block entity data by copying the NBT data into a new block entity instance and then logging that copy as the old block entity. This seems to me to be the only way to do this, but I would definitely prefer something that doesn't involve direct NBT copying like this.

Currently, this does not seem to work with restoring. However, when I looked into it, restoring block entity data seems to just be a missing feature in Ledger. Perhaps another PR could implement this, or I could look into creating a new action type for sign editing. Especially for text editing, it might be nice to see something like "old text" -> "new text" in the result, similar to what happens when you wax a copper block. The sign text might be a bit long for a single line in a chat message, though.

There is also an issue where rolling back a sign does not cause it to immediately update its appearance. Its data does indeed change, and you can verify by checking with /data or by rejoining the server. I assume this is related to another issue where signs also appear blank after inspecting them with left-click. It might be fixable by sending some sort of block entity update packet to nearby players on restore, but that might incur some additional cost of iterating over all players to find the nearby ones many times (and of course, the cost of actually sending those packets).

Let me know what you think :D

@TheDeathlyCow TheDeathlyCow requested a review from a team as a code owner March 15, 2024 13:10
@TheDeathlyCow
Copy link
Contributor Author

Update: figured out a nice way to send block entity updates on rollback

@Sepera-okeq Sepera-okeq mentioned this pull request Apr 8, 2024
2 tasks
@PotatoPresident PotatoPresident merged commit 2a5ce29 into QuiltServerTools:master Apr 10, 2024
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.

None yet

2 participants