From 77500deef222de93340e819667be663543eb1a29 Mon Sep 17 00:00:00 2001 From: Milutinke Date: Tue, 11 Oct 2022 22:47:06 +0200 Subject: [PATCH] Added the bot. --- MinecraftClient/ChatBots/Farmer.cs | 664 +++++++++++++++++++++++++++++ MinecraftClient/McClient.cs | 3 +- MinecraftClient/Settings.cs | 44 +- 3 files changed, 691 insertions(+), 20 deletions(-) create mode 100644 MinecraftClient/ChatBots/Farmer.cs diff --git a/MinecraftClient/ChatBots/Farmer.cs b/MinecraftClient/ChatBots/Farmer.cs new file mode 100644 index 00000000..41bd4f48 --- /dev/null +++ b/MinecraftClient/ChatBots/Farmer.cs @@ -0,0 +1,664 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Threading; +using MinecraftClient.Inventory; +using MinecraftClient.Mapping; +using MinecraftClient.Protocol.Handlers; +using Tomlet.Attributes; + +namespace MinecraftClient.ChatBots +{ + enum State + { + SearchingForCropsToBreak = 0, + SearchingForFarmlandToPlant, + PlantingCrops, + BonemealingCrops + } + + enum CropType + { + Beetroot, + Carrot, + Melon, + Netherwart, + Pumpkin, + Potato, + Wheat + } + + public class Farmer : ChatBot + { + public static Configs Config = new(); + + [TomlDoNotInlineObject] + public class Configs + { + [NonSerialized] + private const string BotName = "Farmer"; + + public bool Enabled = false; + + public int Delay_Between_Tasks = 1; + + public void OnSettingUpdate() + { + if (Delay_Between_Tasks <= 0) + Delay_Between_Tasks = 1; + } + } + + private State state = State.SearchingForCropsToBreak; + private CropType cropType = CropType.Wheat; + private int farmingRadius = 30; + private bool running = false; + + public override void Initialize() + { + if (GetProtocolVersion() < Protocol18Handler.MC_1_13_Version) + { + LogToConsole("Not implemented bellow 1.13!"); + return; + } + + if (!GetTerrainEnabled()) + { + LogToConsole("Terrain handling needed!"); + return; + } + + if (!GetInventoryEnabled()) + { + LogToConsole("Inventory handling needed!"); + return; + } + + RegisterChatBotCommand("farmer", "cmd.farmer.desc", "farmer |stop>", OnFarmCommand); + } + + private string OnFarmCommand(string cmd, string[] args) + { + if (args.Length > 0) + { + if (args[0].Equals("stop", StringComparison.OrdinalIgnoreCase)) + { + if (!running) + return Translations.TryGet("cmd.farmer.already_stopped"); + + running = false; + return Translations.TryGet("cmd.farmer.stopping"); + } + + if (args[0].Equals("start", StringComparison.OrdinalIgnoreCase)) + { + if (args.Length == 3) + { + if (running) + return Translations.TryGet("cmd.farmer.already_running"); + + if (!Enum.TryParse(args[1], true, out CropType whatToFarm)) + return Translations.TryGet("cmd.farmer.invalid_crop_type"); + + if (!int.TryParse(args[2], NumberStyles.Any, CultureInfo.CurrentCulture, out int radius)) + return Translations.TryGet("cmd.farmer.invalid_radius"); + + state = State.SearchingForFarmlandToPlant; + cropType = whatToFarm; + farmingRadius = radius <= 0 ? 30 : radius; + + running = true; + new Thread(() => MainPorcess()).Start(); + + return Translations.TryGet("cmd.farmer.staring", args[1], farmingRadius); + } + } + } + + return Translations.TryGet("cmd.farmer.desc") + ": " + Translations.TryGet("cmd.farmer.usage"); + } + + public override void AfterGameJoined() + { + running = false; + } + + public override bool OnDisconnect(DisconnectReason reason, string message) + { + running = false; + return true; + } + + private void MainPorcess() + { + LogToConsole("Started"); + + while (running) + { + // Don't do anything if the bot is currently eating, we wait for 1 second + if (AutoEat.Eating) + { + LogToConsole("Eating."); + Thread.Sleep(Config.Delay_Between_Tasks * 1000); + continue; + } + + switch (state) + { + case State.SearchingForFarmlandToPlant: + LogToConsole("Looking for farmland"); + + // If we don't have any seeds on our hotbar, skip this step and try collecting some + if (!SwitchToItem(GetSeedItemTypeForCropType(cropType))) + { + LogToConsole("No seeds, trying to find some crops to break"); + state = State.SearchingForCropsToBreak; + Thread.Sleep(Config.Delay_Between_Tasks * 1000); + continue; + } + + List farmlandToPlantOn = findEmptyFarmland(farmingRadius); + + if (farmlandToPlantOn.Count == 0) + { + LogToConsole("Could not find any farmland, trying to find some crops to break"); + state = State.SearchingForCropsToBreak; + Thread.Sleep(Config.Delay_Between_Tasks * 1000); + continue; + } + + foreach (Location location in farmlandToPlantOn) + { + if (!running) break; + + double yValue = Math.Floor(location.Y) + 1; + + if (cropType == CropType.Netherwart) + yValue = (double)(Math.Floor(location.Y) - 1.0) + (double)0.87500; + + Location location2 = new Location(Math.Floor(location.X), yValue, Math.Floor(location.Z)); + + if (WaitForMoveToLocation(location2)) + { + LogToConsole("Moving to: " + location2); + + // Stop if we do not have any more seeds left + if (!SwitchToItem(GetSeedItemTypeForCropType(cropType))) + { + LogToConsole("No seeds, trying to find some crops to break"); + break; + } + + Location loc = new Location(Math.Floor(location.X), Math.Floor(location2.Y), Math.Floor(location.Z)); + LogToConsole("Sending placeblock to: " + loc); + + SendPlaceBlock(loc, Direction.Up); + Thread.Sleep(300); + } + else + { + LogToConsole("Can't move to: " + location2); + } + } + + LogToConsole("Finished planting"); + state = State.SearchingForCropsToBreak; + break; + + case State.SearchingForCropsToBreak: + LogToConsole("Searching for crops to break"); + + List cropsToCollect = findCrops(farmingRadius, cropType, true); + + if (cropsToCollect.Count == 0) + { + LogToConsole("No crops to break, trying to bonemeal ungrown ones"); + state = State.BonemealingCrops; + Thread.Sleep(Config.Delay_Between_Tasks * 1000); + continue; + } + + foreach (Location location in cropsToCollect) + { + if (!running) break; + + // God damn C# rounding Y to (Y - 1) + 0.94 + // TODO: Figure out a fix + // new Location(Math.Floor(location.X) + 0.5, (double)((double)(location.Y - 1) + (double)0.93750), Math.Floor(location.Z) + 0.5) + + if (WaitForMoveToLocation(location)) + WaitForDigBlock(location); + + // Allow some time to pickup the item + Thread.Sleep(cropType == CropType.Melon || cropType == CropType.Pumpkin ? 400 : 200); + } + + LogToConsole("Finished breaking crops"); + state = State.BonemealingCrops; + break; + + case State.BonemealingCrops: + // Can't be bonemealed + if (cropType == CropType.Netherwart) + { + state = State.SearchingForFarmlandToPlant; + Thread.Sleep(Config.Delay_Between_Tasks * 1000); + continue; + } + + // If we don't have any bonemeal on our hotbar, skip this step + if (!SwitchToItem(ItemType.BoneMeal)) + { + LogToConsole("No bonemeal, searching for some farmland to plant seeds on"); + state = State.SearchingForFarmlandToPlant; + Thread.Sleep(Config.Delay_Between_Tasks * 1000); + continue; + } + + List cropsToBonemeal = findCrops(farmingRadius, cropType, false); + + if (cropsToBonemeal.Count == 0) + { + LogToConsole("No crops to bonemeal, searching for farmland to plant seeds on"); + state = State.SearchingForFarmlandToPlant; + Thread.Sleep(Config.Delay_Between_Tasks * 1000); + continue; + } + + foreach (Location location in cropsToBonemeal) + { + if (WaitForMoveToLocation(location)) + { + if (!running) break; + + // Stop if we do not have any more bonemeal left + if (!SwitchToItem(ItemType.BoneMeal)) + { + LogToConsole("No bonemeal, searching for some farmland to plant seeds on"); + break; + } + + // Send like 5 bonemeal attempts, it should do the job with 2-3, but sometimes doesn't do + for (int boneMealTimes = 0; boneMealTimes < 4; boneMealTimes++) + { + // TODO: Do a check if the carrot/potato is on the first growth stage + // if so, use: new Location(location.X, (double)(location.Y - 1) + (double)0.93750, location.Z) + SendPlaceBlock(location, Direction.Down); + } + + Thread.Sleep(100); + } + } + + LogToConsole("Finished bonemealing crops"); + state = State.SearchingForFarmlandToPlant; + break; + } + + LogToConsole("Waiting for " + Config.Delay_Between_Tasks + " seconds for next cycle."); + Thread.Sleep(Config.Delay_Between_Tasks * 1000); + } + + LogToConsole("Stopped farming!"); + } + + private Material GetMaterialForCropType(CropType type) + { + switch (type) + { + case CropType.Beetroot: + return Material.Beetroots; + + case CropType.Carrot: + return Material.Carrots; + + case CropType.Melon: + return Material.Melon; + + case CropType.Netherwart: + return Material.NetherWart; + + case CropType.Pumpkin: + return Material.Pumpkin; + + case CropType.Potato: + return Material.Potatoes; + + case CropType.Wheat: + return Material.Wheat; + } + + throw new Exception("Material type for " + type.GetType().Name + " has not been mapped!"); + } + + private ItemType GetSeedItemTypeForCropType(CropType type) + { + switch (type) + { + case CropType.Beetroot: + return ItemType.BeetrootSeeds; + + case CropType.Carrot: + return ItemType.Carrot; + + case CropType.Melon: + return ItemType.MelonSeeds; + + case CropType.Netherwart: + return ItemType.NetherWart; + + case CropType.Pumpkin: + return ItemType.PumpkinSeeds; + + case CropType.Potato: + return ItemType.Potato; + + case CropType.Wheat: + return ItemType.WheatSeeds; + } + + throw new Exception("Seed type for " + type.GetType().Name + " has not been mapped!"); + } + + private List findEmptyFarmland(int radius) + { + return GetWorld() + .FindBlock(GetCurrentLocation(), cropType == CropType.Netherwart ? Material.SoulSand : Material.Farmland, radius) + .Where(location => GetWorld().GetBlock(new Location(location.X, location.Y + 1, location.Z)).Type == Material.Air) + .ToList(); + } + + private List findCrops(int radius, CropType cropType, bool fullyGrown) + { + Material material = GetMaterialForCropType(cropType); + + // A bit of a hack to enable bonemealing melon and pumpkin stems + if (!fullyGrown && (cropType == CropType.Melon || cropType == CropType.Pumpkin)) + material = cropType == CropType.Melon ? Material.MelonStem : Material.PumpkinStem; + + return GetWorld() + .FindBlock(GetCurrentLocation(), material, radius) + .Where(location => + { + if (fullyGrown && (material == Material.Melon || material == Material.Pumpkin)) + return true; + + bool isFullyGrown = IsCropFullyGrown(GetWorld().GetBlock(location), cropType); + return fullyGrown ? isFullyGrown : !isFullyGrown; + }) + .ToList(); + } + + private bool IsCropFullyGrown(Block block, CropType cropType) + { + int protocolVersion = GetProtocolVersion(); + + switch (cropType) + { + case CropType.Beetroot: + if (protocolVersion >= Protocol18Handler.MC_1_19_Version && protocolVersion <= Protocol18Handler.MC_1_19_2_Version) + { + if (block.BlockId == 10103) + return true; + } + else if (protocolVersion >= Protocol18Handler.MC_1_17_Version && protocolVersion <= Protocol18Handler.MC_1_18_2_Version) + { + if (block.BlockId == 9472) + return true; + } + else if (protocolVersion >= Protocol18Handler.MC_1_16_Version && protocolVersion <= Protocol18Handler.MC_1_16_5_Version) + { + if (block.BlockId == 9226) + return true; + } + else if (protocolVersion >= Protocol18Handler.MC_1_14_Version && protocolVersion <= Protocol18Handler.MC_1_15_2_Version) + { + if (block.BlockId == 8686) + return true; + } + else if (protocolVersion >= Protocol18Handler.MC_1_13_Version && protocolVersion < Protocol18Handler.MC_1_14_Version) + { + if (block.BlockId == 8162) + return true; + } + + break; + + case CropType.Carrot: + if (protocolVersion >= Protocol18Handler.MC_1_19_Version && protocolVersion <= Protocol18Handler.MC_1_19_2_Version) + { + if (block.BlockId == 6930) + return true; + } + else if (protocolVersion >= Protocol18Handler.MC_1_17_Version && protocolVersion <= Protocol18Handler.MC_1_18_2_Version) + { + if (block.BlockId == 6543) + return true; + } + else if (protocolVersion >= Protocol18Handler.MC_1_16_Version && protocolVersion <= Protocol18Handler.MC_1_16_5_Version) + { + if (block.BlockId == 6341) + return true; + } + else if (protocolVersion >= Protocol18Handler.MC_1_14_Version && protocolVersion <= Protocol18Handler.MC_1_15_2_Version) + { + if (block.BlockId == 5801) + return true; + } + else if (protocolVersion >= Protocol18Handler.MC_1_13_Version && protocolVersion < Protocol18Handler.MC_1_14_Version) + { + if (block.BlockId == 5295) + return true; + } + + break; + + // Checkin for stems and attached stems instead of Melons themselves + case CropType.Melon: + if (protocolVersion >= Protocol18Handler.MC_1_19_Version && protocolVersion <= Protocol18Handler.MC_1_19_2_Version) + { + if (block.BlockId == 5166 || block.BlockId == 5150) + return true; + } + else if (protocolVersion >= Protocol18Handler.MC_1_17_Version && protocolVersion <= Protocol18Handler.MC_1_18_2_Version) + { + if (block.BlockId == 4860 || block.BlockId == 4844) + return true; + } + else if (protocolVersion >= Protocol18Handler.MC_1_16_Version && protocolVersion <= Protocol18Handler.MC_1_16_5_Version) + { + if (block.BlockId == 4791 || block.BlockId == 4775) + return true; + } + else if (protocolVersion >= Protocol18Handler.MC_1_14_Version && protocolVersion <= Protocol18Handler.MC_1_15_2_Version) + { + if (block.BlockId == 4771 || block.BlockId == 4755) + return true; + } + else if (protocolVersion >= Protocol18Handler.MC_1_13_Version && protocolVersion < Protocol18Handler.MC_1_14_Version) + { + if (block.BlockId == 4268 || block.BlockId == 4252) + return true; + } + break; + + // Checkin for stems and attached stems instead of Melons themselves + case CropType.Netherwart: + if (protocolVersion >= Protocol18Handler.MC_1_19_Version && protocolVersion <= Protocol18Handler.MC_1_19_2_Version) + { + if (block.BlockId == 5718) + return true; + } + else if (protocolVersion >= Protocol18Handler.MC_1_17_Version && protocolVersion <= Protocol18Handler.MC_1_18_2_Version) + { + if (block.BlockId == 5332) + return true; + } + else if (protocolVersion >= Protocol18Handler.MC_1_16_Version && protocolVersion <= Protocol18Handler.MC_1_16_5_Version) + { + if (block.BlockId == 5135) + return true; + } + else if (protocolVersion >= Protocol18Handler.MC_1_14_Version && protocolVersion <= Protocol18Handler.MC_1_15_2_Version) + { + if (block.BlockId == 5115) + return true; + } + else if (protocolVersion >= Protocol18Handler.MC_1_13_Version && protocolVersion < Protocol18Handler.MC_1_14_Version) + { + if (block.BlockId == 4612) + return true; + } + break; + + // Checkin for stems and attached stems instead of Pumpkins themselves + case CropType.Pumpkin: + if (protocolVersion >= Protocol18Handler.MC_1_19_Version && protocolVersion <= Protocol18Handler.MC_1_19_2_Version) + { + if (block.BlockId == 5158 || block.BlockId == 5146) + return true; + } + else if (protocolVersion >= Protocol18Handler.MC_1_17_Version && protocolVersion <= Protocol18Handler.MC_1_18_2_Version) + { + if (block.BlockId == 4852 || block.BlockId == 4840) + return true; + } + else if (protocolVersion >= Protocol18Handler.MC_1_16_Version && protocolVersion <= Protocol18Handler.MC_1_16_5_Version) + { + if (block.BlockId == 4783 || block.BlockId == 4771) + return true; + } + else if (protocolVersion >= Protocol18Handler.MC_1_14_Version && protocolVersion <= Protocol18Handler.MC_1_15_2_Version) + { + if (block.BlockId == 4763 || block.BlockId == 4751) + return true; + } + else if (protocolVersion >= Protocol18Handler.MC_1_13_Version && protocolVersion < Protocol18Handler.MC_1_14_Version) + { + if (block.BlockId == 4260 || block.BlockId == 4248) + return true; + } + break; + + case CropType.Potato: + if (protocolVersion >= Protocol18Handler.MC_1_19_Version && protocolVersion <= Protocol18Handler.MC_1_19_2_Version) + { + if (block.BlockId == 6938) + return true; + } + else if (protocolVersion >= Protocol18Handler.MC_1_17_Version && protocolVersion <= Protocol18Handler.MC_1_18_2_Version) + { + if (block.BlockId == 6551) + return true; + } + else if (protocolVersion >= Protocol18Handler.MC_1_16_Version && protocolVersion <= Protocol18Handler.MC_1_16_5_Version) + { + if (block.BlockId == 6349) + return true; + } + else if (protocolVersion >= Protocol18Handler.MC_1_14_Version && protocolVersion <= Protocol18Handler.MC_1_15_2_Version) + { + if (block.BlockId == 5809) + return true; + } + else if (protocolVersion >= Protocol18Handler.MC_1_13_Version && protocolVersion < Protocol18Handler.MC_1_14_Version) + { + if (block.BlockId == 5303) + return true; + } + + break; + + case CropType.Wheat: + if (protocolVersion >= Protocol18Handler.MC_1_19_Version && protocolVersion <= Protocol18Handler.MC_1_19_2_Version) + { + if (block.BlockId == 3619) + return true; + } + else if (protocolVersion >= Protocol18Handler.MC_1_17_Version && protocolVersion <= Protocol18Handler.MC_1_18_2_Version) + { + if (block.BlockId == 3421) + return true; + } + else if (protocolVersion >= Protocol18Handler.MC_1_16_Version && protocolVersion <= Protocol18Handler.MC_1_16_5_Version) + { + if (block.BlockId == 3364) + return true; + } + else if (protocolVersion >= Protocol18Handler.MC_1_14_Version && protocolVersion <= Protocol18Handler.MC_1_15_2_Version) + { + if (block.BlockId == 3362) + return true; + } + else if (protocolVersion >= Protocol18Handler.MC_1_13_Version && protocolVersion < Protocol18Handler.MC_1_14_Version) + { + if (block.BlockId == 3059) + return true; + } + + break; + } + + return false; + } + + // Yoinked from ReinforceZwei's AutoTree + // TODO: Rewrite to support the whole inventory and moving to the hotbar + public bool SwitchToItem(ItemType itemType) + { + Container playerInventory = GetPlayerInventory(); + + if (playerInventory.Items.ContainsKey(GetCurrentSlot() - 36) + && playerInventory.Items[GetCurrentSlot() - 36].Type == itemType) + return true; // Already selected + + // Search for the seed in the hotbar + List result = new List(playerInventory.SearchItem(itemType)) + .Where(slot => slot >= 36 && slot <= 44) + .ToList(); + + if (result.Count <= 0) + return false; + + ChangeSlot((short)(result[0] - 36)); + return true; + } + + // Yoinked from Daenges's Sugarcane Farmer + private bool WaitForMoveToLocation(Location pos, float tolerance = 2f) + { + if (MoveToLocation(pos)) + { + LogToConsole("Moving to: " + pos); + + while (GetCurrentLocation().Distance(pos) > tolerance) + Thread.Sleep(200); + + return true; + } + else LogToConsole("Can't move to: " + pos); + + return false; + } + + // Yoinked from Daenges's Sugarcane Farmer + private bool WaitForDigBlock(Location block, int digTimeout = 1000) + { + if (DigBlock(block.ToFloor())) + { + short i = 0; // Maximum wait time of 10 sec. + while (GetWorld().GetBlock(block).Type != Material.Air && i <= digTimeout) + { + Thread.Sleep(100); + i++; + } + + return i <= digTimeout; + } + + return false; + } + } +} diff --git a/MinecraftClient/McClient.cs b/MinecraftClient/McClient.cs index c70ecb5c..1618b464 100644 --- a/MinecraftClient/McClient.cs +++ b/MinecraftClient/McClient.cs @@ -223,7 +223,7 @@ namespace MinecraftClient return; - Retry: + Retry: if (timeoutdetector != null) { timeoutdetector.Item2.Cancel(); @@ -263,6 +263,7 @@ namespace MinecraftClient if (Config.ChatBot.AutoRelog.Enabled) { BotLoad(new AutoRelog()); } if (Config.ChatBot.AutoRespond.Enabled) { BotLoad(new AutoRespond()); } if (Config.ChatBot.ChatLog.Enabled) { BotLoad(new ChatLog()); } + if (Config.ChatBot.Farmer.Enabled) { BotLoad(new Farmer()); } if (Config.ChatBot.FollowPlayer.Enabled) { BotLoad(new FollowPlayer()); } if (Config.ChatBot.HangmanGame.Enabled) { BotLoad(new HangmanGame()); } if (Config.ChatBot.Mailer.Enabled) { BotLoad(new Mailer()); } diff --git a/MinecraftClient/Settings.cs b/MinecraftClient/Settings.cs index 51041b96..aada22b7 100644 --- a/MinecraftClient/Settings.cs +++ b/MinecraftClient/Settings.cs @@ -242,16 +242,16 @@ namespace MinecraftClient { switch (positionalIndex) { - case 0: + case 0: Config.Main.General.Account.Login = argument; break; - case 1: - InternalConfig.Password = argument; + case 1: + InternalConfig.Password = argument; break; - case 2: - Config.Main.SetServerIP(new MainConfig.ServerInfoConfig(argument), true); + case 2: + Config.Main.SetServerIP(new MainConfig.ServerInfoConfig(argument), true); break; - case 3: + case 3: // SingleCommand = argument; break; } @@ -269,7 +269,7 @@ namespace MinecraftClient { [TomlProperty("Current Version")] public string CurrentVersion { get; set; } = Program.BuildInfo ?? "Development Build"; - + [TomlProperty("Latest Version")] public string LatestVersion { get; set; } = "Unknown"; @@ -297,15 +297,15 @@ namespace MinecraftClient [NonSerialized] public static readonly string[] AvailableLang = { - "af_za", "ar_sa", "ast_es", "az_az", "ba_ru", "bar", "be_by", "bg_bg", "br_fr", "brb", "bs_ba", "ca_es", - "cs_cz", "cy_gb", "da_dk", "de_at", "de_ch", "de_de", "el_gr", "en_au", "en_ca", "en_gb", "en_nz", "eo_uy", - "es_ar", "es_cl", "es_ec", "es_es", "es_mx", "es_uy", "es_ve", "esan", "et_ee", "eu_es", "fa_ir", "fi_fi", - "fil_ph", "fo_fo", "fr_ca", "fr_fr", "fra_de", "fur_it", "fy_nl", "ga_ie", "gd_gb", "gl_es", "haw_us", "he_il", - "hi_in", "hr_hr", "hu_hu", "hy_am", "id_id", "ig_ng", "io_en", "is_is", "isv", "it_it", "ja_jp", "jbo_en", - "ka_ge", "kk_kz", "kn_in", "ko_kr", "ksh", "kw_gb", "la_la", "lb_lu", "li_li", "lmo", "lt_lt", "lv_lv", "lzh", - "mk_mk", "mn_mn", "ms_my", "mt_mt", "nds_de", "nl_be", "nl_nl", "nn_no", "oc_fr", "ovd", "pl_pl", "pt_br", - "pt_pt", "qya_aa", "ro_ro", "rpr", "ru_ru", "se_no", "sk_sk", "sl_si", "so_so", "sq_al", "sr_sp", "sv_se", - "sxu", "szl", "ta_in", "th_th", "tl_ph", "tlh_aa", "tok", "tr_tr", "tt_ru", "uk_ua", "val_es", "vec_it", + "af_za", "ar_sa", "ast_es", "az_az", "ba_ru", "bar", "be_by", "bg_bg", "br_fr", "brb", "bs_ba", "ca_es", + "cs_cz", "cy_gb", "da_dk", "de_at", "de_ch", "de_de", "el_gr", "en_au", "en_ca", "en_gb", "en_nz", "eo_uy", + "es_ar", "es_cl", "es_ec", "es_es", "es_mx", "es_uy", "es_ve", "esan", "et_ee", "eu_es", "fa_ir", "fi_fi", + "fil_ph", "fo_fo", "fr_ca", "fr_fr", "fra_de", "fur_it", "fy_nl", "ga_ie", "gd_gb", "gl_es", "haw_us", "he_il", + "hi_in", "hr_hr", "hu_hu", "hy_am", "id_id", "ig_ng", "io_en", "is_is", "isv", "it_it", "ja_jp", "jbo_en", + "ka_ge", "kk_kz", "kn_in", "ko_kr", "ksh", "kw_gb", "la_la", "lb_lu", "li_li", "lmo", "lt_lt", "lv_lv", "lzh", + "mk_mk", "mn_mn", "ms_my", "mt_mt", "nds_de", "nl_be", "nl_nl", "nn_no", "oc_fr", "ovd", "pl_pl", "pt_br", + "pt_pt", "qya_aa", "ro_ro", "rpr", "ru_ru", "se_no", "sk_sk", "sl_si", "so_so", "sq_al", "sr_sp", "sv_se", + "sxu", "szl", "ta_in", "th_th", "tl_ph", "tlh_aa", "tok", "tr_tr", "tt_ru", "uk_ua", "val_es", "vec_it", "vi_vn", "yi_de", "yo_ng", "zh_cn", "zh_hk", "zh_tw", "zlm_arab" }; @@ -734,7 +734,7 @@ namespace MinecraftClient } else { - return false; + return false; } } @@ -783,7 +783,7 @@ namespace MinecraftClient /// A IDictionary containing a name and a vlaue key pairs of variables public Dictionary GetVariables() { - Dictionary res = new(VarObject); + Dictionary res = new(VarObject); foreach ((string varName, string varData) in VarStirng) res.Add(varName, varData); return res; @@ -1038,6 +1038,12 @@ namespace MinecraftClient set { ChatBots.ChatLog.Config = value; ChatBots.ChatLog.Config.OnSettingUpdate(); } } + public ChatBots.Farmer.Configs Farmer + { + get { return ChatBots.Farmer.Config; } + set { ChatBots.Farmer.Config = value; ChatBots.Farmer.Config.OnSettingUpdate(); } + } + [TomlPrecedingComment("$config.ChatBot.FollowPlayer$")] public ChatBots.FollowPlayer.Configs FollowPlayer { @@ -1212,7 +1218,7 @@ namespace MinecraftClient }; } } - + public static class BrandInfoTypeExtensions { public static string? ToBrandString(this BrandInfoType info)