mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Add Location_Order config for AutoDig
This commit is contained in:
parent
c57ac183d5
commit
2f5914dd6f
5 changed files with 42 additions and 9 deletions
|
|
@ -1,14 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics.Metrics;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using MinecraftClient.Inventory;
|
|
||||||
using MinecraftClient.Mapping;
|
using MinecraftClient.Mapping;
|
||||||
using MinecraftClient.Mapping.BlockPalettes;
|
|
||||||
using Tomlet.Attributes;
|
using Tomlet.Attributes;
|
||||||
using static MinecraftClient.ChatBots.AutoCraft.Configs;
|
|
||||||
|
|
||||||
namespace MinecraftClient.ChatBots
|
namespace MinecraftClient.ChatBots
|
||||||
{
|
{
|
||||||
|
|
@ -42,6 +36,9 @@ namespace MinecraftClient.ChatBots
|
||||||
[TomlInlineComment("$config.ChatBot.AutoDig.Locations$")]
|
[TomlInlineComment("$config.ChatBot.AutoDig.Locations$")]
|
||||||
public Coordination[] Locations = new Coordination[] { new(123.5, 64, 234.5), new(124.5, 63, 235.5) };
|
public Coordination[] Locations = new Coordination[] { new(123.5, 64, 234.5), new(124.5, 63, 235.5) };
|
||||||
|
|
||||||
|
[TomlInlineComment("$config.ChatBot.AutoDig.Location_Order$")]
|
||||||
|
public OrderType Location_Order = OrderType.distance;
|
||||||
|
|
||||||
[TomlInlineComment("$config.ChatBot.AutoDig.Auto_Start_Delay$")]
|
[TomlInlineComment("$config.ChatBot.AutoDig.Auto_Start_Delay$")]
|
||||||
public double Auto_Start_Delay = 3.0;
|
public double Auto_Start_Delay = 3.0;
|
||||||
|
|
||||||
|
|
@ -76,6 +73,8 @@ namespace MinecraftClient.ChatBots
|
||||||
|
|
||||||
public enum ListType { blacklist, whitelist };
|
public enum ListType { blacklist, whitelist };
|
||||||
|
|
||||||
|
public enum OrderType { distance, index };
|
||||||
|
|
||||||
public struct Coordination
|
public struct Coordination
|
||||||
{
|
{
|
||||||
public double x, y, z;
|
public double x, y, z;
|
||||||
|
|
@ -146,7 +145,6 @@ namespace MinecraftClient.ChatBots
|
||||||
else return GetHelp();
|
else return GetHelp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void StartDigging()
|
private void StartDigging()
|
||||||
{
|
{
|
||||||
if (Config.Auto_Start_Delay > 0)
|
if (Config.Auto_Start_Delay > 0)
|
||||||
|
|
@ -280,7 +278,7 @@ namespace MinecraftClient.ChatBots
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Config.Mode == Configs.ModeType.fixedpos)
|
else if (Config.Mode == Configs.ModeType.fixedpos && Config.Location_Order == Configs.OrderType.distance)
|
||||||
{
|
{
|
||||||
Location current = GetCurrentLocation();
|
Location current = GetCurrentLocation();
|
||||||
|
|
||||||
|
|
@ -330,6 +328,39 @@ namespace MinecraftClient.ChatBots
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (Config.Mode == Configs.ModeType.fixedpos && Config.Location_Order == Configs.OrderType.index)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < Config._Locations.Length; ++i)
|
||||||
|
{
|
||||||
|
Location blockLoc = Config._Locations[i];
|
||||||
|
Block block = GetWorld().GetBlock(blockLoc);
|
||||||
|
if (block.Type != Material.Air &&
|
||||||
|
((Config.List_Type == Configs.ListType.whitelist && Config.Blocks.Contains(block.Type)) ||
|
||||||
|
(Config.List_Type == Configs.ListType.blacklist && !Config.Blocks.Contains(block.Type))))
|
||||||
|
{
|
||||||
|
if (DigBlock(blockLoc, lookAtBlock: true))
|
||||||
|
{
|
||||||
|
currentDig = blockLoc;
|
||||||
|
if (Config.Log_Block_Dig)
|
||||||
|
LogToConsole(Translations.Get("cmd.dig.dig", blockLoc.X, blockLoc.Y, blockLoc.Z, block.Type));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogToConsole(Translations.Get("cmd.dig.fail"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!AlreadyWaitting)
|
||||||
|
{
|
||||||
|
AlreadyWaitting = true;
|
||||||
|
if (Config.Log_Block_Dig)
|
||||||
|
LogToConsole(Translations.Get("cmd.dig.no_block"));
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -805,6 +805,7 @@ config.ChatBot.AutoDig.Durability_Limit=Will not use tools with less durability
|
||||||
config.ChatBot.AutoDig.Drop_Low_Durability_Tools=Whether to drop the current tool when its durability is too low.
|
config.ChatBot.AutoDig.Drop_Low_Durability_Tools=Whether to drop the current tool when its durability is too low.
|
||||||
config.ChatBot.AutoDig.Mode="lookat", "fixedpos" or "both". Digging the block being looked at, the block in a fixed position, or the block that needs to be all met.
|
config.ChatBot.AutoDig.Mode="lookat", "fixedpos" or "both". Digging the block being looked at, the block in a fixed position, or the block that needs to be all met.
|
||||||
config.ChatBot.AutoDig.Locations=The position of the blocks when using "fixedpos" or "both" mode.
|
config.ChatBot.AutoDig.Locations=The position of the blocks when using "fixedpos" or "both" mode.
|
||||||
|
config.ChatBot.AutoDig.Location_Order="distance" or "index", When using the "fixedpos" mode, the blocks are determined by distance to the player, or by the order in the list.
|
||||||
config.ChatBot.AutoDig.Auto_Start_Delay=How many seconds to wait after entering the game to start digging automatically, set to -1 to disable automatic start.
|
config.ChatBot.AutoDig.Auto_Start_Delay=How many seconds to wait after entering the game to start digging automatically, set to -1 to disable automatic start.
|
||||||
config.ChatBot.AutoDig.Dig_Timeout=Mining a block for more than "Dig_Timeout" seconds will be considered a timeout.
|
config.ChatBot.AutoDig.Dig_Timeout=Mining a block for more than "Dig_Timeout" seconds will be considered a timeout.
|
||||||
config.ChatBot.AutoDig.Log_Block_Dig=Whether to output logs when digging blocks.
|
config.ChatBot.AutoDig.Log_Block_Dig=Whether to output logs when digging blocks.
|
||||||
|
|
|
||||||
|
|
@ -805,6 +805,7 @@ config.ChatBot.AutoDig.Durability_Limit=不会使用低于此耐久度的工具
|
||||||
config.ChatBot.AutoDig.Drop_Low_Durability_Tools=在当前使用的工具耐久度过低后,是否丢掉它。
|
config.ChatBot.AutoDig.Drop_Low_Durability_Tools=在当前使用的工具耐久度过低后,是否丢掉它。
|
||||||
config.ChatBot.AutoDig.Mode="lookat","fixedpos" 或 "both"。挖掘看向的方块还是固定位置的方块,或者是两个条件都满足的方块。
|
config.ChatBot.AutoDig.Mode="lookat","fixedpos" 或 "both"。挖掘看向的方块还是固定位置的方块,或者是两个条件都满足的方块。
|
||||||
config.ChatBot.AutoDig.Locations=使用 "fixedpos" 或 "both" 模式时,方块的坐标。
|
config.ChatBot.AutoDig.Locations=使用 "fixedpos" 或 "both" 模式时,方块的坐标。
|
||||||
|
config.ChatBot.AutoDig.Location_Order="distance" 或 "index",当使用 "fixedpos" 模式时,按照到玩家的距离,还是列表中的顺序确定挖掘的方块。
|
||||||
config.ChatBot.AutoDig.Auto_Start_Delay=进入游戏后等待多少秒后开始自动挖掘,设置为-1禁用自动开始。
|
config.ChatBot.AutoDig.Auto_Start_Delay=进入游戏后等待多少秒后开始自动挖掘,设置为-1禁用自动开始。
|
||||||
config.ChatBot.AutoDig.Dig_Timeout=若挖掘一个方块用时超过这个值,将会重新获取目标进行挖掘。
|
config.ChatBot.AutoDig.Dig_Timeout=若挖掘一个方块用时超过这个值,将会重新获取目标进行挖掘。
|
||||||
config.ChatBot.AutoDig.Log_Block_Dig=是否输出挖掘方块的相关信息。
|
config.ChatBot.AutoDig.Log_Block_Dig=是否输出挖掘方块的相关信息。
|
||||||
|
|
|
||||||
|
|
@ -805,6 +805,7 @@ config.ChatBot.AutoDig.Durability_Limit=不會使用低於此耐久度的工具
|
||||||
config.ChatBot.AutoDig.Drop_Low_Durability_Tools=在當前使用的工具耐久度過低後,是否丟掉它。
|
config.ChatBot.AutoDig.Drop_Low_Durability_Tools=在當前使用的工具耐久度過低後,是否丟掉它。
|
||||||
config.ChatBot.AutoDig.Mode="lookat","fixedpos" 或 "both"。挖掘看向的方塊還是固定位置的方塊,或者是兩個條件都滿足的方塊。
|
config.ChatBot.AutoDig.Mode="lookat","fixedpos" 或 "both"。挖掘看向的方塊還是固定位置的方塊,或者是兩個條件都滿足的方塊。
|
||||||
config.ChatBot.AutoDig.Locations=使用 "fixedpos" 或 "both" 模式時,方塊的座標。
|
config.ChatBot.AutoDig.Locations=使用 "fixedpos" 或 "both" 模式時,方塊的座標。
|
||||||
|
config.ChatBot.AutoDig.Location_Order="distance" 或 "index",當使用 "fixedpos" 模式時,按照到玩家的距離,還是列表中的順序確定挖掘的方塊。
|
||||||
config.ChatBot.AutoDig.Auto_Start_Delay=進入遊戲後等待多少秒後開始自動挖掘,設定為-1禁用自動開始。
|
config.ChatBot.AutoDig.Auto_Start_Delay=進入遊戲後等待多少秒後開始自動挖掘,設定為-1禁用自動開始。
|
||||||
config.ChatBot.AutoDig.Dig_Timeout=若挖掘一個方塊用時超過這個值,將會重新獲取目標進行挖掘。
|
config.ChatBot.AutoDig.Dig_Timeout=若挖掘一個方塊用時超過這個值,將會重新獲取目標進行挖掘。
|
||||||
config.ChatBot.AutoDig.Log_Block_Dig=是否輸出挖掘方塊的相關資訊。
|
config.ChatBot.AutoDig.Log_Block_Dig=是否輸出挖掘方塊的相關資訊。
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue