mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
AutoAttack coding style fixes
This commit is contained in:
parent
83852511bc
commit
7f1ad036b1
1 changed files with 8 additions and 3 deletions
|
|
@ -32,7 +32,8 @@ namespace MinecraftClient.ChatBots
|
||||||
|
|
||||||
public override void Update()
|
public override void Update()
|
||||||
{
|
{
|
||||||
if (AutoEat.Eating | health == 0) return;
|
if (AutoEat.Eating | health == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
if (attackCooldownCounter == 0)
|
if (attackCooldownCounter == 0)
|
||||||
{
|
{
|
||||||
|
|
@ -55,6 +56,7 @@ namespace MinecraftClient.ChatBots
|
||||||
{
|
{
|
||||||
handleEntity(entity);
|
handleEntity(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnEntityDespawn(Entity entity)
|
public override void OnEntityDespawn(Entity entity)
|
||||||
{
|
{
|
||||||
if (entitiesToAttack.ContainsKey(entity.ID))
|
if (entitiesToAttack.ContainsKey(entity.ID))
|
||||||
|
|
@ -62,6 +64,7 @@ namespace MinecraftClient.ChatBots
|
||||||
entitiesToAttack.Remove(entity.ID);
|
entitiesToAttack.Remove(entity.ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnEntityMove(Entity entity)
|
public override void OnEntityMove(Entity entity)
|
||||||
{
|
{
|
||||||
handleEntity(entity);
|
handleEntity(entity);
|
||||||
|
|
@ -97,7 +100,8 @@ namespace MinecraftClient.ChatBots
|
||||||
|
|
||||||
public void handleEntity(Entity entity)
|
public void handleEntity(Entity entity)
|
||||||
{
|
{
|
||||||
if (!entity.IsHostile()) return;
|
if (!entity.IsHostile())
|
||||||
|
return;
|
||||||
|
|
||||||
bool isBeingAttacked = entitiesToAttack.ContainsKey(entity.ID);
|
bool isBeingAttacked = entitiesToAttack.ContainsKey(entity.ID);
|
||||||
if (GetCurrentLocation().Distance(entity.Location) < attackRange)
|
if (GetCurrentLocation().Distance(entity.Location) < attackRange)
|
||||||
|
|
@ -107,7 +111,8 @@ namespace MinecraftClient.ChatBots
|
||||||
{
|
{
|
||||||
entitiesToAttack.Add(entity.ID, entity);
|
entitiesToAttack.Add(entity.ID, entity);
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// remove marker on entity to attack it, as it is now out of range
|
// remove marker on entity to attack it, as it is now out of range
|
||||||
if (isBeingAttacked)
|
if (isBeingAttacked)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue