How to get ignored by hostile mobs

Started by Soul of Cinder on

Topic category: Help with Minecraft modding (Java Edition)

Joined Aug 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to get ignored by hostile mobs

I've made a potion that make you get ignored by mobs but the problem is that i dont know how to make such procedure. i can take any kind of advice 

Joined Aug 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
i've made this but it still…
Wed, 08/14/2024 - 15:45

i've made this but it still doesnt work, i think its because of the line about the zombie it seem i forgot smth but idk what(also thx for the pluggin)

if the image doesnt work i've put this: public class MobTargetNullProcedure {

    public static void execute(Entity entity) {

        if (entity == null)

            return;

        if (entity instanceof LivingEntity _livEnt0 && _livEnt0.hasEffect(AtaysModsModMobEffects.OBSCURITY.get())) {

            if (entity instanceof Mob) {

                if (entity instanceof Mob) {

                    try {

                        ((Mob) entity).setTarget(null);

                    } catch (Exception e) {

                        e.printStackTrace();

                    }

                }

            }

        }

    }

}

Joined Apr 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
on what trigger did you set…
Wed, 08/14/2024 - 15:56

on what trigger did you set that procedure?

Joined Aug 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
i've made an effect and then…
Wed, 08/14/2024 - 16:04

i've made an effect and then i've put it on "on effect active tick"

Joined Apr 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I tried the same thing and…
Wed, 08/14/2024 - 16:24

I tried the same thing and it works

Joined Aug 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
idk why it work with you but…
Wed, 08/14/2024 - 16:43

idk why it work with you but not with me, when we both did the same thing anyway at least thx for the help bro

Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You can go to entity Ai and…
Sun, 10/06/2024 - 22:15

You can go to entity Ai and add a condition procedure to target entities tagged as player. Then return false if player has effect obscurity. You can add that procedure to both the start condition and continue condition that way if a player gets the effect mid fight then the mob will not attack. This shouldnt interfere with the mob fighting back an attacking player just stop it from targeting players. If you dont want it to fight back against players with obscurity add the same procedure to the conditions for fight back attacker mobs in the Ai.