Baritone AI pathfinder

Baritone AI pathfinder

72.7k Downloads

retrace actions

smokii0 opened this issue ยท 1 comments

commented

ok so i have a modded farm and i cant figure out how to make baritone farm the things in my farm. so i was wondering if there is some way for me to "record"my actions so the bot can repeat the whole loop over and over again?

commented

no baritone cant record and replay actions.
unfortunatly the plants harvested by baritone are hard coded so you cant add your modded plants to a list. if you know a little java you could edit the file to your likeing.
add your modded seeds in this list:

private static final List<Item> FARMLAND_PLANTABLE = Arrays.asList(
Items.BEETROOT_SEEDS,
Items.MELON_SEEDS,
Items.WHEAT_SEEDS,
Items.PUMPKIN_SEEDS,
Items.POTATO,
Items.CARROT
);

add items you want to pick up to this list:
private static final List<Item> PICKUP_DROPPED = Arrays.asList(
Items.BEETROOT_SEEDS,
Items.BEETROOT,
Items.MELON_SEEDS,
Items.MELON,
Item.getItemFromBlock(Blocks.MELON_BLOCK),
Items.WHEAT_SEEDS,
Items.WHEAT,
Items.PUMPKIN_SEEDS,
Item.getItemFromBlock(Blocks.PUMPKIN),
Items.POTATO,
Items.CARROT,
Items.NETHER_WART,
Items.REEDS,
Item.getItemFromBlock(Blocks.CACTUS)
);

and add the blocks that should be harvested here (probably moste difficult part but doable):
private enum Harvest {
WHEAT((BlockCrops) Blocks.WHEAT),
CARROTS((BlockCrops) Blocks.CARROTS),
POTATOES((BlockCrops) Blocks.POTATOES),
BEETROOT((BlockCrops) Blocks.BEETROOTS),
PUMPKIN(Blocks.PUMPKIN, state -> true),
MELON(Blocks.MELON_BLOCK, state -> true),
NETHERWART(Blocks.NETHER_WART, state -> state.getValue(BlockNetherWart.AGE) >= 3),
SUGARCANE(Blocks.REEDS, null) {
@Override
public boolean readyToHarvest(World world, BlockPos pos, IBlockState state) {
if (Baritone.settings().replantCrops.value) {
return world.getBlockState(pos.down()).getBlock() instanceof BlockReed;
}
return true;
}
},
CACTUS(Blocks.CACTUS, null) {
@Override
public boolean readyToHarvest(World world, BlockPos pos, IBlockState state) {
if (Baritone.settings().replantCrops.value) {
return world.getBlockState(pos.down()).getBlock() instanceof BlockCactus;
}
return true;
}
};
public final Block block;
public final Predicate<IBlockState> readyToHarvest;
Harvest(BlockCrops blockCrops) {
this(blockCrops, blockCrops::isMaxAge);
// max age is 7 for wheat, carrots, and potatoes, but 3 for beetroot
}
Harvest(Block block, Predicate<IBlockState> readyToHarvest) {
this.block = block;
this.readyToHarvest = readyToHarvest;
}
public boolean readyToHarvest(World world, BlockPos pos, IBlockState state) {
return readyToHarvest.test(state);
}
}