-
Notifications
You must be signed in to change notification settings - Fork 2
Nearby Radar Detection
RealDarkStudios edited this page Jun 13, 2025
·
4 revisions
Nearby Radar Detection works much the same way Nearby Storm Detection does.
You can detect radars within a certain radius of either a BlockPos or ChunkPos
To get nearby radars, you first need a NearbyRadars instance, which you can obtain like such:
// Assuming you have a level with type ResourceKey<Level> or Level
NearbyRadars radars = NearbyRadars.get(level);
// If you are on the client-side, use this instead
NearbyRadars radarsClient = NearbyRadars.client();Then, you can use your NearbyRadars instance:
// Gets all of the radars within 2048 blocks of (0, 0, 0)
Set<BlockPos> radarsNearBlockPos = radars.radarsNearBlock(BlockPos.ZERO, 2048);
// Gets all of the radars within 1024 blocks of the center of the [0, 0] chunk
Set<BlockPos> radarsNearChunkPos = radars.radarsNearChunk(ChunkPos.ZERO, 1024);There are also helper methods to run a Consumer for each BlockPos, called by #forRadarNearBlock and #forRadarNearChunk respectively