Started by
JustMonitor
on
Topic category: Help with Minecraft modding (Java Edition)
Hello, I want to make my entity spawn lightning and despawn when the player looks at him even if he is 200 blocks away, using procedures, I hope yall can help.
I can recommend you something that i've tried and worked for me, but is a bit poor, you need to insert into entity tick this command that would be executed from the entity (but first you will need to make a synched data for the entity(In my case i will call it "Test")):
execute as @p at @s anchored eyes facing entity @e[type=mod_id:entity_id,limit=1,sort=nearest] eyes anchored feet positioned ^ ^ ^1 rotated as @s positioned ^ ^ ^-1 if entity @s[distance=..0.1] run data merge entity @e[type=mod_id:entity_id,limit=1,sort=nearest] {DataTest:1b}
(i recommend you to play with the distance)
This would make the Test synched Data of the entity became true, now inside the tick update you must put a procedure that makes this:
if entity... Test = true{
(Here you put your execution)
(here you must set the Test to false to avoid he loop)
}
Hope this helps you, and sorry if bad english ;)
Thanks for the help but can you explain it using blocks not code ?