make MCMaterials an iterable over its own blocks

This commit is contained in:
David Vierra 2011-10-29 18:15:06 -10:00
parent b82b617f8b
commit 731390e40a

View File

@ -106,6 +106,12 @@ class MCMaterials(object):
except KeyError:
return default
def __len__(self):
return len(self.allBlocks)
def __iter__(self):
return iter(self.allBlocks)
def __getitem__(self, key):
""" Let's be magic. If we get a string, return the first block whose
name matches exactly. If we get a (id, data) pair or an id, return