Multiblock Structures

Hello, I am working on a plugin that requires the use of multiblock structures. Is there any efficient way to do this with the Sponge API, or do I have to check if the structure is valid every time a block is placed?

The Schematic API is a work in progress that will likely make this much easier. But either way you will have to check each time blocks are placed.

This is how Minecraft does it AFAIK for structures such as nether portals.

Just check if the block they are placing is a part of your structure, and then check if the rest of the structure exists. In 99% of cases this will be false pretty much by the second block check so it shouldn’t be too taxing if you design it right.

Alright, that was my initial plan, but just wanted to check if anyone knew of a better way. Thanks!

If you are doing rotations / translations you could use guava’s caches in order to speed things up, this is what minecraft vanilla currently does for the wither detection, (albeit buggy last I checked)

I was thinking of trying to optimize it further / create a multiblock library plugin for sponge where you could register multiblock structures and be alerted when they were constructed, But I shelved that whilst working on other things because I was having difficulty writing a blockpredicate parser / blockarchetype like class.

I believe ActionControl has implemented something similar to the spec I was prototyping on the forums, but I didn’t get a great response when talking about it.