Skip to content

Commit

Permalink
Fix command generation, improve save command to file
Browse files Browse the repository at this point in the history
  • Loading branch information
xmamo committed Sep 16, 2016
1 parent bd287b8 commit a6aa32d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Structure-spawner-generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ def perform(level, box, options):
unformatted_command += ","
first_element = False
if volume(cuboid[0][0], cuboid[0][1], cuboid[0][2], cuboid[1][0], cuboid[1][1], cuboid[1][2]) == 1:
command_part += "{id:\"MinecartCommandBlock\",Command:\"setblock ~" + str(cuboid[0][0] + box.minx - execution_center[0]) + " ~" + str(cuboid[0][1] + box.miny - execution_center[1]) + " ~" + str(cuboid[0][2] + box.minz - execution_center[2]) + " minecraft:air\"}"
command_part = "{id:\"MinecartCommandBlock\",Command:\"setblock ~" + str(cuboid[0][0] + box.minx - execution_center[0]) + " ~" + str(cuboid[0][1] + box.miny - execution_center[1]) + " ~" + str(cuboid[0][2] + box.minz - execution_center[2]) + " minecraft:air\"}"
else:
command_part += "{id:\"MinecartCommandBlock\",Command:\"fill ~" + str(cuboid[0][0] + box.minx - execution_center[0]) + " ~" + str(cuboid[0][1] + box.miny - execution_center[1]) + " ~" + str(cuboid[0][2] + box.minz - execution_center[2]) + " ~" + str(cuboid[1][0] + box.minx - execution_center[0]) + " ~" + str(cuboid[1][1] + box.miny - execution_center[1]) + " ~" + str(cuboid[1][2] + box.minz - execution_center[2]) + " minecraft:air\"}"
command_part = "{id:\"MinecartCommandBlock\",Command:\"fill ~" + str(cuboid[0][0] + box.minx - execution_center[0]) + " ~" + str(cuboid[0][1] + box.miny - execution_center[1]) + " ~" + str(cuboid[0][2] + box.minz - execution_center[2]) + " ~" + str(cuboid[1][0] + box.minx - execution_center[0]) + " ~" + str(cuboid[1][1] + box.miny - execution_center[1]) + " ~" + str(cuboid[1][2] + box.minz - execution_center[2]) + " minecraft:air\"}"
command += "\n\t" + command_part
unformatted_command += command_part

Expand Down Expand Up @@ -219,7 +219,7 @@ def perform(level, box, options):

command_output = None
if save_command_to_file:
output_file = mcplatform.askSaveFile(None, "Select the text file to wich you want to save the command...", "command.txt", "txt", None)
output_file = mcplatform.askSaveFile(None, "Select the text file to wich you want to save the command...", "command.txt", "Text file (*.txt)\0*.txt\0", None)
if output_file is not None:
command_output = open(output_file, "w")

Expand Down

0 comments on commit a6aa32d

Please sign in to comment.