How do I make a block change when a player is near

Started by KindyTheCyborg65 on

Topic category: Help with MCreator software

Last seen on 14:45, 4. Aug 2022
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do I make a block change when a player is near

Ok so basically I am making a mod, I made three custom blocks which are TV's. (On, Off, and Attack) I want the tv to usually be on, but when the player gets within a certain distance of the tv I want it to change into attack mode and then the player starts taking damage (the tv doesn't directly attack the player though) How can I do this?

Last seen on 08:29, 9. Jul 2023
Joined Mar 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Well make a proceedure and…
Mon, 08/01/2022 - 10:07

Well make a proceedure and put it on the block tick trigger. Use the "For each entity within a square cube with size" block found under world management block and put "Deal damage to entity" block inside that and other things you want to happen when it gets into attack mode. Now whenever anyone is inside it's range (which you can change. The default is 4), it will deal damage (also customizable) to the trespasser. Make sure to have anything you want to happen to the trespasser be the "Entity iterator" and not the "event target entity" block.