Updates all weather states.
()
| 2498 | * Updates all weather states. |
| 2499 | */ |
| 2500 | protected void updateWeather() |
| 2501 | { |
| 2502 | if (!this.provider.getHasNoSky()) |
| 2503 | { |
| 2504 | if (!this.isRemote) |
| 2505 | { |
| 2506 | int i = this.worldInfo.getCleanWeatherTime(); |
| 2507 | |
| 2508 | if (i > 0) |
| 2509 | { |
| 2510 | --i; |
| 2511 | this.worldInfo.setCleanWeatherTime(i); |
| 2512 | this.worldInfo.setThunderTime(this.worldInfo.isThundering() ? 1 : 2); |
| 2513 | this.worldInfo.setRainTime(this.worldInfo.isRaining() ? 1 : 2); |
| 2514 | } |
| 2515 | |
| 2516 | int j = this.worldInfo.getThunderTime(); |
| 2517 | |
| 2518 | if (j <= 0) |
| 2519 | { |
| 2520 | if (this.worldInfo.isThundering()) |
| 2521 | { |
| 2522 | this.worldInfo.setThunderTime(this.rand.nextInt(12000) + 3600); |
| 2523 | } |
| 2524 | else |
| 2525 | { |
| 2526 | this.worldInfo.setThunderTime(this.rand.nextInt(168000) + 12000); |
| 2527 | } |
| 2528 | } |
| 2529 | else |
| 2530 | { |
| 2531 | --j; |
| 2532 | this.worldInfo.setThunderTime(j); |
| 2533 | |
| 2534 | if (j <= 0) |
| 2535 | { |
| 2536 | this.worldInfo.setThundering(!this.worldInfo.isThundering()); |
| 2537 | } |
| 2538 | } |
| 2539 | |
| 2540 | this.prevThunderingStrength = this.thunderingStrength; |
| 2541 | |
| 2542 | if (this.worldInfo.isThundering()) |
| 2543 | { |
| 2544 | this.thunderingStrength = (float)((double)this.thunderingStrength + 0.01D); |
| 2545 | } |
| 2546 | else |
| 2547 | { |
| 2548 | this.thunderingStrength = (float)((double)this.thunderingStrength - 0.01D); |
| 2549 | } |
| 2550 | |
| 2551 | this.thunderingStrength = MathHelper.clamp_float(this.thunderingStrength, 0.0F, 1.0F); |
| 2552 | int k = this.worldInfo.getRainTime(); |
| 2553 | |
| 2554 | if (k <= 0) |
| 2555 | { |
| 2556 | if (this.worldInfo.isRaining()) |
| 2557 | { |
no test coverage detected