This commit is contained in:
Reinforce Zwei 2020-05-22 08:58:30 +08:00 committed by ORelio
parent a018304f99
commit 06ed5c0a45
2 changed files with 22 additions and 8 deletions

View file

@ -21,6 +21,7 @@ namespace MinecraftClient.ChatBots
private DateTime CaughtTime = DateTime.Now;
private bool inventoryEnabled;
private bool isFishing = false;
private int useItemCounter = 0;
public override void Initialize()
{
@ -33,6 +34,18 @@ namespace MinecraftClient.ChatBots
inventoryEnabled = GetInventoryEnabled();
}
public override void Update()
{
if (useItemCounter > 0)
{
useItemCounter--;
if (useItemCounter <= 0)
{
UseItemInHand();
}
}
}
public override void OnEntitySpawn(Entity entity)
{
if (entity.TypeID == 102)
@ -54,6 +67,10 @@ namespace MinecraftClient.ChatBots
if(entity.ID == fishingRod.ID)
{
isFishing = false;
if (Settings.AutoFishing_Antidespawn)
{
useItemCounter = 5; // 500ms
}
}
}
}
@ -104,14 +121,8 @@ namespace MinecraftClient.ChatBots
return;
}
}
// non-blocking delay
Task.Factory.StartNew(delegate
{
// retract fishing rod need some time
Thread.Sleep(800);
// throw again
UseItemInHand();
});
// thread-safe
useItemCounter = 8; // 800ms
}
/// <summary>

View file

@ -157,6 +157,7 @@ namespace MinecraftClient
//Auto Fishing
public static bool AutoFishing_Enabled = false;
public static bool AutoFishing_Antidespawn = false;
//Auto Eating
public static bool AutoEat_Enabled = false;
@ -477,6 +478,7 @@ namespace MinecraftClient
switch (argName.ToLower())
{
case "enabled": AutoFishing_Enabled = str2bool(argValue); break;
case "antidespawn": AutoFishing_Antidespawn = str2bool(argValue); break;
}
break;
@ -689,6 +691,7 @@ namespace MinecraftClient
+ "[AutoFishing]\r\n"
+ "# Entity Handling NEED to be enabled first\r\n"
+ "enabled=false\r\n"
+ "antidespawn=false\r\n"
+ "\r\n"
+ "[AutoEat]\r\n"
+ "# Inventory Handling NEED to be enabled first\r\n"