Fixed Auto Attack bot (forgot to add a method to a commit before)

Tested on 1.18.2
This commit is contained in:
Dušan Milutinović 2022-06-28 17:37:16 +02:00
parent dc0021d990
commit b5c4cd7566

View file

@ -144,6 +144,22 @@ namespace MinecraftClient.ChatBots
}
}
public override void OnEntityHealth(Entity entity, float health)
{
if (!entity.Type.IsHostile())
return;
if (entitiesToAttack.ContainsKey(entity.ID))
{
entitiesToAttack[entity.ID].Health = health;
if (entitiesToAttack[entity.ID].Health <= 0)
{
entitiesToAttack.Remove(entity.ID);
}
}
}
public override void OnEntityMove(Entity entity)
{
shouldAttackEntity(entity);