Wiki 9Minecraft Wiki 9Minecraft
Tlib Wiki › Guides › How to Query Biome, Weather, and Day/Night in TLib

How to Query Biome, Weather, and Day/Night in TLib

TLib's environment queries let you ask the world about its current state without digging through vanilla internals. These are handy for conditional effects, spawn logic, or UI that reflects the environment.

Biome and weather

To get the biome, pass the world and a position to the biome query; it returns the biome at that location, which you can compare against a registry key or check for tags like temperature or whether it is an ocean. For weather, query the world for rain or thunder state. A typical use is only spawning certain particles or playing certain sounds when it is raining, or tinting an overlay when the player is in a specific biome.

Day/night cycle

Query the world time to determine whether it is day or night. TLib exposes this as a simple check so you do not have to do the modulo math yourself. Use it to switch ambience, enable night-vision-style effects, or change which particles spawn.

Remember that weather and time are per-world and can change while your feature is running, so re-query them each tick or each render frame rather than caching them once. Biome only changes when the player moves, so you can cache it per position and refresh when the position changes.