-
-
Notifications
You must be signed in to change notification settings - Fork 93
Fix axiom schematics crashing the plot #208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
At some point we should also handle cases where those fields don't exist at all. The Sponge Schematic Specification actually specifies |
StackDoubleFlow
left a comment
There was a problem hiding this 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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), | ||
| ) | ||
| } |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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)
… property for sponge version 2
…set, and remove inaccurate Axiom comment also makes the project rust 2024 to make use of new `if let` syntax
f95ba20 to
c358e03
Compare
|
I accidentally clicked request review, don't merge this until I have done tests. |
|
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 |
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.