I need to check if it's raining at a block.

Started by AresSF on

Topic category: Help with modding (Java Edition)

Last seen on 17:00, 26. Sep 2023
Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I need to check if it's raining at a block.
Wed, 11/17/2021 - 03:20 (edited)

I have issues figuring out how to detect if is raining above a block, what I need to a certain event to happen. I tried as conditions a combo of the procedure blocks to verify if the block can see the sky and to check if is there's rain or storm in the world. It works almost as I want but the trouble starts when the block is under a transparent block as glass, triggering the event even indoors.

I guess that what I really need it's some kind of custom code to verify raining at this block specifically instead of using the "can see sky" procedure block.

I'm sort of a rookie with coding. I found something about "World.isRainingAt", but I have no idea about how to make it work.

Beforehand, thanks for your help.

EDIT:

The block must do the thing ONLY when rain is falling directly at the block. Using the "can see sky" procedure block also triggers the effect when this block is under transparent blocks.
 

Edited by AresSF on Wed, 11/17/2021 - 03:20
Last seen on 10:46, 28. Nov 2021
Joined Oct 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
So your request sounds like…
Mon, 11/15/2021 - 11:44

So your request sounds like to me the "if-do" procedure could be the right answer for this. In every case the requirement of is

"if "is raining in the provided world" or "is thundering in the provided world"" this is mandatory to trigger whatever you want that the Block should do.

This should be detected indoors as well, because both properties are in the level.dat of the minecraft world. So I assume it gets the rain or thunder value from there. If I am right, you don't need the Block see the sky tag at all neither outdoors nor indoors, if a block is placed on that rain sensor.

I am also not wondering that you have issues if you placed e.g. a glassblock over your rain detecting block. It can't see the sky, because a block is over the sensor, which blocks the rain. Although glass does not decrease the lightlevel (or decrease with minor effects on stained glass but i don't know.) But you can see the sky through glass, the daylight sensor detects the daylight but the Block it self can't detect the rain, while glass is placed over it. The block needs to see the sky? So no other blocks may placed over that block, which should see the sky.

Last seen on 17:00, 26. Sep 2023
Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Well actually what I really…
Mon, 11/15/2021 - 19:51

Well actually what I really need is that the block detects if rain is falling directly over it, not if raining in the world. If I put a glass block at any height above the block, there is no rain particles, but it still detect as if there was nothing above... The same happens with any other transparent block.

In other words, the block can see the sky through any transparent blocks. There is no issues with opaque blocks. I tested it many times. Still happens.

The block "attracts" lightning if raining directly above it. I must stop if is below a transparent block at any height.

Endermen don't receive damage by rain if they are below any transparent block. Also farmland hydrates if it's raining directly above the farmland block but cannot do it if there's glass over it at any height blocking the rain. I need to figure out that condition exactly.

Last seen on 10:46, 28. Nov 2021
Joined Oct 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
To do this I can't help. I…
Tue, 11/16/2021 - 10:00

To do this I can't help. I don't know how I can do this and I'm really sorry for this and I am sorry as well the rain/thundering if statement are not sufficient what you want to have. I wish for you, someone else can help you out.

Last seen on 13:34, 4. Oct 2022
Joined Apr 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Do something like this: if …
Tue, 11/16/2021 - 16:32

Do something like this:

if (is raining in the world):

   if (can Block at x y z see the sun):

      executable code

~Lanee

Last seen on 17:00, 26. Sep 2023
Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Sorry Lamyr, but it's what I…
Wed, 11/17/2021 - 03:26

Sorry Lamyr, but it's what I'm doing already, and the sky can be seen thru transparent blocks.

Last seen on 13:58, 21. Jan 2023
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
use a raycast y to the Hight…
Sat, 12/18/2021 - 04:00

use a raycast y to the Hight limit and check for all blocks except fluids as your other check

Last seen on 17:00, 26. Sep 2023
Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
MinerMiner, how am I going…
Thu, 12/23/2021 - 05:39

MinerMiner, how am I going to do that? It seems that only works for entities, not blocks...