mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Sugar Cane Miner Improvements by NekiPlay (#1047)
This commit is contained in:
parent
d7b7ba85a4
commit
fa0f91aad8
2 changed files with 51 additions and 34 deletions
51
MinecraftClient/config/ChatBots/SugarCaneMiner.cs
Normal file
51
MinecraftClient/config/ChatBots/SugarCaneMiner.cs
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
//MCCScript 1.0
|
||||
|
||||
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))
|
||||
{
|
||||
PlayerDigging(0, sugarCane, 1);
|
||||
Thread.Sleep(1);
|
||||
PlayerDigging(2, sugarCane, 1);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue