How to make a illager that does not get attacked by Iron Golem

Started by BlueAwesomeDinosaur on

Topic category: Help with modding (Java Edition)

Last seen on 21:55, 16. Oct 2022
Joined Aug 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to make a illager that does not get attacked by Iron Golem

I was making a mob that is an illager that hides within villages as a regular villager. Other than being out of sight and changing his mob type, how can I prevent iron golems from attacking him when he just stands near one?

Last seen on 04:35, 17. Jan 2021
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@SubscribeEvent public void…
Wed, 07/01/2020 - 21:17

@SubscribeEvent public void onAttackTargetEvent(LivingSetAttackTargetEvent event) { if (event.getEntityLiving() instanceof IronGolemEntity && event.getTarget() instanceof YourDisquiseIllagerThing) { ((IronGolemEntity) event.getEntityLiving()).setAttackTarget(null); ((IronGolemEntity) event.getEntityLiving()).setAggroed(false); } }

For some reason I can't find code blocks anymore, so use this website to format it;

https://www.tutorialspoint.com/online_java_formatter.htm

And then change YourDisquiseIllagerThing to your mob.

Last seen on 21:55, 16. Oct 2022
Joined Aug 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Where do I put this in? Or…
Thu, 07/02/2020 - 21:47

Where do I put this in? Or how. Sorry, I am not very familiar with custom code other than tweaking some values or doing some simple code with already premade code.

Last seen on 10:42, 27. Mar 2024
Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You can just set it to …
Thu, 03/18/2021 - 09:56

You can just set it to "animal", I think it will be counted as friendly even if it has hostile behaviour.

Last seen on 15:05, 21. Dec 2023
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
mcreature stated that using …
Tue, 07/05/2022 - 15:43

mcreature stated that using "creature" instead of "mob" cause crash when using attacking AI. any way to solve that?