Configurable to start fishing automatically or not

This commit is contained in:
BruceChen 2022-09-12 23:15:57 +08:00
parent 99ea0d8997
commit dac60200e0
3 changed files with 30 additions and 8 deletions

View file

@ -58,12 +58,22 @@ namespace MinecraftClient.ChatBots
private void StartFishing()
{
isFishing = false;
double delay = Settings.AutoFishing_FishingDelay;
LogToConsole(Translations.Get("bot.autoFish.start", delay));
lock (stateLock)
if (Settings.AutoFishing_AutoStart)
{
counter = (int)(delay * 10);
state = FishingState.StartMove;
double delay = Settings.AutoFishing_FishingDelay;
LogToConsole(Translations.Get("bot.autoFish.start", delay));
lock (stateLock)
{
counter = (int)(delay * 10);
state = FishingState.StartMove;
}
}
else
{
lock (stateLock)
{
state = FishingState.WaitJoinGame;
}
}
}
@ -129,8 +139,16 @@ namespace MinecraftClient.ChatBots
double[,]? locationList = Settings.AutoFishing_Location;
if (locationList != null)
{
UpdateLocation(locationList);
state = FishingState.WaitingMovement;
if (GetTerrainEnabled())
{
UpdateLocation(locationList);
state = FishingState.WaitingMovement;
}
else
{
LogToConsole(Translations.Get("extra.terrainandmovement_required"));
state = FishingState.WaitJoinGame;
}
}
else
{
@ -274,6 +292,7 @@ namespace MinecraftClient.ChatBots
state = FishingState.StartMove;
}
}
private void UpdateLocation(double[,] locationList)
{
if (curLocationIdx >= locationList.GetLength(0))
@ -336,7 +355,6 @@ namespace MinecraftClient.ChatBots
curLocationIdx += moveDir;
}
private bool DurabilityCheck()
{
if (!inventoryEnabled)