From db6422d154c1df5a6a25dccc08951528dfbf0b05 Mon Sep 17 00:00:00 2001 From: Anon Date: Thu, 30 Mar 2023 21:06:54 +0200 Subject: [PATCH] Partialy fixed interaction with Armor Stand --- MinecraftClient/Commands/Entitycmd.cs | 6 +++++- MinecraftClient/McClient.cs | 24 +++++++++++++++++------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/MinecraftClient/Commands/Entitycmd.cs b/MinecraftClient/Commands/Entitycmd.cs index 7cd4d8b4c0..258227cd18 100644 --- a/MinecraftClient/Commands/Entitycmd.cs +++ b/MinecraftClient/Commands/Entitycmd.cs @@ -314,7 +314,11 @@ private static string InteractionWithEntity(McClient handler, Entity entity, Act handler.InteractEntity(entity.ID, InteractType.Attack); return Translations.cmd_entityCmd_attacked; case ActionType.Use: - handler.InteractEntity(entity.ID, InteractType.Interact); + bool shouldInteractAt = entity.Type == EntityType.ArmorStand || + entity.Type == EntityType.ChestMinecart || + entity.Type == EntityType.ChestBoat; + + handler.InteractEntity(entity.ID, shouldInteractAt ? InteractType.InteractAt : InteractType.Interact); return Translations.cmd_entityCmd_used; case ActionType.List: return GetEntityInfoDetailed(handler, entity); diff --git a/MinecraftClient/McClient.cs b/MinecraftClient/McClient.cs index df2f9cf48c..ba803e8876 100644 --- a/MinecraftClient/McClient.cs +++ b/MinecraftClient/McClient.cs @@ -2195,16 +2195,26 @@ public bool InteractEntity(int entityID, InteractType type, Hand hand = Hand.Mai if (entities.ContainsKey(entityID)) { - if (type == InteractType.Interact) + switch (type) { - return handler.SendInteractEntity(entityID, (int)type, (int)hand); - } - else - { - return handler.SendInteractEntity(entityID, (int)type); + case InteractType.Interact: + return handler.SendInteractEntity(entityID, (int)type, (int)hand); + + case InteractType.InteractAt: + return handler.SendInteractEntity( + EntityID: entityID, + type: (int)type, + X: (float)entities[entityID].Location.X, + Y: (float)entities[entityID].Location.Y, + Z: (float)entities[entityID].Location.Z, + hand: (int)hand); + + default: + return handler.SendInteractEntity(entityID, (int)type); } } - else return false; + + return false; } ///