From ad358fa7fdb08f890b532a71239254f188f5964d Mon Sep 17 00:00:00 2001 From: Aaron Griffith Date: Fri, 15 Apr 2011 21:44:59 -0400 Subject: [PATCH] fixed spawn mode for chunk tops --- src/rendermode-spawn.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/rendermode-spawn.c b/src/rendermode-spawn.c index ebbdc25..0d5138e 100644 --- a/src/rendermode-spawn.c +++ b/src/rendermode-spawn.c @@ -23,6 +23,7 @@ static void get_color(void *data, RenderState *state, RenderModeSpawn* self = (RenderModeSpawn *)data; int x = state->x, y = state->y, z = state->z; + int z_light = z + 1; unsigned char blocklight, skylight; PyObject *block_py; @@ -34,10 +35,6 @@ static void get_color(void *data, RenderState *state, /* default to no overlay, until told otherwise */ *a = 0; - /* if we're at the top, skip */ - if (z == 127) - return; - block_py = PyInt_FromLong(state->block); if (PySequence_Contains(self->nospawn_blocks, block_py)) { /* nothing can spawn on this */ @@ -46,8 +43,12 @@ static void get_color(void *data, RenderState *state, } Py_DECREF(block_py); - blocklight = getArrayByte3D(self->blocklight, x, y, z+1); - skylight = getArrayByte3D(self->skylight, x, y, z+1); + /* if we're at the top, use the top-most light instead */ + if (z_light == 128) + z_light--; + + blocklight = getArrayByte3D(self->blocklight, x, y, z_light); + skylight = getArrayByte3D(self->skylight, x, y, z_light); if (MAX(blocklight, skylight) <= 7) { /* hostile mobs spawn in daylight */