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.

-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)

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

Labels

None yet

2 participants