0

unknown blocks are no longer assumed to be transparent

This commit is contained in:
Aaron Griffith
2011-11-10 09:51:25 -05:00
parent 74e0ef2ad6
commit dc0110ee73
2 changed files with 11 additions and 1 deletions

View File

@@ -20,6 +20,7 @@
static PyObject *textures = NULL;
static PyObject *chunk_mod = NULL;
static PyObject *blockmap = NULL;
static PyObject *known_blocks = NULL;
static PyObject *transparent_blocks = NULL;
PyObject *init_chunk_render(PyObject *self, PyObject *args) {
@@ -45,6 +46,9 @@ PyObject *init_chunk_render(PyObject *self, PyObject *args) {
blockmap = PyObject_GetAttrString(textures, "blockmap");
if (!blockmap)
return NULL;
known_blocks = PyObject_GetAttrString(textures, "known_blocks");
if (!known_blocks)
return NULL;
transparent_blocks = PyObject_GetAttrString(textures, "transparent_blocks");
if (!transparent_blocks)
return NULL;
@@ -56,6 +60,10 @@ int
is_transparent(unsigned char b) {
PyObject *block = PyInt_FromLong(b);
int ret = PySequence_Contains(transparent_blocks, block);
if (!ret)
{
ret = !(PySequence_Contains(known_blocks, block));
}
Py_DECREF(block);
return ret;