Formatted the code and removed logs from Auto Attack

This commit is contained in:
Anon 2026-06-04 11:42:41 +02:00
parent a4ff7ae438
commit c6ca3dc13d
117 changed files with 602 additions and 585 deletions

View file

@ -127,7 +127,7 @@ namespace MinecraftClient.ChatBots
private void DoAntiAfkStuff()
{
var isMovementLocked = BotMovementLock.Instance;
if (Config.Use_Terrain_Handling && GetTerrainEnabled() && isMovementLocked is {IsLocked: false})
if (Config.Use_Terrain_Handling && GetTerrainEnabled() && isMovementLocked is { IsLocked: false })
{
var currentLocation = GetCurrentLocation();

View file

@ -180,12 +180,11 @@ namespace MinecraftClient.ChatBots
if (entitiesToAttack.ContainsKey(priorityEntity))
{
// check entity distance and health again
if (ShouldAttackEntity(entitiesToAttack[priorityEntity]))
{
LogToConsole($"[{DateTime.Now:HH:mm:ss.fff}] Attacking entity {priorityEntity}");
InteractEntity(priorityEntity, Config.Interaction); // hit the entity!
SendAnimation(Inventory.Hand.MainHand); // Arm animation
}
if (ShouldAttackEntity(entitiesToAttack[priorityEntity]))
{
InteractEntity(priorityEntity, Config.Interaction); // hit the entity!
SendAnimation(Inventory.Hand.MainHand); // Arm animation
}
}
@ -194,12 +193,11 @@ namespace MinecraftClient.ChatBots
{
foreach (KeyValuePair<int, Entity> entity in entitiesToAttack)
{
// check that we are in range once again.
if (ShouldAttackEntity(entity.Value))
{
LogToConsole($"[{DateTime.Now:HH:mm:ss.fff}] Attacking entity {entity.Key}");
InteractEntity(entity.Key, Config.Interaction); // hit the entity!
}
// check that we are in range once again.
if (ShouldAttackEntity(entity.Value))
{
InteractEntity(entity.Key, Config.Interaction); // hit the entity!
}
}
SendAnimation(Inventory.Hand.MainHand); // Arm animation

View file

@ -86,7 +86,7 @@ namespace MinecraftClient.ChatBots
public static bool LookForScript(ref string filename)
{
//Automatically look in subfolders and try to add ".txt" file extension
char dir_slash = Path.DirectorySeparatorChar;
char dir_slash = Path.DirectorySeparatorChar;
string[] files = new string[]
{
filename,
@ -213,7 +213,7 @@ namespace MinecraftClient.ChatBots
.ToLower();
processedLine = string.Join("", processedLine.Split(default(string[]), StringSplitOptions.RemoveEmptyEntries));
var parts = processedLine.Contains("to") ? processedLine.Split("to") : processedLine.Split("-");
if (parts.Length == 2)
{
var min = Convert.ToInt32(parts[0]);
@ -224,10 +224,12 @@ namespace MinecraftClient.ChatBots
(min, max) = (max, min);
LogToConsole(Translations.cmd_wait_random_min_bigger);
}
ticks = new Random().Next(min, max);
} else ticks = Convert.ToInt32(instruction_line[5..]);
} else ticks = Convert.ToInt32(instruction_line[5..]);
}
else ticks = Convert.ToInt32(instruction_line[5..]);
}
else ticks = Convert.ToInt32(instruction_line[5..]);
}
catch { }
sleepticks = ticks;

View file

@ -352,7 +352,7 @@ namespace MinecraftClient.ChatBots
replyParameters: message.MessageId,
cancellationToken: _cancellationToken,
parseMode: ParseMode.Markdown);
return;;
return; ;
}
CmdResult result = new();