Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monsters can't attack any creatures other than players #254

Open
1 of 3 tasks
ScarletRedMan opened this issue Jan 19, 2022 · 0 comments
Open
1 of 3 tasks

Monsters can't attack any creatures other than players #254

ScarletRedMan opened this issue Jan 19, 2022 · 0 comments

Comments

@ScarletRedMan
Copy link

Info

This is:

  • bug report
  • feature request
  • other

Your issue / suggestion

Methods canTarget() and targetOption() don't working.I created new zombie class with overrided these methods and zombie want not to attack villagers.

Code;

@Override
public boolean canTarget(Entity entity) {
    return entity instanceof Villager || entity instanceof Player;
}

@Override
public boolean targetOption(EntityCreature creature, double distance) {
    if(distance > 100D || creature.isClosed() || !creature.isAlive()) return false;

    return creature instanceof Villager || (creature instanceof Player && !((Player) creature).isCreative());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants