Malfiros Posted September 20, 2021 Report Share Posted September 20, 2021 How exactly is lighting rated? How does it work? For example, a torch has an “intensity” of 14, but what exactly does that mean? Does it illuminate a 14 block radius? If so, does that radius diminish by 1 “intensity” per block away from the source? I ask because I’d like to make the most efficient use of lighting to affect spawns. What is the minimum intensity to prevent drifters from spawning? To keep domesticated animals from despawning? Link to comment Share on other sites More sharing options...
Saricane Posted September 20, 2021 Report Share Posted September 20, 2021 (edited) Yes, your torch will decrease by 1 every block. So the 6 adjacents blocks (up, down, north south, east, west) will receive 13. And you can't use diagonals. That's what we call Manhattan distance. For example, when playing chess, your knight can move to all squares at Manhattan distance = 3 (well, not all, you must turn once). And when you get lower than 8 : "Hello, my name is Drifter, and you're about to die" Edited September 20, 2021 by Saricane 1 1 Link to comment Share on other sites More sharing options...
Malfiros Posted September 21, 2021 Author Report Share Posted September 21, 2021 So I’m assuming that less than 8 will also allow the chance for domesticated animals to despawn? Link to comment Share on other sites More sharing options...
Omega Haxors Posted September 23, 2021 Report Share Posted September 23, 2021 (edited) I can help here, I had to master the lighting system essentially to get my mod to work. There are 3 types of light: Sunlight - This casts down from the sky to the ground. A rating from 0-22 is defined by the JSON in your world file. Every light level blocked reduces this. Unlike what you might expect, light level produced by time of day is not affected by this, that's done on its own separate thing during rendering or something. This means that anything that checks light, unless it also checks time, won't care if it's day or night. It will treat the block as fully lit if it's exposed to the sky. Block Light - Same thing as sunlight, though the 'brightness' of block light is 1/3rd or put another way: a sunlight of 6 overpowers a block light of 18. This reduces by 1 per distance from the block emitting the light. By far the simplest light source type in the game. Entity Light - This light value works like block light except it has half the range: With each block reducing 2 levels of light. This isn't actually tracked by game itself but it can easily be inferred by simply reading the "V" of its HSV level and doing some simple math. Entity Light sources include players holding light sources (fun fact: you can put colored glass in lamps to color it) entities that are on fire, dropped light sources and spider mechanicals attacking you. If it's an entity casing a light, it's Entity light. All lights have an HSV value, yes, even sunlight. (This can be defined in the world JSON) Hue determines the color, Saturation determines how much color, and Value determines the brightness of the color. In the case of Entity Light (and potentially all light), V determines the strength. Edited September 23, 2021 by Omega Haxors 5 1 Link to comment Share on other sites More sharing options...
Recommended Posts