Make tamed mobs follow only if right clicked

Started by AnotherDude on

Topic category: Help with modding (Java Edition)

Last seen on 06:03, 21. Apr 2024
Joined Aug 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Make tamed mobs follow only if right clicked

Basically, I want to set up a condition that I can use to make a tamed creature follow you if you right click on it, then wander around normally if clicked on again.

 

Last seen on 10:38, 22. Apr 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You could try adding a…
Wed, 12/27/2023 - 06:55

You could try adding a custom logic NBT tag to your entity that determines their current state. Make a procedure that switches this when the player right clicks your entity, and then make the entity's AI, (the follow owner and wander around parts), conditional on this NBT tag. (Just make sure you keep the spelling consistent, believe me, you do not want to spend two hours debugging an NBT tag only to discover you spelled 'bounciness' wrong one time...)

Last seen on 06:03, 21. Apr 2024
Joined Aug 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to do make the nbt tag?
Thu, 12/28/2023 - 22:26

How to do make the nbt tag?

Last seen on 10:38, 22. Apr 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You can just use a 'set…
Fri, 12/29/2023 - 12:38

You can just use a 'set custom NBT logic tag' function in a procedure. NBT tags can be literally anything, once you set one, it will save the name of the tag, the type, (string, number, or logic), and the state. (In your case, true or false.) Then you can use the 'get custom NBT logic tag' function in other procedures, and as long as you provide it with the same name, it will get the current state. It's essentially like player variables, but for other entities.