unknown blocks are no longer assumed to be transparent
This commit is contained in:
@@ -20,6 +20,7 @@
|
|||||||
static PyObject *textures = NULL;
|
static PyObject *textures = NULL;
|
||||||
static PyObject *chunk_mod = NULL;
|
static PyObject *chunk_mod = NULL;
|
||||||
static PyObject *blockmap = NULL;
|
static PyObject *blockmap = NULL;
|
||||||
|
static PyObject *known_blocks = NULL;
|
||||||
static PyObject *transparent_blocks = NULL;
|
static PyObject *transparent_blocks = NULL;
|
||||||
|
|
||||||
PyObject *init_chunk_render(PyObject *self, PyObject *args) {
|
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");
|
blockmap = PyObject_GetAttrString(textures, "blockmap");
|
||||||
if (!blockmap)
|
if (!blockmap)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
known_blocks = PyObject_GetAttrString(textures, "known_blocks");
|
||||||
|
if (!known_blocks)
|
||||||
|
return NULL;
|
||||||
transparent_blocks = PyObject_GetAttrString(textures, "transparent_blocks");
|
transparent_blocks = PyObject_GetAttrString(textures, "transparent_blocks");
|
||||||
if (!transparent_blocks)
|
if (!transparent_blocks)
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -56,6 +60,10 @@ int
|
|||||||
is_transparent(unsigned char b) {
|
is_transparent(unsigned char b) {
|
||||||
PyObject *block = PyInt_FromLong(b);
|
PyObject *block = PyInt_FromLong(b);
|
||||||
int ret = PySequence_Contains(transparent_blocks, block);
|
int ret = PySequence_Contains(transparent_blocks, block);
|
||||||
|
if (!ret)
|
||||||
|
{
|
||||||
|
ret = !(PySequence_Contains(known_blocks, block));
|
||||||
|
}
|
||||||
Py_DECREF(block);
|
Py_DECREF(block);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|||||||
@@ -546,7 +546,8 @@ blockmap_generators = {}
|
|||||||
blockmap = {}
|
blockmap = {}
|
||||||
biome_grass_texture = None
|
biome_grass_texture = None
|
||||||
|
|
||||||
transparent_blocks = set([0,])
|
known_blocks = set()
|
||||||
|
transparent_blocks = set()
|
||||||
solid_blocks = set()
|
solid_blocks = set()
|
||||||
fluid_blocks = set()
|
fluid_blocks = set()
|
||||||
nospawn_blocks = set()
|
nospawn_blocks = set()
|
||||||
@@ -579,6 +580,7 @@ def material(blockid=[], data=[0], **kwargs):
|
|||||||
|
|
||||||
for block in blockid:
|
for block in blockid:
|
||||||
# set the property sets appropriately
|
# set the property sets appropriately
|
||||||
|
known_blocks.update([block])
|
||||||
for prop in properties:
|
for prop in properties:
|
||||||
try:
|
try:
|
||||||
if block in kwargs.get(prop, []):
|
if block in kwargs.get(prop, []):
|
||||||
|
|||||||
Reference in New Issue
Block a user