Initiates the recalculation of both the block-light and sky-light for a given block inside a chunk.
(int x, int y, int z)
| 398 | * Initiates the recalculation of both the block-light and sky-light for a given block inside a chunk. |
| 399 | */ |
| 400 | private void relightBlock(int x, int y, int z) |
| 401 | { |
| 402 | int i = this.heightMap[z << 4 | x] & 255; |
| 403 | int j = i; |
| 404 | |
| 405 | if (y > i) |
| 406 | { |
| 407 | j = y; |
| 408 | } |
| 409 | |
| 410 | while (j > 0 && this.getBlockLightOpacity(x, j - 1, z) == 0) |
| 411 | { |
| 412 | --j; |
| 413 | } |
| 414 | |
| 415 | if (j != i) |
| 416 | { |
| 417 | this.worldObj.markBlocksDirtyVertical(x + this.xPosition * 16, z + this.zPosition * 16, j, i); |
| 418 | this.heightMap[z << 4 | x] = j; |
| 419 | int k = this.xPosition * 16 + x; |
| 420 | int l = this.zPosition * 16 + z; |
| 421 | |
| 422 | if (!this.worldObj.provider.getHasNoSky()) |
| 423 | { |
| 424 | if (j < i) |
| 425 | { |
| 426 | for (int j1 = j; j1 < i; ++j1) |
| 427 | { |
| 428 | ExtendedBlockStorage extendedblockstorage2 = this.storageArrays[j1 >> 4]; |
| 429 | |
| 430 | if (extendedblockstorage2 != null) |
| 431 | { |
| 432 | extendedblockstorage2.setExtSkylightValue(x, j1 & 15, z, 15); |
| 433 | this.worldObj.notifyLightSet(new BlockPos((this.xPosition << 4) + x, j1, (this.zPosition << 4) + z)); |
| 434 | } |
| 435 | } |
| 436 | } |
| 437 | else |
| 438 | { |
| 439 | for (int i1 = i; i1 < j; ++i1) |
| 440 | { |
| 441 | ExtendedBlockStorage extendedblockstorage = this.storageArrays[i1 >> 4]; |
| 442 | |
| 443 | if (extendedblockstorage != null) |
| 444 | { |
| 445 | extendedblockstorage.setExtSkylightValue(x, i1 & 15, z, 0); |
| 446 | this.worldObj.notifyLightSet(new BlockPos((this.xPosition << 4) + x, i1, (this.zPosition << 4) + z)); |
| 447 | } |
| 448 | } |
| 449 | } |
| 450 | |
| 451 | int k1 = 15; |
| 452 | |
| 453 | while (j > 0 && k1 > 0) |
| 454 | { |
| 455 | --j; |
| 456 | int i2 = this.getBlockLightOpacity(x, j, z); |
| 457 |
no test coverage detected