From 7f1ad036b147049d3fb1e5f2c477d176793b1e0b Mon Sep 17 00:00:00 2001 From: ORelio Date: Fri, 24 Apr 2020 22:14:30 +0200 Subject: [PATCH] AutoAttack coding style fixes --- MinecraftClient/ChatBots/AutoAttack.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/MinecraftClient/ChatBots/AutoAttack.cs b/MinecraftClient/ChatBots/AutoAttack.cs index 20bcf299..10a00ca5 100644 --- a/MinecraftClient/ChatBots/AutoAttack.cs +++ b/MinecraftClient/ChatBots/AutoAttack.cs @@ -32,7 +32,8 @@ namespace MinecraftClient.ChatBots public override void Update() { - if (AutoEat.Eating | health == 0) return; + if (AutoEat.Eating | health == 0) + return; if (attackCooldownCounter == 0) { @@ -55,6 +56,7 @@ namespace MinecraftClient.ChatBots { handleEntity(entity); } + public override void OnEntityDespawn(Entity entity) { if (entitiesToAttack.ContainsKey(entity.ID)) @@ -62,6 +64,7 @@ namespace MinecraftClient.ChatBots entitiesToAttack.Remove(entity.ID); } } + public override void OnEntityMove(Entity entity) { handleEntity(entity); @@ -97,7 +100,8 @@ namespace MinecraftClient.ChatBots public void handleEntity(Entity entity) { - if (!entity.IsHostile()) return; + if (!entity.IsHostile()) + return; bool isBeingAttacked = entitiesToAttack.ContainsKey(entity.ID); if (GetCurrentLocation().Distance(entity.Location) < attackRange) @@ -107,7 +111,8 @@ namespace MinecraftClient.ChatBots { entitiesToAttack.Add(entity.ID, entity); } - } else + } + else { // remove marker on entity to attack it, as it is now out of range if (isBeingAttacked)