From fa0f91aad8b3c7ad4dccf5e7c44fc27e551e1958 Mon Sep 17 00:00:00 2001 From: ORelio Date: Fri, 12 Jun 2020 00:10:57 +0200 Subject: [PATCH] Sugar Cane Miner Improvements by NekiPlay (#1047) --- .../config/ChatBots/SugarCaneMiner.cs | 51 +++++++++++++++++++ .../config/ChatBots/SurgarCaneMiner.cs | 34 ------------- 2 files changed, 51 insertions(+), 34 deletions(-) create mode 100644 MinecraftClient/config/ChatBots/SugarCaneMiner.cs delete mode 100644 MinecraftClient/config/ChatBots/SurgarCaneMiner.cs diff --git a/MinecraftClient/config/ChatBots/SugarCaneMiner.cs b/MinecraftClient/config/ChatBots/SugarCaneMiner.cs new file mode 100644 index 00000000..ad7fdb07 --- /dev/null +++ b/MinecraftClient/config/ChatBots/SugarCaneMiner.cs @@ -0,0 +1,51 @@ +//MCCScript 1.0 + +MCC.LoadBot(new SugarCaneMiner()); + +//MCCScript Extensions + +public class SugarCaneMiner : ChatBot +{ + // === CONFIG - REPLACE SURGAR CANE LOCATION x y z VALUES HERE === + // You need to stand in front of the sugar cane + Location sugarCane = new Location(x, y, z); + bool fullHeight = true; + // === END OF CONFIG === + + public override void Initialize() + { + LogToConsole("Bot enabled!"); + } + + public override void Update() + { + if (DetectSugarCane(sugarCane, fullHeight)) + { + PlayerDigging(0, sugarCane, 1); + Thread.Sleep(1); + PlayerDigging(2, sugarCane, 1); + } + } + + public bool DetectSugarCane(Location sugarCaneLoc, bool fullHeight) + { + Material blockType = GetWorld().GetBlock(sugarCaneLoc).Type; + if (blockType == Material.SugarCane) + { + blockType = GetWorld().GetBlock(new Location(sugarCaneLoc.X, sugarCaneLoc.Y - 1, sugarCaneLoc.Z)).Type; + if (blockType == Material.SugarCane) + { + blockType = GetWorld().GetBlock(new Location(sugarCaneLoc.X, sugarCaneLoc.Y - 2, sugarCaneLoc.Z)).Type; + if (blockType != Material.SugarCane) + { + if (!fullHeight) + return true; + blockType = GetWorld().GetBlock(new Location(sugarCaneLoc.X, sugarCaneLoc.Y + 1, sugarCaneLoc.Z)).Type; + if (blockType == Material.SugarCane) + return true; + } + } + } + return false; + } +} \ No newline at end of file diff --git a/MinecraftClient/config/ChatBots/SurgarCaneMiner.cs b/MinecraftClient/config/ChatBots/SurgarCaneMiner.cs deleted file mode 100644 index d26a0c1f..00000000 --- a/MinecraftClient/config/ChatBots/SurgarCaneMiner.cs +++ /dev/null @@ -1,34 +0,0 @@ -//MCCScript 1.0 - -MCC.LoadBot(new SurgarCaneMiner()); - -//MCCScript Extensions - -public class SurgarCaneMiner : ChatBot -{ - // === CONFIG - REPLACE SURGAR CANE LOCATION x y z VALUES HERE === - // You need to stand in front of the sugar cane - Location SugarCane = new Location(x, y, z); - // === END OF CONFIG === - - public override void Initialize() - { - LogToConsole("Bot enabled!"); - } - - public override void Update() - { - Material blockType = GetWorld().GetBlock(SugarCane).Type; - switch (blockType) - { - case Material.SugarCane: - PlayerDigging(0, SugarCane, 1); - Thread.Sleep(50); - PlayerDigging(2, SugarCane, 1); - break; - default: - - break; - } - } -} \ No newline at end of file