From f3ff47a445e56dd140f3c950e77cb518bc38c37b Mon Sep 17 00:00:00 2001 From: David Vierra Date: Sun, 31 Jan 2016 20:14:40 -1000 Subject: [PATCH] Implement `positions()` on SelectionBox (slow) --- src/mceditlib/selection/__init__.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/mceditlib/selection/__init__.py b/src/mceditlib/selection/__init__.py index 1ada1da..29f9d91 100644 --- a/src/mceditlib/selection/__init__.py +++ b/src/mceditlib/selection/__init__.py @@ -130,6 +130,18 @@ class SelectionBox(object): """ raise NotImplementedError + @property + def positions(self): + for cx, cz in self.chunkPositions(): + for cy in self.sectionPositions(cx, cz): + mask = self.section_mask(cx, cy, cz) + y, z, x = mask.nonzero() + x = x + (cx << 4) + y = y + (cy << 4) + z = z + (cz << 4) + for i in range(len(x)): + yield x[i], y[i], z[i] + mincx = NotImplemented mincy = NotImplemented mincz = NotImplemented