overviewer no longer trusts ancillary data from blocks that should have none
This commit is contained in:
@@ -30,6 +30,7 @@ static PyObject *transparent_blocks = NULL;
|
||||
static PyObject *solid_blocks = NULL;
|
||||
static PyObject *fluid_blocks = NULL;
|
||||
static PyObject *nospawn_blocks = NULL;
|
||||
static PyObject *nodata_blocks = NULL;
|
||||
|
||||
PyObject *init_chunk_render(PyObject *self, PyObject *args) {
|
||||
|
||||
@@ -86,6 +87,9 @@ PyObject *init_chunk_render(PyObject *self, PyObject *args) {
|
||||
nospawn_blocks = PyObject_GetAttrString(textures, "nospawn_blocks");
|
||||
if (!nospawn_blocks)
|
||||
return NULL;
|
||||
nodata_blocks = PyObject_GetAttrString(textures, "nodata_blocks");
|
||||
if (!nodata_blocks)
|
||||
return NULL;
|
||||
|
||||
block_properties = calloc(max_blockid, sizeof(unsigned char));
|
||||
for (i = 0; i < max_blockid; i++) {
|
||||
@@ -101,6 +105,8 @@ PyObject *init_chunk_render(PyObject *self, PyObject *args) {
|
||||
block_properties[i] |= 1 << FLUID;
|
||||
if (PySequence_Contains(nospawn_blocks, block))
|
||||
block_properties[i] |= 1 << NOSPAWN;
|
||||
if (PySequence_Contains(nodata_blocks, block))
|
||||
block_properties[i] |= 1 << NODATA;
|
||||
|
||||
Py_DECREF(block);
|
||||
}
|
||||
@@ -443,22 +449,30 @@ chunk_render(PyObject *self, PyObject *args) {
|
||||
}
|
||||
|
||||
/* everything stored here will be a borrowed ref */
|
||||
|
||||
ancilData = getArrayByte3D(state.blockdata_expanded, state.x, state.y, state.z);
|
||||
state.block_data = ancilData;
|
||||
/* block that need pseudo ancildata:
|
||||
* grass, water, glass, chest, restone wire,
|
||||
* ice, fence, portal, iron bars, glass panes */
|
||||
if ((state.block == 2) || (state.block == 9) ||
|
||||
(state.block == 20) || (state.block == 54) ||
|
||||
(state.block == 55) || (state.block == 79) ||
|
||||
(state.block == 85) || (state.block == 90) ||
|
||||
(state.block == 101) || (state.block == 102) ||
|
||||
(state.block == 113)) {
|
||||
ancilData = generate_pseudo_data(&state, ancilData);
|
||||
state.block_pdata = ancilData;
|
||||
} else {
|
||||
|
||||
if (block_has_property(state.block, NODATA)) {
|
||||
/* block shouldn't have data associated with it, set it to 0 */
|
||||
ancilData = 0;
|
||||
state.block_data = 0;
|
||||
state.block_pdata = 0;
|
||||
} else {
|
||||
/* block has associated data, use it */
|
||||
ancilData = getArrayByte3D(state.blockdata_expanded, state.x, state.y, state.z);
|
||||
state.block_data = ancilData;
|
||||
/* block that need pseudo ancildata:
|
||||
* grass, water, glass, chest, restone wire,
|
||||
* ice, fence, portal, iron bars, glass panes */
|
||||
if ((state.block == 2) || (state.block == 9) ||
|
||||
(state.block == 20) || (state.block == 54) ||
|
||||
(state.block == 55) || (state.block == 79) ||
|
||||
(state.block == 85) || (state.block == 90) ||
|
||||
(state.block == 101) || (state.block == 102) ||
|
||||
(state.block == 113)) {
|
||||
ancilData = generate_pseudo_data(&state, ancilData);
|
||||
state.block_pdata = ancilData;
|
||||
} else {
|
||||
state.block_pdata = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* make sure our block info is in-bounds */
|
||||
|
||||
Reference in New Issue
Block a user