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 Fri, 10/02/2020 - 12:38

Topic category: Help with modding (Java Edition)

Last seen on 10:11, 22. Nov 2020
Joined Sep 2014
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
How to create a condition where a pet only follows the owner only if the owner is holding a specific item
Fri, 10/02/2020 - 12:38

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 10:11, 22. Nov 2020
Joined Sep 2014
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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.