mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
AuotoAttack: add support for multiple interact modes (#2044)
* Adds support for multiple interact modes * Entity interaction: Implement enum Co-authored-by: ORelio <ORelio@users.noreply.github.com>
This commit is contained in:
parent
fd7f79402f
commit
613f52d3ae
8 changed files with 116 additions and 80 deletions
|
|
@ -22,8 +22,9 @@ namespace MinecraftClient.ChatBots
|
|||
private float health = 100;
|
||||
private bool singleMode = true;
|
||||
private bool priorityDistance = true;
|
||||
private InteractType interactMode;
|
||||
|
||||
public AutoAttack(string mode, string priority, bool overrideAttackSpeed = false, double cooldownSeconds = 1)
|
||||
public AutoAttack(string mode, string priority, bool overrideAttackSpeed = false, double cooldownSeconds = 1, InteractType interaction = InteractType.Attack)
|
||||
{
|
||||
if (mode == "single")
|
||||
singleMode = true;
|
||||
|
|
@ -37,6 +38,8 @@ namespace MinecraftClient.ChatBots
|
|||
priorityDistance = false;
|
||||
else LogToConsoleTranslated("bot.autoAttack.priority", priority);
|
||||
|
||||
interactMode = interaction;
|
||||
|
||||
if (overrideAttackSpeed)
|
||||
{
|
||||
if (cooldownSeconds <= 0)
|
||||
|
|
@ -103,7 +106,7 @@ namespace MinecraftClient.ChatBots
|
|||
// check entity distance and health again
|
||||
if (shouldAttackEntity(entitiesToAttack[priorityEntity]))
|
||||
{
|
||||
InteractEntity(priorityEntity, 1); // hit the entity!
|
||||
InteractEntity(priorityEntity, interactMode); // hit the entity!
|
||||
SendAnimation(Inventory.Hand.MainHand); // Arm animation
|
||||
}
|
||||
}
|
||||
|
|
@ -114,7 +117,7 @@ namespace MinecraftClient.ChatBots
|
|||
// check that we are in range once again.
|
||||
if (shouldAttackEntity(entity.Value))
|
||||
{
|
||||
InteractEntity(entity.Key, 1); // hit the entity!
|
||||
InteractEntity(entity.Key, interactMode); // hit the entity!
|
||||
}
|
||||
}
|
||||
SendAnimation(Inventory.Hand.MainHand); // Arm animation
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue