Started by
AnotherDude
on
Topic category: Help with Minecraft modding (Java Edition)
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.
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...)
How to do make the nbt tag?
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.