Replace a block for other when is struck by Lightning

Started by alexmartínez on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jun 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Replace a block for other when is struck by Lightning

Hi, I'm trying to make a mod for replace some blocks using the power of Lightning, for example, if a Lightning strike on a Lightning Rod that is over a Block of Iron, this last one turns into a coal block. I don't know what im doing wrong but it dosen't work. 😭 (Im actually on the 2024.4 version) 
This is my code

Joined Nov 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
lightning cant be detected…
Sun, 06/22/2025 - 18:57

lightning cant be detected by plenty of things because it doesnt really have a hitbox, since lightning rods give off power when struck, you COULD detect if the lightning rod is powered, the block below is iron, and its storming, but that is a janky solution, and doesnt cover the block randomly being struck.