How would I spawn a single entity when current entity is looked at

Started by modbroz on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jun 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How would I spawn a single entity when current entity is looked at
Tue, 10/28/2025 - 21:43 (edited)

How would I make a single entity spawn when the current entity is looked at and basically replace the old entity with the newly spawned one? I was able to make an entity despawn when looked at but when I try to do the same thing but with spawning an entity it spawns like millions of the entity I want to spawn and I only want one entity to spawn when the current entity is looked at. Anyone able to help out will be appreciated a ton, thanks!

Edited by modbroz on Tue, 10/28/2025 - 21:43
Joined Jun 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Please someone help I have…
Tue, 10/28/2025 - 23:00

Please someone help I have limited time to make this thing so I would apricate it so much if someone could help me out

Joined Jun 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Add a synced data to the…
Wed, 10/29/2025 - 00:47

Add a synced data to the original entity and set the data to logic for example entitydespawn and false and take you're already made procedure to set the entitydespawn to true. Now go to the entity tick update (the original entity) set when get synced data of entity and name of the synced data = entitydespawn if true then despawn event targets entity and spawn at xyz your new entity