Schematic handling as a library
LadyCailinBot opened this issue ยท 3 comments
WORLDEDIT-3254 - Reported by trichner
It would be nice if the schematic handling (saving/loading and rotating) could be standalone. I stripped down WorldEdits implementation some time ago (https://github.com/trichner/libschem) but it would be nice if we could have one library to work on, preferably stripped from WorldEdit.
I like WorldEdits API agnostic BaseBlock/Vector and it would be cool to reuse this in a standalone schematic handling library.
Thoughts?
I would be willing to maintain such a library.
Comment by wizjany
There are a huge number of things in worldedit that are used as libraries, and it's not necessarily practical to separate all of them.
Comment by sk89q
Before v6, most of WorldEdit was not very re-usable, and things like the schematic code was just some separate part.
But starting with v6, the schematic loader merely creates generic Clipboards which themselves are generic "Extents". There is no longer any code specific to schematics to paste, because there is generic code to paste between Extents. One implementation of an Extent is the World, so a "copy" is just a transfer between the World and a Clipboard, and a "paste" is a transfer that goes the other way. There is also no longer any rotation code specific to schematics or clipboards: you can rotate any Extent because it acts as a transformation of the individual blocks, given a Transform object (of which there is Identity and Affine implementations).
So right now, splitting out the schematic code is easier in that it's much more modular, but harder because it requires bringing the whole kitchen sink to be useful. In my case, (1) separating the schematic code into a separate library and having WorldEdit "core" depend on it is not a feasible option, and (2) I definitely cannot maintain two versions of WorldEdit due to time constraints (one of them would be not maintained very well).
Note that it's possible to just shade WorldEdit into a plugin, making sure to relocate its packages, while also turning on the option that removes unused classes. In addition, WorldEdit was split into separate "core," "bukkit," and "forge" modules too.