A while ago I had presented Structurize which is an extraction + some additional features of the structure handling of Minecolonies.
But, I actually never removed the code of Minecolonies itself and use Structurize as a dependency.
This is important because this way we have less code in Minecolonies and only very Minecolonies specific code there and when we want to fix something we don't have to fix it in both repositories.
Now, the code for that won't tell you very much about what I actually did and it is also difficult to explain
We removed over 24k lines of structure handling and had to add over 320 lines only on the side of minecolonies for the compatibility.
In the Gradle dependencies, we added structurize.
And added a configuration to include it in the jar.
In the jar code, we would not include the structure source-set anymore (doesn't exist anymore) and would now include the configuration details we included.
One of the compatibility changes I had to make was overriding the right click event of the build tool (which is now a structurize item) to still open the minecolonies build tool window (which extends the structure window) which is necessary since we don't have building handling of minecolonies building in structurize.
On the side of Structurize, I added the IAnchorBlock interface.
Which minecolonies blocks can implement so that structures are centered around them.
This is important because minecolonies structures rotate around the hut chest, the hut chest is considered the center of the building and it will be placed where the player clicked.
Finally, I also added a way to port the minecolonies blocks to structurize blocks.
This way minecolonies decorative blocks which would else disappear from the world (since excluded from minecolonies) will be remapped to the structurize blocks.
https://github.com/MinecraftForge/MinecraftForge/issues/5268
https://github.com/ldtteam/Structurize/commit/4f3d1a7126ff6830f73f730e0658df8fcafe988f
https://github.com/ldtteam/Structurize/commit/4c39f5296a0038f36610ec9ac12fe48e3301c858
https://github.com/ldtteam/Structurize/commit/5fea5437258ef74751d6e8a3bef6571c0263e772
https://github.com/ldtteam/Structurize/commit/8d40dd1dcc71572a722cf80d88bdd58531c74387
https://github.com/ldtteam/Structurize/commit/0d1b4e81859b394c1489f979430dc2ff0b6972c8