Fixed: Incorrect call arguments

Inspector assumed TagProperty was instance method
Classmethod should have cls as first argument, not self.
This commit is contained in:
David Vierra 2012-10-26 14:07:49 -10:00
parent bca5e1866b
commit 55c23697df
3 changed files with 11 additions and 11 deletions

View File

@ -1027,7 +1027,16 @@ class ChunkedLevelMixin(MCLevel):
for ch in startingDirtyChunks:
ch.needsLighting = False
def TagProperty(tagName, tagType, defaultValueFunc=lambda self: None):
def getter(self):
if tagName not in self.root_tag["Data"]:
self.root_tag["Data"][tagName] = tagType(defaultValueFunc(self))
return self.root_tag["Data"][tagName].value
def setter(self, val):
self.root_tag["Data"][tagName] = tagType(value=val)
return property(getter, setter)
class MCInfdevOldLevel(ChunkedLevelMixin, EntityLevel):
materials = alphaMaterials
@ -1082,16 +1091,7 @@ class MCInfdevOldLevel(ChunkedLevelMixin, EntityLevel):
def __str__(self):
return "MCInfdevOldLevel(\"" + os.path.split(self.worldDir)[1] + "\")"
def TagProperty(tagName, tagType, defaultValueFunc=lambda self: None):
def getter(self):
if tagName not in self.root_tag["Data"]:
self.root_tag["Data"][tagName] = tagType(defaultValueFunc(self))
return self.root_tag["Data"][tagName].value
def setter(self, val):
self.root_tag["Data"][tagName] = tagType(value=val)
return property(getter, setter)
SizeOnDisk = TagProperty('SizeOnDisk', nbt.TAG_Long)
RandomSeed = TagProperty('RandomSeed', nbt.TAG_Long)

View File

@ -65,7 +65,7 @@ def directory_clone(src):
@contextlib.contextmanager
def unzipped_content(src):
with temporary_directory() as dest:
f = zipfile.ZipFile.open(src)
f = zipfile.ZipFile(src)
f.extractall(dest)
yield dest

View File

@ -299,7 +299,7 @@ class MCSchematic (EntityLevel):
return self.Data[x, z, y]
@classmethod
def chestWithItemID(self, itemID, count=64, damage=0):
def chestWithItemID(cls, itemID, count=64, damage=0):
""" Creates a chest with a stack of 'itemID' in each slot.
Optionally specify the count of items in each stack. Pass a negative
value for damage to create unnaturally sturdy tools. """