valence icon indicating copy to clipboard operation
valence copied to clipboard

Support for schematics file format

Open MrlnHi opened this issue 1 year ago • 8 comments

Description

  • Added auxiliary crate valence_schem that supports copying and pasting schematics to an Instance and also allows for parsing them from a Compound and serializing it back to one

Test Plan

The examples schem_loading and schem_saving are sufficient for testing. Also, as for a third party created schematic, I used SimpleSpongeSchematics to do so.

To test, either: try the example schematic by running cargo r --example schem_loading -- assets/example_schem.schem

OR:

  1. Create a Schematic file using the sponge mod above
  2. Start the schem_loading with the path of your schematic, like so: cargo r --example schem_loading -- "my/path/to/something_cool.schem"

Related

Closes #193

MrlnHi avatar Mar 02 '23 17:03 MrlnHi

I think would be good to have an example schematic in valence/assets directory.

qualterz avatar Mar 02 '23 17:03 qualterz

I think would be good to have an example schematic in valence/assets directory.

I agree 👍. Will do once I get back at it

MrlnHi avatar Mar 02 '23 19:03 MrlnHi

Question: do we want to support all spec versions? (1-3) I don't think we should for serialization, but for deserialization probably. The deserialization would then check the version and act accordingly. So basically by deserializing an older schematic and serializing it again, we would upgrade it to version 3. I don't think we should support DataVersion (meaning knowing how to handle 1.8 schematics with blocks like minecraft:planks) but probably the Version property. What do you think?

MrlnHi avatar Mar 03 '23 05:03 MrlnHi

I don't think we should support DataVersion (meaning knowing how to handle 1.8 schematics with blocks like minecraft:planks) but probably the Version property. What do you think?

That seems like the most reasonable thing to do now.

rj00a avatar Mar 04 '23 11:03 rj00a

@rj00a ready for review

MrlnHi avatar Apr 23 '23 10:04 MrlnHi

Currently working on a redesign of the Instance API to fix a number of issues. Once that's mostly finished I can take a closer look at this and see what impact it has.

rj00a avatar Apr 28 '23 10:04 rj00a

I've (finally) finished the redesign in #402, so we can move forward with this.

rj00a avatar Jul 01 '23 23:07 rj00a

I've (finally) finished the redesign in #402, so we can move forward with this.

Ok, I updated the branch to main

MrlnHi avatar Jul 29 '23 22:07 MrlnHi