PlotSquared icon indicating copy to clipboard operation
PlotSquared copied to clipboard

fix: block nbt population

Open PierreSchwang opened this issue 4 months ago • 3 comments

Overview

Fixes #4552 Fixes #4708

Description

NBT format changed in the last few versions. Now uses the native methods "provided" by minecraft to set data via the original NBT data.

Submitter Checklist

  • [x] Make sure you are opening from a topic branch (/feature/fix/docs/ branch (right side)) and not your main branch.
  • [x] Ensure that the pull request title represents the desired changelog entry.
  • [x] New public fields and methods are annotated with @since TODO.
  • [x] I read and followed the contribution guidelines.

PierreSchwang avatar Aug 24 '25 00:08 PierreSchwang

I've attempted to use the native NMS methods for loading and updating the block states, which seems to work partially. Only tested in 1.21.8 with FAWE, so there are still quite a few tests left. The only thing I've noticed is, that signs don't seem to get their lines / info set. Containers (Chests, Lecterns), Banners, Skulls work perfectly.

Performance-wise it doesn't seem too bad. It'll be slower than the previous approach ig, but based on my testing the mean duration for a tile entity update (tag conversion, loading + updating) was roughly 500μs (lowest being like 50μs, and highest 10ms). I could do some additional benchmarks with the previous logic ig. But as it does not work 100% yet and is quite untested, I've not prioritized that high yet.

EDIT: Signs don't work because the methods applying the NBT data require the SignEntity to be related to a ServerLevel, which there isn't in WorldGen / block population. Will see how I can workaround that

PierreSchwang avatar Aug 30 '25 23:08 PierreSchwang

Please take a moment and address the merge conflicts of your pull request. Thanks!

github-actions[bot] avatar Sep 19 '25 06:09 github-actions[bot]

I've tested with a few tile entities (and extensively with signs) - everything seems to work so far (except one thing on a spigot server, where some sign lines were just raw JSON - but I feel like the schematic is kinda broken). But I would appreciate further testing.

PierreSchwang avatar Oct 24 '25 20:10 PierreSchwang