Added slab handling for 1.20/.1

Added Farm bot crops handling for 1.20/.1
Added utilities for Containers/Inventories
Added bot movement lock to prevent multiple bots that use movements from running at the same time.
General code improvements.
This commit is contained in:
Anon 2023-06-23 16:25:18 +02:00
parent 497a1174de
commit 272900d52e
11 changed files with 941 additions and 797 deletions

View file

@ -0,0 +1,35 @@
namespace MinecraftClient.Scripting;
public class BotMovementLock
{
private static BotMovementLock? InstancePrivate;
private string _heldBy = string.Empty;
private BotMovementLock()
{
InstancePrivate = this;
}
public static BotMovementLock? Instance => InstancePrivate ??= new BotMovementLock();
public bool Lock(string owner)
{
if (owner.Trim().Length == 0 || _heldBy.Length > 0)
return false;
_heldBy = owner.Trim();
return true;
}
public bool UnLock(string owner)
{
if (owner.Trim().Length == 0 || _heldBy.Length == 0 || !_heldBy.ToLower().Equals(owner.ToLower().Trim()))
return false;
_heldBy = string.Empty;
return true;
}
public bool IsLocked => _heldBy.Length > 0;
public string LockedBy => _heldBy;
}