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

Method getLightLevel

src/main/java/net/optifine/DynamicLights.java:267–314  ·  view source on GitHub ↗
(BlockPos pos)

Source from the content-addressed store, hash-verified

265 }
266
267 public static double getLightLevel(BlockPos pos)
268 {
269 double d0 = 0.0D;
270
271 synchronized (mapDynamicLights)
272 {
273 List<DynamicLight> list = mapDynamicLights.valueList();
274 int i = list.size();
275
276 for (int j = 0; j < i; ++j)
277 {
278 DynamicLight dynamiclight = (DynamicLight)list.get(j);
279 int k = dynamiclight.getLastLightLevel();
280
281 if (k > 0)
282 {
283 double d1 = dynamiclight.getLastPosX();
284 double d2 = dynamiclight.getLastPosY();
285 double d3 = dynamiclight.getLastPosZ();
286 double d4 = (double)pos.getX() - d1;
287 double d5 = (double)pos.getY() - d2;
288 double d6 = (double)pos.getZ() - d3;
289 double d7 = d4 * d4 + d5 * d5 + d6 * d6;
290
291 if (dynamiclight.isUnderwater() && !Config.isClearWater())
292 {
293 k = Config.limit(k - 2, 0, 15);
294 d7 *= 2.0D;
295 }
296
297 if (d7 <= 56.25D)
298 {
299 double d8 = Math.sqrt(d7);
300 double d9 = 1.0D - d8 / 7.5D;
301 double d10 = d9 * (double)k;
302
303 if (d10 > d0)
304 {
305 d0 = d10;
306 }
307 }
308 }
309 }
310 }
311
312 double d11 = Config.limit(d0, 0.0D, 15.0D);
313 return d11;
314 }
315
316 public static int getLightLevel(ItemStack itemStack)
317 {

Callers 3

updateMethod · 0.95
getCombinedLightMethod · 0.95

Calls 15

getLastLightLevelMethod · 0.95
getLastPosXMethod · 0.95
getLastPosYMethod · 0.95
getLastPosZMethod · 0.95
isUnderwaterMethod · 0.95
isClearWaterMethod · 0.95
limitMethod · 0.95
getBlockMethod · 0.95
getLightValueMethod · 0.95
getMinecraftMethod · 0.95
isDynamicHandLightMethod · 0.95
isSpectatorMethod · 0.95

Tested by

no test coverage detected