From 553401cc031d2d073f33008129ada4faf1eb2582 Mon Sep 17 00:00:00 2001 From: RaindropsSys Date: Mon, 4 Sep 2023 16:05:23 +0200 Subject: Updated 3 files (automated) --- src/display.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/display.py') 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 -- cgit