chore: cleanup annotations in api adventure patch

This commit is contained in:
Riley Park
2023-03-23 09:49:24 -07:00
parent c4351787c6
commit 39255145b6
64 changed files with 1308 additions and 1246 deletions

View File

@@ -21,10 +21,14 @@ 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];
@@ -33,16 +37,12 @@ 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)));
}