Is it possible to switch target entities?

Started by Lambda System on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Is it possible to switch target entities?
Tue, 06/27/2023 - 20:18 (edited)

I'll keep it short

I'm wondering if it's possible to switch the target entity of a procedure to a DIFFERENT entity. Like- For example: Say if the player right clicks the entity while holding Pink Dye, it'll spawn a different entity and then despawn the other one that came before it. Does the target entity automatically switch to the new one? Or do I have to tell the procedure "hey this new entity is now the event/target entity"? And if that is possible, how do i go about into doing that?

Help would be really appreciated :]

Edited by Lambda System on Tue, 06/27/2023 - 20:18
Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I'm pretty sure the target…
Wed, 06/28/2023 - 18:00

I'm pretty sure the target entity still refers to the previous (now despawned or killed) entity. You can still do things with the nonexistent entity, but the entity is gone from the world, and when the procedure ends the entity will be deleted.

The variable name for the target entity is just entity, so you can switch the target entity simply by making your own entity variable and then using this custom code snippet (it's under Advanced):

entity = myEntityVariableName;

Now, all future "Event/target entity" blocks will refer to the entity stored in "myEntityVariableName".

Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
ooohh i see, thank you :]  
Fri, 06/30/2023 - 16:50

ooohh i see, thank you :]