AstralSorcery icon indicating copy to clipboard operation
AstralSorcery copied to clipboard

LinkableTileEntity loses its links when used in Structure Blocks

Open MaxNeedsSnacks opened this issue 3 years ago • 0 comments

As part of a current project, I would like to be able to copy-paste structures that contain various modded constructs, including a simple example of what Astral Sorcery is capable of:

image

As you can see, the linked block positions stored in the relevant block entities are absolute, which causes those lenses to break and not point to where they are supposed to after being placed in the world again at a different position.

I tried to circumvent this issue by manually fixing the NBT data of the BE with StructureProcessors (in short: I take the offset of the new structure's root position and the original structure's position and update the linked and occupiedConnections tag with the correct values), however, this only allows me to preprocess the NBT data before the actual block entity is being (re)created, and while the updated NBT data is correct, the actual links still don't appear to be working until I manually relink them, probably because tryLinkBlock isn't being called when these are getting placed in the world again

Would it theoretically be possible to introduce some mechanism to allow Linkable BEs to re-read their links from their NBT data the next time they tick, maybe similar to the needsNetworkSync tag that already exists?

MaxNeedsSnacks avatar Mar 18 '21 16:03 MaxNeedsSnacks