Mobs Run Away

Started by DeathD84 on Sat, 03/13/2021 - 19:36

Topic category: Help with modding (Java Edition)

Last seen on 17:49, 9. May 2022
Joined Jan 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Mobs Run Away
Sat, 03/13/2021 - 19:36

Back at it again, I'm using the latest snapshot, is there any way I can make it so, with an effect or item, when you have it, mobs will be repelled/run away?

Last seen on 05:29, 31. Jan 2022
Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
create a procedure like this…
Mon, 03/15/2021 - 14:11

create a procedure like this:

https://cdn.discordapp.com/attachments/599250311852458006/821020637912498226/unknown.png

save and build it. my procedure is named Bbb, whatever your procedure name is, remember it.

next, create another procedure like this:

https://cdn.discordapp.com/attachments/599250311852458006/821021254282641408/unknown.png

in the custom code snippet box, put this piece of code in:

((MobEntity)entity).goalSelector.addGoal(1, new AvoidEntityGoal((CreatureEntity)entity, PlayerEntity.class, 10f, 1, 1.2) {
    @Override
    public boolean shouldExecute() {
        return super.shouldExecute() && BbbProcedure.executeProcedure(ImmutableMap.of("entity", this.avoidTarget, "world", this.avoidTarget.world));
    }
});

replace the BbbProcedure with the name of your procedure, for example, if the procedure is named CheckHelmet, then its CheckHelmetProcedure. also, very important, remove all the spaces in the code snippet.

save and build it. if you wear a diamond helmet, monsters should now avoid you.

 

Last seen on 17:49, 9. May 2022
Joined Jan 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
intructions confusing,…
Tue, 03/16/2021 - 02:14

intructions confusing, couldnt get it to work

Last seen on 05:29, 31. Jan 2022
Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
thats too bad. it works fine…
Tue, 03/16/2021 - 02:52

thats too bad. it works fine when i tested it.

maybe you should ask for help on the parts that are confusing you

Last seen on 05:07, 29. Jan 2022
Joined Sep 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
when you say remove all…
Thu, 12/30/2021 - 22:49

when you say remove all spaces you mean all the spaces outside the parentheses right?

Last seen on 05:07, 29. Jan 2022
Joined Sep 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
or i guess i should say what…
Thu, 12/30/2021 - 23:01

or i guess i should say what spaces exactly do we delete