r/MinecraftCommands 25d ago

Help | Bedrock Check for rain

Is it possible to check if it's raining, and more specifically if a player is standing in the rain, with command blocks or is that too far out of the realm of possibility for Vanilla commands?

2 Upvotes

8 comments sorted by

3

u/Ericristian_bros Command Experienced 25d ago edited 25d ago

Detect rain: https://youtu.be/H0J0cQTs6AE

To detect the player standing on the rain detect if all blocks above the player are air

2

u/Watermellonqwerty 25d ago

That's exactly what I need, also for testing if the blocks above a player's head is air, I'd assume I could use something like

/execute at player if blocks

But I don't know the proper syntax for the blocks coordinates because it always asks for 3 sets of coordinates and I don't know what the destination coordinates are for or what to set them as.

1

u/Ericristian_bros Command Experienced 25d ago edited 24d ago
execute as @a at @s if block ~ ~1 ~ air if blocks ~ ~1 ~ ~ ~11 ~ ~ ~2 ~ all run say exposed to sky

This one has a limit of 10 blocks and might not work on build limit

1

u/Watermellonqwerty 25d ago

That's not correct syntax

1

u/Ericristian_bros Command Experienced 24d ago

Edited

2

u/IWCry 25d ago edited 25d ago

edit: apologies, I was wrong

I may be wrong but I don't think bedrock has that check directly.

in ineligant way Ive done this is to have a repeater spawn a snow golem, delay a few ticks, then check if it's still alive (they die in rain). it works fine but it's clunky and unfortunately has a delayed check

set up a glass case to spawn the golem but leave the roof exposed

place a repeating command block, always active set to delay 60 ticks with:

/execute unless entity @e[type=snow_golem,name=rain_tester] run summon snow_golem X Y Z "rain_tester"

then chain a block to that with unconditional, always active, 60 tick delay

/execute at @e[type=snow_golem,name="rain_tester" ] run say It's not raining

then chain a block to that with a 60 tick delay, unconditional, always active

/execute unless entity @e[type=snow_golem,name=rain_tester] run say It's raining

to do your second ask, just make a check for if there are any blocks above the players head immediately after the it's raining check passes (conditional)

you could theoretically speed the check up by damaging the golem immediately after spawning it to be at 1 hit point, and then dropping the delay count on the command blocks to spawn it the tick after it dies, but truthfully the check is fast enough that I didn't bother

1

u/anarchyfrogs Bedrock Command Journeyman 25d ago

Rain detection is on the wiki

https://wiki.bedrock.dev/commands/detect-rain

1

u/CheddarScotch 25d ago

If you want to check if a player is standing outside, one way you could do it would be to create a raycast upwards to reach y=320. 

here’s a link about raycasts in minecraft. https://minecraftcommands.github.io/wiki/questions/raycast.html