- v3s16 blockpos_nodes = data->m_blockpos * MAP_BLOCKSIZE;
- const NodeDefManager *ndef = data->m_client->ndef();
-
- u8 result = 0x3F; // all sides solid;
-
- for (s16 i = 0; i < MAP_BLOCKSIZE && result != 0; i++)
- for (s16 j = 0; j < MAP_BLOCKSIZE && result != 0; j++) {
- v3s16 positions[6] = {
- v3s16(0, i, j),
- v3s16(MAP_BLOCKSIZE - 1, i, j),
- v3s16(i, 0, j),
- v3s16(i, MAP_BLOCKSIZE - 1, j),
- v3s16(i, j, 0),
- v3s16(i, j, MAP_BLOCKSIZE - 1)
- };
-
- for (u8 k = 0; k < 6; k++) {
- const MapNode &top = data->m_vmanip.getNodeRefUnsafe(blockpos_nodes + positions[k]);
- if (ndef->get(top).solidness != 2)
- result &= ~(1 << k);
+ std::unordered_map<v3s16, u8> results;
+ v3s16 ofs;
+
+ for (ofs.X = 0; ofs.X < 2; ofs.X++)
+ for (ofs.Y = 0; ofs.Y < 2; ofs.Y++)
+ for (ofs.Z = 0; ofs.Z < 2; ofs.Z++) {
+ v3s16 blockpos = data->m_blockpos + ofs;
+ v3s16 blockpos_nodes = blockpos * MAP_BLOCKSIZE;
+ const NodeDefManager *ndef = data->m_client->ndef();
+
+ u8 result = 0x3F; // all sides solid;
+
+ for (s16 i = 0; i < MAP_BLOCKSIZE && result != 0; i++)
+ for (s16 j = 0; j < MAP_BLOCKSIZE && result != 0; j++) {
+ v3s16 positions[6] = {
+ v3s16(0, i, j),
+ v3s16(MAP_BLOCKSIZE - 1, i, j),
+ v3s16(i, 0, j),
+ v3s16(i, MAP_BLOCKSIZE - 1, j),
+ v3s16(i, j, 0),
+ v3s16(i, j, MAP_BLOCKSIZE - 1)
+ };
+
+ for (u8 k = 0; k < 6; k++) {
+ const MapNode &top = data->m_vmanip.getNodeRefUnsafe(blockpos_nodes + positions[k]);
+ if (ndef->get(top).solidness != 2)
+ result &= ~(1 << k);
+ }