summaryrefslogtreecommitdiff
path: root/src/display.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/display.py')
-rw-r--r--src/display.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/display.py b/src/display.py
index ad4c48b..9cf0392 100644
--- a/src/display.py
+++ b/src/display.py
@@ -124,6 +124,8 @@ def draw(canvas, screen, need_update_world, world, mouse, loaded_chunks, zoom, o
world_display.blit(world, (0, 0))
timings['screen_display_world'] = (time.time() - tstart) * 1000
+ screen_blocks = list(sorted(screen_blocks, key=lambda k: -k[3]))
+
tstart = time.time()
if mouse[0] > -1 and mouse[1] > -1 and pygame.mouse.get_focused() and not paused and not picker:
@@ -131,8 +133,10 @@ def draw(canvas, screen, need_update_world, world, mouse, loaded_chunks, zoom, o
cursor_y = original_cursor_y = mouse[1] - 42 / 2
cursor_changed = False
- for block in screen_blocks:
- if block[0] <= mouse[0] <= block[0] + 42 and block[1] <= mouse[1] <= block[1] + 42:
+ for i in range(len(screen_blocks)):
+ block = screen_blocks[i]
+
+ if block[0] <= mouse[0] <= block[0] + 42 and block[1] <= mouse[1] <= block[1] + 42 and block[2] != "bedrock" and block[2] != "air":
cursor_x = block[0]
cursor_y = block[1]
cursor_changed = True