df-mc / structure

Structure parsing and writing library for Dragonfly
4 stars 0 forks source link

Implementation of rotating structures #1

Closed TwistedAsylumMC closed 2 years ago

TwistedAsylumMC commented 3 years ago

This pull request adds a method to rotate a structure a given amount of times.

Sandertv commented 3 years ago

I personally think a RotateRight90 and RotateLeft90 method would work. These also already exist for the cube.Direction type, so we'd be able to call those respective methods to rotate those blocks.

Another thing I'm considering is that it wouldn't technically be necessary to actually change the underlying structure when rotating. We could simply change the dimensions and apply the transformation (x, z => z, x for example) in the At method. That way you don't actually have to do the extra work. We could then maybe change it only on save?

Sandertv commented 3 years ago

Although I suppose if we rotate individual blocks we'd have to actually change the underlying structure too, so nevermind that.