MCPcopy Create free account
hub / github.com/DGVPSH/SlackOpen / getSkyColor

Method getSkyColor

src/main/java/net/minecraft/world/World.java:1427–1483  ·  view source on GitHub ↗

Calculates the color for the skybox

(Entity entityIn, float partialTicks)

Source from the content-addressed store, hash-verified

1425 * Calculates the color for the skybox
1426 */
1427 public Vec3 getSkyColor(Entity entityIn, float partialTicks)
1428 {
1429 float f = this.getCelestialAngle(partialTicks);
1430 float f1 = MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F;
1431 f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F);
1432 int i = MathHelper.floor_double(entityIn.posX);
1433 int j = MathHelper.floor_double(entityIn.posY);
1434 int k = MathHelper.floor_double(entityIn.posZ);
1435 BlockPos blockpos = new BlockPos(i, j, k);
1436 BiomeGenBase biomegenbase = this.getBiomeGenForCoords(blockpos);
1437 float f2 = biomegenbase.getFloatTemperature(blockpos);
1438 int l = biomegenbase.getSkyColorByTemp(f2);
1439 float f3 = (float)(l >> 16 & 255) / 255.0F;
1440 float f4 = (float)(l >> 8 & 255) / 255.0F;
1441 float f5 = (float)(l & 255) / 255.0F;
1442 f3 = f3 * f1;
1443 f4 = f4 * f1;
1444 f5 = f5 * f1;
1445 float f6 = this.getRainStrength(partialTicks);
1446
1447 if (f6 > 0.0F)
1448 {
1449 float f7 = (f3 * 0.3F + f4 * 0.59F + f5 * 0.11F) * 0.6F;
1450 float f8 = 1.0F - f6 * 0.75F;
1451 f3 = f3 * f8 + f7 * (1.0F - f8);
1452 f4 = f4 * f8 + f7 * (1.0F - f8);
1453 f5 = f5 * f8 + f7 * (1.0F - f8);
1454 }
1455
1456 float f10 = this.getThunderStrength(partialTicks);
1457
1458 if (f10 > 0.0F)
1459 {
1460 float f11 = (f3 * 0.3F + f4 * 0.59F + f5 * 0.11F) * 0.2F;
1461 float f9 = 1.0F - f10 * 0.75F;
1462 f3 = f3 * f9 + f11 * (1.0F - f9);
1463 f4 = f4 * f9 + f11 * (1.0F - f9);
1464 f5 = f5 * f9 + f11 * (1.0F - f9);
1465 }
1466
1467 if (this.lastLightningBolt > 0)
1468 {
1469 float f12 = (float)this.lastLightningBolt - partialTicks;
1470
1471 if (f12 > 1.0F)
1472 {
1473 f12 = 1.0F;
1474 }
1475
1476 f12 = f12 * 0.45F;
1477 f3 = f3 * (1.0F - f12) + 0.8F * f12;
1478 f4 = f4 * (1.0F - f12) + 0.8F * f12;
1479 f5 = f5 * (1.0F - f12) + f12;
1480 }
1481
1482 return new Vec3(f3, f4, f5);
1483 }
1484

Callers 2

updateFogColorMethod · 0.95
renderSkyMethod · 0.45

Calls 9

getCelestialAngleMethod · 0.95
cosMethod · 0.95
clamp_floatMethod · 0.95
floor_doubleMethod · 0.95
getBiomeGenForCoordsMethod · 0.95
getFloatTemperatureMethod · 0.95
getSkyColorByTempMethod · 0.95
getRainStrengthMethod · 0.95
getThunderStrengthMethod · 0.95

Tested by

no test coverage detected