|
2 | 2 | # Usage: ruby s2b.rb
|
3 | 3 | # This will convert all schematics in the sibling folder "in".
|
4 | 4 | # The results will be placed in the folder "out".
|
5 |
| -# Air and magenta colored wool is ignored. |
6 |
| -# If the file name is ending with R5 the z will use a -5 offset |
| 5 | +# We ignore air, standing sign, magentawool and (dark) blue wool. |
| 6 | +# We convert orange wool to air. |
| 7 | +# If the file name is ending with R5 the z will use a -5 offset. |
7 | 8 | #
|
8 | 9 | # See: http://www.minecraftwiki.net/wiki/Schematic_File_Format
|
9 | 10 | # https://github.com/Wickth/TerrainControll/blob/master/bo2spec.txt
|
@@ -117,12 +118,20 @@ def stringifyLine(lineArray)
|
117 | 118 | layers.each_with_index do |rows, z|
|
118 | 119 | z += zoffset
|
119 | 120 | rows.each_with_index do |columns, x|
|
120 |
| - x -= schematic["Width"] / 2 # Center the object on the X axis |
| 121 | + # Center the object on the X axis |
| 122 | + x -= schematic["Width"] / 2 |
121 | 123 | columns.each_with_index do |(block, data), y|
|
122 |
| - if block == 0 || block == 63 || (block == 35 && (data == 2 || data == 11)) then # We ignore air, standing sign, magentawool and (dark) blue wool |
| 124 | + # We ignore air, standing sign, magentawool and (dark) blue wool. |
| 125 | + if block == 0 || block == 63 || (block == 35 && (data == 2 || data == 11)) then |
123 | 126 | next
|
124 | 127 | end
|
125 |
| - y -= schematic["Length"] / 2 # Center the object on the Y axis |
| 128 | + # We convert orange wool to air. |
| 129 | + if block == 35 && data == 1 then |
| 130 | + block = 0 |
| 131 | + data = 0 |
| 132 | + end |
| 133 | + # Center the object on the Y axis |
| 134 | + y -= schematic["Length"] / 2 |
126 | 135 | line = [y, x, z, block, data]
|
127 | 136 | if NEEDY_BLOCKS.include?(block)
|
128 | 137 | deferred << line
|
|
0 commit comments