Wolves attack a target when shot by their owner

This commit is contained in:
TfT_02
2014-04-18 23:15:20 +02:00
parent e4af611c91
commit 8e5340ebc3
3 changed files with 26 additions and 0 deletions

View File

@ -228,6 +228,25 @@ public class TamingManager extends SkillManager {
}
}
public void attackTarget(LivingEntity target) {
double range = 5;
Player player = getPlayer();
for (Entity entity : player.getNearbyEntities(range, range, range)) {
if (entity.getType() != EntityType.WOLF) {
continue;
}
Wolf wolf = (Wolf) entity;
if (!wolf.isTamed() || (wolf.getOwner() != player) || wolf.isSitting()) {
continue;
}
wolf.setTarget(target);
}
}
/**
* Handle the Call of the Wild ability.
*

View File

@ -283,6 +283,12 @@ public final class CombatUtils {
if (!Misc.isNPCEntity(player) && SkillType.ARCHERY.getPermissions(player)) {
processArcheryCombat(target, player, event, arrow);
}
if (target.getType() != EntityType.CREEPER && !Misc.isNPCEntity(player) && SkillType.TAMING.getPermissions(player)) {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
TamingManager tamingManager = mcMMOPlayer.getTamingManager();
tamingManager.attackTarget(target);
}
}
}