1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-06 17:41:04 +00:00

Make sure monoblocks account for all node params

This commit is contained in:
Lars 2025-05-18 10:34:46 -07:00
parent 9c8a9783e6
commit de90495eda
2 changed files with 9 additions and 2 deletions

View file

@ -232,6 +232,13 @@ void MapBlock::copyFrom(const VoxelManipulator &src)
src.copyTo(data, data_area, v3s16(0,0,0), src.copyTo(data, data_area, v3s16(0,0,0),
getPosRelative(), data_size); getPosRelative(), data_size);
checkForMonoblock();
}
void MapBlock::checkForMonoblock() {
if (m_is_mono_block)
return;
MapNode n = data[0]; MapNode n = data[0];
bool is_mono_block = true; bool is_mono_block = true;
for (u32 i=1; i<nodecount; i++) { for (u32 i=1; i<nodecount; i++) {
@ -628,8 +635,7 @@ void MapBlock::deSerialize(std::istream &in_compressed, u8 version, bool disk)
} }
if (nimap.size() == 1) { if (nimap.size() == 1) {
m_is_mono_block = true; checkForMonoblock();
reallocate(1, data[0]);
u16 dummy; u16 dummy;
if (nimap.getId("air", dummy)) { if (nimap.getId("air", dummy)) {
m_is_air = true; m_is_air = true;

View file

@ -449,6 +449,7 @@ private:
*/ */
void deSerialize_pre22(std::istream &is, u8 version, bool disk); void deSerialize_pre22(std::istream &is, u8 version, bool disk);
void checkForMonoblock();
void reallocate(u32 c, MapNode n) void reallocate(u32 c, MapNode n)
{ {