make MCMaterials an iterable over its own blocks
This commit is contained in:
parent
b82b617f8b
commit
731390e40a
@ -106,6 +106,12 @@ class MCMaterials(object):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return default
|
return default
|
||||||
|
|
||||||
|
def __len__(self):
|
||||||
|
return len(self.allBlocks)
|
||||||
|
|
||||||
|
def __iter__(self):
|
||||||
|
return iter(self.allBlocks)
|
||||||
|
|
||||||
def __getitem__(self, key):
|
def __getitem__(self, key):
|
||||||
""" Let's be magic. If we get a string, return the first block whose
|
""" 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
|
name matches exactly. If we get a (id, data) pair or an id, return
|
||||||
|
Reference in New Issue
Block a user