[ci skip] rebuild patches

This commit is contained in:
Jake Potrebic
2023-03-23 14:57:03 -07:00
parent 39255145b6
commit 0adc18baf8
60 changed files with 1113 additions and 1197 deletions

View File

@@ -21,14 +21,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - let's make sure the implementation isn't as slow as possible
+ int offX = chunkPos.x << 4;
+ int offZ = chunkPos.z << 4;
- while (iterator.hasNext()) {
- BlockPos blockposition = (BlockPos) iterator.next();
+
+ int minChunkSection = io.papermc.paper.util.WorldUtil.getMinSection(world);
+ int maxChunkSection = io.papermc.paper.util.WorldUtil.getMaxSection(world);
- if (((ChunkAccess) object1).getBlockState(blockposition).getLightEmission() != 0) {
- protochunk.addLight(blockposition);
+
+ LevelChunkSection[] sections = achunksection;
+ for (int sectionY = minChunkSection; sectionY <= maxChunkSection; ++sectionY) {
+ LevelChunkSection section = sections[sectionY - minChunkSection];
@@ -37,12 +33,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ continue;
+ }
+ int offY = sectionY << 4;
+
- while (iterator.hasNext()) {
- BlockPos blockposition = (BlockPos) iterator.next();
+ for (int index = 0; index < (16 * 16 * 16); ++index) {
+ if (section.states.get(index).getLightEmission() <= 0) {
+ continue;
+ }
+
- if (((ChunkAccess) object1).getBlockState(blockposition).getLightEmission() != 0) {
- protochunk.addLight(blockposition);
+ // index = x | (z << 4) | (y << 8)
+ protochunk.addLight(new BlockPos(offX | (index & 15), offY | (index >>> 8), offZ | ((index >>> 4) & 15)));
}