Add replantCrops setting

add replantCrops setting, simmilar to replantNetherWart for the other crops.
This commit is contained in:
Orinion 2019-08-28 20:15:41 +02:00
parent 33080a4e1c
commit d2a046c8b4
2 changed files with 14 additions and 3 deletions

View File

@ -656,6 +656,11 @@ public final class Settings {
*/
public final Setting<Integer> exploreMaintainY = new Setting<>(64);
/**
* Replant normal Crops while farming and leave cactus and sugarcane to regrow
*/
public final Setting<Boolean> replantCrops = new Setting<>(true);
/**
* Replant nether wart while farming
*/

View File

@ -112,13 +112,17 @@ public final class FarmProcess extends BaritoneProcessHelper implements IFarmPro
SUGARCANE(Blocks.REEDS, null) {
@Override
public boolean readyToHarvest(World world, BlockPos pos, IBlockState state) {
return world.getBlockState(pos.down()).getBlock() instanceof BlockReed;
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) {
return world.getBlockState(pos.down()).getBlock() instanceof BlockCactus;
if(Baritone.settings().replantCrops.value)
return world.getBlockState(pos.down()).getBlock() instanceof BlockCactus;
return true;
}
};
public final Block block;
@ -166,7 +170,9 @@ public final class FarmProcess extends BaritoneProcessHelper implements IFarmPro
for (Harvest harvest : Harvest.values()) {
scan.add(harvest.block);
}
scan.add(Blocks.FARMLAND);
if (Baritone.settings().replantCrops.value) {
scan.add(Blocks.FARMLAND);
}
if (Baritone.settings().replantNetherWart.value) {
scan.add(Blocks.SOUL_SAND);
}