Skip to content
This repository
Browse code

Fixes #10 by moving bedrock placement out of the while loop

The while loop allowed for bedrock to be overwritten so I
rewrote it putting bedrock in place before the loop begins
and adding a condition to keep it from being overwritten.
  • Loading branch information...
commit d6d29312043f95d4d7e8ab738a486317224be338 1 parent 84f3ddd
Jack Twilley authored

Showing 1 changed file with 6 additions and 6 deletions. Show diff stats Hide diff stats

  1. +6 6 terrain.py
12 terrain.py
@@ -176,15 +176,15 @@ def place(x, y, z, lcval, crustval, bathyval, doSchematics):
176 176 print "lcval value %s not found!" % lcval
177 177 (y, column, tree) = Terrain.terdict.get(lcval, Terrain.terdict[0])(x, y, z, crustval, bathyval, doSchematics)
178 178 merged = [ (depth, (block, 0)) if type(block) is not tuple else (depth, block) for (depth, block) in column ]
179   - blocks = []
180   - datas = []
181   - overstone = height(merged)
182   - core = [ (1, ('Bedrock', 0)), (y-overstone-1, ('End Stone', 0)) ] + merged
  179 + # y=0 is always bedrock
  180 + blocks = [ (0, materialNamed('Bedrock')) ]
  181 + datas = [ (0, 0) ]
  182 + core = [ ((y - height(merged)), ('End Stone', 0)) ] + merged
183 183 base = 0
184 184 while core:
185 185 (depth, (block, data)) = core.pop(0)
186   - [ blocks.append((y, materialNamed(block) if type(block) is str else block)) for y in xrange(base, base+depth) ]
187   - [ datas.append((y, data)) for y in xrange(base, base+depth) ]
  186 + [ blocks.append((y, materialNamed(block) if type(block) is str else block)) for y in xrange(base, base+depth) if y > 0 ]
  187 + [ datas.append((y, data)) for y in xrange(base, base+depth) if y > 0 ]
188 188 base += depth
189 189 return blocks, datas, tree
190 190

0 comments on commit d6d2931

Please sign in to comment.
Something went wrong with that request. Please try again.