Fixed: Incorrect call arguments
Inspector assumed TagProperty was instance method Classmethod should have cls as first argument, not self.
This commit is contained in:
parent
bca5e1866b
commit
55c23697df
@ -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)
|
||||
|
@ -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
|
||||
|
||||
|
@ -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. """
|
||||
|
Reference in New Issue
Block a user