How does schematic applying work?

I’m applying a schematic at a location, but it’s actually pasting a couple blocks north east and higher than the location I give it.

I did some measurements.
The schematic applies 7 blocks too high, and the schematic is 7 blocks tall.
It also applies with the corner being at 1,1, but I want the center to be at 0,0.

So, I don’t know if I’m supposed to do all this math when pasting, but is there any way to get the dimensions of a schematic, so I can adjust the paste location?

Then applying a schematic the origin of the schematic is aligned with the position that you apply the schematic at. Can you post the code you’re using to create the schematic? its likely that there is a missing negative where the origin is concerned.

After I did some measuring, I found all my schematics were placing 2 blocks south (east or west can’t remember) so I tinkered with the math to fix that. I just move them two blocks over then divide them by the highest and lowest x and z to center them.
And they placed two times higher than the height of the schematic, so the y is subtracted by two times the height.

public void pasteSchematic(final Schematic schematic, final Location<World> loc, final Player player) { // Sponge likes to place the schem in some random ass place. This might fix it. double xWidth = schematic.getBlockMax().getX() - schematic.getBlockMin().getX(); double height = schematic.getBlockMax().getY() - schematic.getBlockMin().getY(); double zWidth = schematic.getBlockMax().getZ() - schematic.getBlockMin().getZ(); Location<World> newLoc = new Location<World>(loc.getExtent(), loc.getX() - (xWidth / 2) - 2, loc.getY() - (height * 2) - 2, loc.getZ() - (zWidth / 2) - 2); schematic.apply(newLoc, BlockChangeFlag.NONE, Cause.of(NamedCause.of("plugin", this.pluginContainer))); }

I’ve tried this on multiple schematics and not they’re placing in the perfect spots.
Weird…but I’m glad it works