Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def importSchematic(mc,path,x0,y0,z0,centerX=False,centerY=False,centerZ=False,clear=False,movePlayer=True):
mc.postToChat("Reading "+path);
schematic = nbt.NBTFile(path, "rb")
sizeX = schematic["Width"].value
sizeY = schematic["Height"].value
sizeZ = schematic["Length"].value
def offset(x,y,z):
return x + (y*sizeZ + z)*sizeX
px,pz = x0,z0
if centerX:
x0 -= sizeX // 2
if centerY:
y0 -= sizeY // 2
if centerZ:
z0 -= sizeZ // 2
def importSchematic(mc,path,x0,y0,z0,centerX=False,centerY=False,centerZ=False,clear=False,movePlayer=True):
mc.postToChat("Reading "+path);
schematic = nbt.NBTFile(path, "rb")
sizeX = schematic["Width"].value
sizeY = schematic["Height"].value
sizeZ = schematic["Length"].value
def offset(x,y,z):
return x + (y*sizeZ + z)*sizeX
px,pz = x0,z0
if centerX:
x0 -= sizeX // 2
if centerY:
y0 -= sizeY // 2
if centerZ:
z0 -= sizeZ // 2
def getValue(v):
if isinstance(v,nbt.TAG_Compound):
return getCompound(v)
elif isinstance(v,nbt.TAG_List):
out = []
for a in v:
out.append(getValue(a))
return out
else:
return v.value
def getValue(v):
if isinstance(v,nbt.TAG_Compound):
return getCompound(v)
elif isinstance(v,nbt.TAG_List):
out = []
for a in v:
out.append(getValue(a))
return out
else:
return v.value
def getValue(v):
if isinstance(v,nbt.TAG_Compound):
return getCompound(v)
elif isinstance(v,nbt.TAG_List):
out = []
for a in v:
out.append(getValue(a))
return out
else:
return v.value