From bcbf61f82c501291bbfc359d3b2776fcc1874c69 Mon Sep 17 00:00:00 2001 From: David Vierra Date: Mon, 28 Sep 2015 21:02:54 -1000 Subject: [PATCH] Fix logic for deciding if a cell needs a light update. When a light-emitting block is replaced with one that emits less light, and the light drawn into the block from neighbors is greater than the light emitted by the new block, the drawn light should be considered the new light rather than the block's brightness. --- src/mceditlib/relight/with_cython.pyx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mceditlib/relight/with_cython.pyx b/src/mceditlib/relight/with_cython.pyx index dbcefc0..a72e732 100644 --- a/src/mceditlib/relight/with_cython.pyx +++ b/src/mceditlib/relight/with_cython.pyx @@ -422,11 +422,12 @@ def updateLightsInSelection(dim, selection): cdef void updateLights(RelightCtx ctx, int x, int y, int z): cdef char previousLight = ctx.getBlockLight(x, y, z) - cdef char light = ctx.getBlockBrightness(x, y, z) - ctx.setBlockLight(x, y, z, light) + cdef char light + ctx.setBlockLight(x, y, z, ctx.getBlockBrightness(x, y, z)) # should be able to often skip this if we can get block's previous opacity in here... bluh drawLight(ctx, x, y, z) + light = ctx.getBlockLight(x, y, z) if previousLight < light: spreadLight(ctx, x, y, z)