How to create a condition where a pet only follows the owner only if the owner is holding a specific item

Started by Milstone on

Topic category: Help with modding (Java Edition)

Last seen on 04:49, 5. Nov 2021
Joined Sep 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to create a condition where a pet only follows the owner only if the owner is holding a specific item

Hey guys, this is a pree simple problem but I am not sure why I am slightly struggling with this.

So, I made the AI behave in a way where they will follow the master but I want to set the condition where it will only follow owner if they are holding an item called a "whistle". The current block code that I have for this condition is:

IDK if the image works so I will paraphrase:

If item in main-hand of Event/target entity = whistle     (all in red boxes except for Event/target entity) {

do Return true

}

do Return false

I tried following the examplegiven in the wiki but it did not work.

Is there something I did wrong? My guess would be that I am not referring to the correct entity (the target entity) but I don't know how to refer to the owner specifically in block or script code. Is there anyone who knows how?

TY in advance

Last seen on 04:49, 5. Nov 2021
Joined Sep 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yea sorry guys the imageā€¦
Fri, 10/02/2020 - 12:39

Yea sorry guys the image doesn't work so I hope my paraphrase was enough. Please ask me if you guys have any trouble understanding it.