2022-11-28 13:55:05 +08:00
|
|
|
|
//MCCScript 1.0
|
2020-06-12 00:11:19 +02:00
|
|
|
|
|
2022-12-06 20:32:46 +08:00
|
|
|
|
//using MinecraftClient.CommandHandler;
|
|
|
|
|
|
//using MinecraftClient.Mapping;
|
|
|
|
|
|
//using MinecraftClient.Scripting;
|
|
|
|
|
|
//using System.Threading;
|
2020-06-12 00:11:19 +02:00
|
|
|
|
|
|
|
|
|
|
MCC.LoadBot(new TreeFarmer());
|
|
|
|
|
|
|
|
|
|
|
|
//MCCScript Extensions
|
|
|
|
|
|
|
|
|
|
|
|
public class TreeFarmer : ChatBot
|
|
|
|
|
|
{
|
|
|
|
|
|
// You need to stand in front of the sapling and put items in your inventory hotbar:
|
|
|
|
|
|
// - First slot on the left (Slot 0): Axe for digging the tree
|
|
|
|
|
|
// - Second slot on the left (Slot 1): Sapling stack for planting the tree
|
|
|
|
|
|
// Then set sapling location below, login with MCC and load this script
|
|
|
|
|
|
|
|
|
|
|
|
// === CONFIG - REPLACE SAPLING LOCATION x y z VALUES HERE ===
|
|
|
|
|
|
Location sapling = new Location(x, y, z);
|
|
|
|
|
|
// === END OF CONFIG ===
|
|
|
|
|
|
|
|
|
|
|
|
public override void Update()
|
|
|
|
|
|
{
|
|
|
|
|
|
Material blockType = GetWorld().GetBlock(sapling).Type;
|
|
|
|
|
|
switch (blockType)
|
|
|
|
|
|
{
|
|
|
|
|
|
case Material.OakSapling:
|
|
|
|
|
|
// Still a sapling, nothing to do
|
|
|
|
|
|
break;
|
|
|
|
|
|
case Material.OakLog:
|
|
|
|
|
|
// Tree has grown, dig 4 blocks
|
|
|
|
|
|
ChangeSlot(0);
|
2020-07-30 00:52:38 +05:00
|
|
|
|
DigBlock(sapling);
|
2020-06-12 00:11:19 +02:00
|
|
|
|
Thread.Sleep(100);
|
|
|
|
|
|
// 1
|
2020-07-30 00:52:38 +05:00
|
|
|
|
DigBlock(new Location(sapling.X, sapling.Y + 1, sapling.Z));
|
2020-06-12 00:11:19 +02:00
|
|
|
|
Thread.Sleep(100);
|
|
|
|
|
|
// 2
|
2020-07-30 00:52:38 +05:00
|
|
|
|
DigBlock(new Location(sapling.X, sapling.Y + 2, sapling.Z));
|
2020-06-12 00:11:19 +02:00
|
|
|
|
Thread.Sleep(100);
|
|
|
|
|
|
// 3
|
2020-07-30 00:52:38 +05:00
|
|
|
|
DigBlock(new Location(sapling.X, sapling.Y + 3, sapling.Z));
|
2020-06-12 00:11:19 +02:00
|
|
|
|
Thread.Sleep(100);
|
|
|
|
|
|
// 4
|
2021-04-11 21:47:48 +08:00
|
|
|
|
DigBlock(new Location(sapling.X, sapling.Y + 4, sapling.Z));
|
2020-06-12 00:11:19 +02:00
|
|
|
|
Thread.Sleep(100);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case Material.Air:
|
|
|
|
|
|
// No tree, plant something
|
|
|
|
|
|
ChangeSlot(1);
|
2021-04-11 16:53:53 +02:00
|
|
|
|
SendPlaceBlock(sapling, Direction.Up);
|
2020-06-12 00:11:19 +02:00
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
// Other block, cannot grow trees here
|
|
|
|
|
|
LogToConsole("Block at " + sapling + " is not a sapling: " + blockType + "...");
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public override void Initialize()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2020-07-30 00:52:38 +05:00
|
|
|
|
}
|