0

Shuffle around wall IDs, change wall check

Previously, walls were all numbered at 21000+. This is bad because
our blockmap is an array, so this caused our blockmap to take up
80 MiB of RAM in each worker process.

This commit changes the wall numbering, and exploits some bitmasking
to have the wall check run in constant time no matter how many walls
there are. This is done with a simple mask and xor to check the prefix.

RAM usage for the blockmap thus drops to like 44 MiB.

This is in preparation for adding more walls for 1.16.
This commit is contained in:
Nicolas F
2020-07-13 19:15:47 +02:00
parent a3e4812ca9
commit fcb3f2644d
6 changed files with 60 additions and 68 deletions

View File

@@ -354,7 +354,7 @@ generate_pseudo_data(RenderState* state, uint16_t ancilData) {
}
}
return data;
} else if (block_class_is_subset(state->block, block_class_wall, block_class_wall_len)) {
} else if (block_class_is_wall(state->block)) {
/* check for walls and add one bit with the type of wall (mossy or cobblestone)*/
if (ancilData == 0x1) {
return check_adjacent_blocks(state, x, y, z, state->block) | 0x10;