mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Updated Farm bot to work on 1.19.3/4
Updated Farm bot to work on 1.19.3/4
This commit is contained in:
commit
78f5d246f9
3 changed files with 111 additions and 31 deletions
|
|
@ -571,7 +571,17 @@ namespace MinecraftClient.ChatBots
|
|||
switch (cropType)
|
||||
{
|
||||
case CropType.Beetroot:
|
||||
if (protocolVersion >= Protocol18Handler.MC_1_19_Version && protocolVersion <= Protocol18Handler.MC_1_19_2_Version)
|
||||
if (protocolVersion == Protocol18Handler.MC_1_19_4_Version)
|
||||
{
|
||||
if (block.BlockId == 12356)
|
||||
return true;
|
||||
}
|
||||
else if (protocolVersion == Protocol18Handler.MC_1_19_3_Version)
|
||||
{
|
||||
if (block.BlockId == 11887)
|
||||
return true;
|
||||
}
|
||||
else if (protocolVersion >= Protocol18Handler.MC_1_19_Version && protocolVersion <= Protocol18Handler.MC_1_19_2_Version)
|
||||
{
|
||||
if (block.BlockId == 10103)
|
||||
return true;
|
||||
|
|
@ -600,7 +610,17 @@ namespace MinecraftClient.ChatBots
|
|||
break;
|
||||
|
||||
case CropType.Carrot:
|
||||
if (protocolVersion >= Protocol18Handler.MC_1_19_Version && protocolVersion <= Protocol18Handler.MC_1_19_2_Version)
|
||||
if (protocolVersion == Protocol18Handler.MC_1_19_4_Version)
|
||||
{
|
||||
if (block.BlockId == 8598)
|
||||
return true;
|
||||
}
|
||||
else if (protocolVersion == Protocol18Handler.MC_1_19_3_Version)
|
||||
{
|
||||
if (block.BlockId == 8370)
|
||||
return true;
|
||||
}
|
||||
else if (protocolVersion >= Protocol18Handler.MC_1_19_Version && protocolVersion <= Protocol18Handler.MC_1_19_2_Version)
|
||||
{
|
||||
if (block.BlockId == 6930)
|
||||
return true;
|
||||
|
|
@ -630,7 +650,17 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
// 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 (protocolVersion == Protocol18Handler.MC_1_19_4_Version)
|
||||
{
|
||||
if (block.BlockId == 6808 || block.BlockId == 6606)
|
||||
return true;
|
||||
}
|
||||
else if (protocolVersion == Protocol18Handler.MC_1_19_3_Version)
|
||||
{
|
||||
if (block.BlockId == 6582 || block.BlockId == 6832)
|
||||
return true;
|
||||
}
|
||||
else if (protocolVersion >= Protocol18Handler.MC_1_19_Version && protocolVersion <= Protocol18Handler.MC_1_19_2_Version)
|
||||
{
|
||||
if (block.BlockId == 5166 || block.BlockId == 5150)
|
||||
return true;
|
||||
|
|
@ -657,9 +687,18 @@ namespace MinecraftClient.ChatBots
|
|||
}
|
||||
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 (protocolVersion == Protocol18Handler.MC_1_19_4_Version)
|
||||
{
|
||||
if (block.BlockId == 7384)
|
||||
return true;
|
||||
}
|
||||
else if (protocolVersion == Protocol18Handler.MC_1_19_3_Version)
|
||||
{
|
||||
if (block.BlockId == 7158)
|
||||
return true;
|
||||
}
|
||||
else if (protocolVersion >= Protocol18Handler.MC_1_19_Version && protocolVersion <= Protocol18Handler.MC_1_19_2_Version)
|
||||
{
|
||||
if (block.BlockId == 5718)
|
||||
return true;
|
||||
|
|
@ -688,7 +727,17 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
// 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 (protocolVersion == Protocol18Handler.MC_1_19_4_Version)
|
||||
{
|
||||
if (block.BlockId == 5845 || block.BlockId == 6824)
|
||||
return true;
|
||||
}
|
||||
else if (protocolVersion == Protocol18Handler.MC_1_19_3_Version)
|
||||
{
|
||||
if (block.BlockId == 5683 || block.BlockId == 6598)
|
||||
return true;
|
||||
}
|
||||
else if (protocolVersion >= Protocol18Handler.MC_1_19_Version && protocolVersion <= Protocol18Handler.MC_1_19_2_Version)
|
||||
{
|
||||
if (block.BlockId == 5158 || block.BlockId == 5146)
|
||||
return true;
|
||||
|
|
@ -716,7 +765,17 @@ namespace MinecraftClient.ChatBots
|
|||
break;
|
||||
|
||||
case CropType.Potato:
|
||||
if (protocolVersion >= Protocol18Handler.MC_1_19_Version && protocolVersion <= Protocol18Handler.MC_1_19_2_Version)
|
||||
if (protocolVersion == Protocol18Handler.MC_1_19_4_Version)
|
||||
{
|
||||
if (block.BlockId == 8606)
|
||||
return true;
|
||||
}
|
||||
else if (protocolVersion == Protocol18Handler.MC_1_19_3_Version)
|
||||
{
|
||||
if (block.BlockId == 8378)
|
||||
return true;
|
||||
}
|
||||
else if (protocolVersion >= Protocol18Handler.MC_1_19_Version && protocolVersion <= Protocol18Handler.MC_1_19_2_Version)
|
||||
{
|
||||
if (block.BlockId == 6938)
|
||||
return true;
|
||||
|
|
@ -745,7 +804,17 @@ namespace MinecraftClient.ChatBots
|
|||
break;
|
||||
|
||||
case CropType.Wheat:
|
||||
if (protocolVersion >= Protocol18Handler.MC_1_19_Version && protocolVersion <= Protocol18Handler.MC_1_19_2_Version)
|
||||
if (protocolVersion == Protocol18Handler.MC_1_19_4_Version)
|
||||
{
|
||||
if (block.BlockId == 4281)
|
||||
return true;
|
||||
}
|
||||
else if (protocolVersion == Protocol18Handler.MC_1_19_3_Version)
|
||||
{
|
||||
if (block.BlockId == 4233)
|
||||
return true;
|
||||
}
|
||||
else if (protocolVersion >= Protocol18Handler.MC_1_19_Version && protocolVersion <= Protocol18Handler.MC_1_19_2_Version)
|
||||
{
|
||||
if (block.BlockId == 3619)
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -45,35 +45,15 @@ namespace MinecraftClient.Commands
|
|||
{
|
||||
var interpreter = new Interpreter();
|
||||
interpreter.SetVariable("MCC", handler);
|
||||
interpreter.SetVariable("random", new Random());
|
||||
|
||||
foreach (KeyValuePair<string, object> entry in Settings.Config.AppVar.GetVariables())
|
||||
interpreter.SetVariable(entry.Key, entry.Value);
|
||||
|
||||
var result = interpreter.Eval<bool>(expressionText);
|
||||
|
||||
bool shouldExec = result;
|
||||
|
||||
/*if (result is bool)
|
||||
shouldExec = (bool)result;
|
||||
else if (result is string)
|
||||
shouldExec = !string.IsNullOrEmpty((string)result) && ((string)result).Trim().Contains("true", StringComparison.OrdinalIgnoreCase);
|
||||
else if (result is int)
|
||||
shouldExec = (int)result > 0;
|
||||
else if (result is double)
|
||||
shouldExec = (double)result > 0;
|
||||
else if (result is float)
|
||||
shouldExec = (float)result > 0;
|
||||
else if (result is Int16)
|
||||
shouldExec = (Int16)result > 0;
|
||||
else if (result is Int32)
|
||||
shouldExec = (Int32)result > 0;
|
||||
else if (result is Int64)
|
||||
shouldExec = (Int64)result > 0;
|
||||
*/
|
||||
|
||||
handler.Log.Debug("[Execif] Result Type: " + result.GetType().Name);
|
||||
|
||||
if (shouldExec)
|
||||
if (result)
|
||||
{
|
||||
CmdResult output = new();
|
||||
handler.PerformInternalCommand(resultCommand, ref output);
|
||||
|
|
|
|||
|
|
@ -978,6 +978,37 @@ namespace MinecraftClient.Scripting
|
|||
Handler.BotLoad(chatBot);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set an App Variable
|
||||
/// </summary>
|
||||
/// <param name="name">App variable name</param>
|
||||
/// <param name="value">App variable value</param>
|
||||
/// <returns>void</returns>
|
||||
protected void SetAppVar(string name, object value)
|
||||
{
|
||||
Config.AppVar.SetVar(name, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a value from an App Variable
|
||||
/// </summary>
|
||||
/// <param name="name">App variable name</param>
|
||||
/// <returns>App Variable value</returns>
|
||||
protected object? GetAppVar(string name)
|
||||
{
|
||||
return Config.AppVar.GetVar(name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replaces variables in text with their values from the App Var registry
|
||||
/// </summary>
|
||||
/// <param name="text">Your text with variables</param>
|
||||
/// <returns>text with variables replaced with their values</returns>
|
||||
protected string ExpandAppVars(string text)
|
||||
{
|
||||
return Config.AppVar.ExpandVars(text);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check whether Terrain and Movements is enabled.
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue