Skip to content

Conversation

@BramOtte
Copy link
Contributor

For some reason Axiom uses the version 3 format for the offset but specifies version 2, thus trying to load in a schematic generated by the Axiom mod would crash the plot.

This fixes that by also checking for the Offset property for sponge version 2.

@StackDoubleFlow
Copy link
Member

At some point we should also handle cases where those fields don't exist at all. The Sponge Schematic Specification actually specifies Offset to be an optional field with a default of [0, 0, 0]. Also, generally speaking, schematic loading should never crash the plot.

Copy link
Member

@StackDoubleFlow StackDoubleFlow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this

-nbt_as!(metadata["WEOffsetY"], Value::Int),
-nbt_as!(metadata["WEOffsetZ"], Value::Int),
)
// Axiom stores the offset like version 3 but specifies version 2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, Axiom is correct to specificy Offset this way according to the version 2 spec. WorldEdit actually deviates from the spec here, and we were using WorldEdit as the source of truth before. Could you change the comment to not mention Axiom here? I don't want to throw them under the bus for something that isn't their problem.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this comment to instead refer to the fact that this is something worldedit specific and that the order of checks matter.
I found out some worldedit generated schematics can have both WEOffset and Offset I think WEOffset is the correct one here but I do wonder why both can be present.

-nbt_as!(metadata["WEOffsetY"], Value::Int),
-nbt_as!(metadata["WEOffsetZ"], Value::Int),
)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While you're here, could you use if let to check for "Metadata" as well, and then add an else case that just returns (0, 0, 0)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code now checks if one is present for WEOffset and asserts the rest
If neither WEOffset nor Offset are present the default is now (0, 0, 0)

…set, and remove inaccurate Axiom comment

also makes the project rust 2024 to make use of new `if let` syntax
@BramOtte BramOtte force-pushed the axiom-schematics-offset branch from f95ba20 to c358e03 Compare December 29, 2025 14:35
@BramOtte
Copy link
Contributor Author

I accidentally clicked request review, don't merge this until I have done tests.

@BramOtte
Copy link
Contributor Author

BramOtte commented Dec 29, 2025

I have done some rudimentary tests, loading in mpu7, mpu8, iris (various ages of worldedit schematics) and a simple Axiom schematic all seem to load correctly now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants