fix: block nbt population
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.
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
Please take a moment and address the merge conflicts of your pull request. Thanks!
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.