def restore(vehicle,name,pos): directory = os.path.join(os.path.dirname(sys.argv[0]),"vehicles") if name and name != '-': path = os.path.join(directory,name+".py") else: path = getLoadPath('vehicles', 'py') if not path: mc.postToChat('Canceled') return vehicle.load(path) mc.postToChat('Loaded from '+path) minX = min(x for (x,y,z) in vehicle.baseVehicle) minY = min(y for (x,y,z) in vehicle.baseVehicle) minZ = min(z for (x,y,z) in vehicle.baseVehicle) maxX = max(x for (x,y,z) in vehicle.baseVehicle) maxY = max(y for (x,y,z) in vehicle.baseVehicle) maxZ = max(z for (x,y,z) in vehicle.baseVehicle) mc.postToChat('Erasing') mc.setBlocks(pos.x+minX,pos.y+minY,pos.z+minZ,pos.x+maxX,pos.y+maxY,pos.z+maxZ,AIR) mc.postToChat('Drawing') vehicle.draw(pos.x,pos.y,pos.z,vehicle.baseAngle) mc.postToChat('Done')
def restore(vehicle, name, pos): directory = os.path.join(os.path.dirname(sys.argv[0]), "vehicles") if name and name != '-': path = os.path.join(directory, name + ".py") else: path = getLoadPath('vehicles', 'py') if not path: mc.postToChat('Canceled') return vehicle.load(path) mc.postToChat('Loaded from ' + path) minX = min(x for (x, y, z) in vehicle.baseVehicle) minY = min(y for (x, y, z) in vehicle.baseVehicle) minZ = min(z for (x, y, z) in vehicle.baseVehicle) maxX = max(x for (x, y, z) in vehicle.baseVehicle) maxY = max(y for (x, y, z) in vehicle.baseVehicle) maxZ = max(z for (x, y, z) in vehicle.baseVehicle) mc.postToChat('Erasing') mc.setBlocks(pos.x + minX, pos.y + minY, pos.z + minZ, pos.x + maxX, pos.y + maxY, pos.z + maxZ, block.AIR) mc.postToChat('Drawing') vehicle.draw(pos.x, pos.y, pos.z, vehicle.baseAngle) mc.postToChat('Done')
schematic.tags.append( nbt.TAG_List(name="TileEntities", type=nbt.TAG_Compound)) return schematic def vehicleToSchematic(vehiclePath, schematicPath): angle, highWater, vehicle = load(vehiclePath) nbt = toSchematic(vehicle) nbt.write_file(schematicPath) if __name__ == '__main__': directory = os.path.join(os.path.dirname(sys.argv[0]), "vehicles") if len(sys.argv) >= 2: if sys.argv[1].endswith(".py"): name = directory + "/" + sys.argv[1] else: name = directory + "/" + sys.argv[1] + ".py" else: name = getLoadPath(directory, "py") out = name if out.endswith(".py"): out = name[:-2] + "schematic" else: out += ".schematic" vehicleToSchematic(name, out)
data.value = metas schematic.tags.append(data) schematic.tags.append(nbt.TAG_List(name="Entities", type=nbt.TAG_Compound)) schematic.tags.append(nbt.TAG_List(name="TileEntities", type=nbt.TAG_Compound)) return schematic def vehicleToSchematic(vehiclePath, schematicPath): angle,highWater,vehicle = load(vehiclePath) nbt = toSchematic(vehicle) nbt.write_file(schematicPath) if __name__ == '__main__': directory = os.path.join(os.path.dirname(sys.argv[0]),"vehicles") if len(sys.argv) >= 2: if sys.argv[1].endswith(".py"): name = directory + "/" + sys.argv[1] else: name = directory + "/" + sys.argv[1] + ".py" else: name = getLoadPath(directory, "py") out = name if out.endswith(".py"): out = name[:-2] + "schematic" else: out += ".schematic" vehicleToSchematic(name, out)