Despawning entity on effect expiration

Started by LeDeave on

Topic category: Help with modding (Java Edition)

Last seen on 11:28, 23. Jul 2024
Joined Jul 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Despawning entity on effect expiration

I would like to despawn rideable entity (testing on horse, planning to use it on 3rd party mounts) after player stops riding it. I came with and idea where I'll spawn it with potion effect, that will check if entity is ridden, yet I had no luck realizing it so far. So far I tried:

  • Making effect last 100 ticks and then apply it again/despawn entity based on if logic
  • Applying effect for 1 hour (enough for transportation on large map) and chcecking on each tick.

Still, no luck and I have no idea what am I doing wrong. Any help will be much appreciated!