Minecraft-Console-Client/MinecraftClient/config/ChatBots/SugarCaneMiner.cs

54 lines
1.6 KiB
C#
Raw Permalink Normal View History

//MCCScript 1.0
2022-12-06 20:32:46 +08:00
//using MinecraftClient.CommandHandler;
//using MinecraftClient.Mapping;
//using MinecraftClient.Scripting;
MCC.LoadBot(new SugarCaneMiner());
//MCCScript Extensions
public class SugarCaneMiner : ChatBot
{
// === CONFIG - REPLACE SURGAR CANE LOCATION x y z VALUES HERE ===
// You need to stand in front of the sugar cane
Location sugarCane = new Location(x, y, z);
bool fullHeight = true;
// === END OF CONFIG ===
public override void Initialize()
{
LogToConsole("Bot enabled!");
}
public override void Update()
{
if (DetectSugarCane(sugarCane, fullHeight))
{
2020-07-30 00:52:15 +05:00
DigBlock(sugarCane);
}
}
public bool DetectSugarCane(Location sugarCaneLoc, bool fullHeight)
{
Material blockType = GetWorld().GetBlock(sugarCaneLoc).Type;
if (blockType == Material.SugarCane)
{
blockType = GetWorld().GetBlock(new Location(sugarCaneLoc.X, sugarCaneLoc.Y - 1, sugarCaneLoc.Z)).Type;
if (blockType == Material.SugarCane)
{
blockType = GetWorld().GetBlock(new Location(sugarCaneLoc.X, sugarCaneLoc.Y - 2, sugarCaneLoc.Z)).Type;
if (blockType != Material.SugarCane)
{
if (!fullHeight)
return true;
blockType = GetWorld().GetBlock(new Location(sugarCaneLoc.X, sugarCaneLoc.Y + 1, sugarCaneLoc.Z)).Type;
if (blockType == Material.SugarCane)
return true;
}
}
}
return false;
}
2020-07-30 00:52:15 +05:00
}