Skip to content

Nearby Storm Detection

RealDarkStudios edited this page Jul 23, 2025 · 3 revisions

Nearby Storm Detection works much the same way Nearby Radar Detection does. You can detect storms within a certain radius of either a BlockPos or ChunkPos

To get nearby storms, you first need a NearbyStorms instance, which you can obtain like such:

// Assuming you have a level with type ResourceKey<Level> or Level
NearbyStorms storms = NearbyStorms.get(level);

// If you are on the client-side, use this instead
NearbyStorms stormsClient = NearbyStorms.client();

Then, you can use your NearbyStorms instance:

// Gets all of the storms within 2048 blocks of (0, 0, 0)
List<Storm> stormsNearBlockPos = storms.stormsNearBlock(BlockPos.ZERO, 2048);

// Gets all of the storms within 1024 blocks of the center of the [0, 0] chunk
List<Storm> stormsNearChunkPos = storms.stormsNearChunk(ChunkPos.ZERO, 1024);

// Gets all of the storms within 4096 of the player
List<Storm> stormsNearPlayer = storms.stormsNearPlayer(player, 4096);

There are also helper methods to run a Consumer for each Storm, called by #forStormNearBlock and #forStormNearChunk respectively

Starting with v0.15.0.0, you can now filter by StormType Just pass the StormType as the third parameter for any NearbyStorms method:

// Gets all tornados within 2048 blocks of (0, 0, 0). 
// Note that StormType.TORNADO and StormType.SUPERCELL are different in that StormType.TORNADO is only stage 3 or higher!
List<Storm> tornadosNearBlockPos = storms.stormsNearBlock(BlockPos.ZERO, 2048, StormType.TORNADO);

// Gets all of the squalls within 1024 blocks of the center of the [0, 0] chunk
List<Storm> squallsNearChunkPos = storms.stormsNearChunk(ChunkPos.ZERO, 1024, StormType.SQUALL);

// Gets all of the cyclones within 4096 of the player
List<Storm> cyclonesNearPlayer = storms.stormsNearPlayer(player, 4096, StormType.CYCLONE);

Clone this wiki locally