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:
Booquefius 2022-08-15 17:31:17 -04:00 committed by GitHub
parent fd7f79402f
commit 613f52d3ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 116 additions and 80 deletions

View file

@ -212,7 +212,7 @@ namespace MinecraftClient
if (Settings.ScriptScheduler_Enabled) { BotLoad(new ChatBots.ScriptScheduler(Settings.ExpandVars(Settings.ScriptScheduler_TasksFile))); }
if (Settings.RemoteCtrl_Enabled) { BotLoad(new ChatBots.RemoteControl()); }
if (Settings.AutoRespond_Enabled) { BotLoad(new ChatBots.AutoRespond(Settings.AutoRespond_Matches)); }
if (Settings.AutoAttack_Enabled) { BotLoad(new ChatBots.AutoAttack(Settings.AutoAttack_Mode, Settings.AutoAttack_Priority, Settings.AutoAttack_OverrideAttackSpeed, Settings.AutoAttack_CooldownSeconds)); }
if (Settings.AutoAttack_Enabled) { BotLoad(new ChatBots.AutoAttack(Settings.AutoAttack_Mode, Settings.AutoAttack_Priority, Settings.AutoAttack_OverrideAttackSpeed, Settings.AutoAttack_CooldownSeconds, Settings.AutoAttack_Interaction)); }
if (Settings.AutoFishing_Enabled) { BotLoad(new ChatBots.AutoFishing()); }
if (Settings.AutoEat_Enabled) { BotLoad(new ChatBots.AutoEat(Settings.AutoEat_hungerThreshold)); }
if (Settings.Mailer_Enabled) { BotLoad(new ChatBots.Mailer()); }
@ -1632,23 +1632,23 @@ namespace MinecraftClient
/// Interact with an entity
/// </summary>
/// <param name="EntityID"></param>
/// <param name="type">0: interact, 1: attack, 2: interact at</param>
/// <param name="type">Type of interaction (interact, attack...)</param>
/// <param name="hand">Hand.MainHand or Hand.OffHand</param>
/// <returns>TRUE if interaction succeeded</returns>
public bool InteractEntity(int entityID, int type, Hand hand = Hand.MainHand)
public bool InteractEntity(int entityID, InteractType type, Hand hand = Hand.MainHand)
{
if (InvokeRequired)
return InvokeOnMainThread(() => InteractEntity(entityID, type, hand));
if (entities.ContainsKey(entityID))
{
if (type == 0)
if (type == InteractType.Interact)
{
return handler.SendInteractEntity(entityID, type, (int)hand);
return handler.SendInteractEntity(entityID, (int)type, (int)hand);
}
else
{
return handler.SendInteractEntity(entityID, type);
return handler.SendInteractEntity(entityID, (int)type);
}
}
else return false;