Skip to content

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

@ScarletRedMan

Description

@ScarletRedMan

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());
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions