Merge pull request #867 from Orinion/master

Add replantCrops setting
This commit is contained in:
Leijurv 2019-08-29 17:46:41 -07:00 committed by GitHub
commit e7412d0d46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 6 deletions

View File

@ -657,7 +657,12 @@ public final class Settings {
public final Setting<Integer> exploreMaintainY = new Setting<>(64);
/**
* Replant nether wart while farming
* 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. This setting only has an effect when replantCrops is also enabled
*/
public final Setting<Boolean> replantNetherWart = new Setting<>(false);

View File

@ -112,13 +112,19 @@ 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,10 +172,13 @@ public final class FarmProcess extends BaritoneProcessHelper implements IFarmPro
for (Harvest harvest : Harvest.values()) {
scan.add(harvest.block);
}
scan.add(Blocks.FARMLAND);
if (Baritone.settings().replantNetherWart.value) {
scan.add(Blocks.SOUL_SAND);
if (Baritone.settings().replantCrops.value) {
scan.add(Blocks.FARMLAND);
if (Baritone.settings().replantNetherWart.value) {
scan.add(Blocks.SOUL_SAND);
}
}
if (Baritone.settings().mineGoalUpdateInterval.value != 0 && tickCount++ % Baritone.settings().mineGoalUpdateInterval.value == 0) {
Baritone.getExecutor().execute(() -> locations = WorldScanner.INSTANCE.scanChunkRadius(ctx, scan, 256, 10, 10));
}