Skip to content

Commit a6aa32d

Browse files
committed
Fix command generation, improve save command to file
1 parent bd287b8 commit a6aa32d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Structure-spawner-generator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ def perform(level, box, options):
120120
unformatted_command += ","
121121
first_element = False
122122
if volume(cuboid[0][0], cuboid[0][1], cuboid[0][2], cuboid[1][0], cuboid[1][1], cuboid[1][2]) == 1:
123-
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\"}"
123+
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\"}"
124124
else:
125-
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\"}"
125+
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\"}"
126126
command += "\n\t" + command_part
127127
unformatted_command += command_part
128128

@@ -219,7 +219,7 @@ def perform(level, box, options):
219219

220220
command_output = None
221221
if save_command_to_file:
222-
output_file = mcplatform.askSaveFile(None, "Select the text file to wich you want to save the command...", "command.txt", "txt", None)
222+
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)
223223
if output_file is not None:
224224
command_output = open(output_file, "w")
225225

0 commit comments

Comments
 (0)