Make replantCrops override replantNetherWart

When replantCrops is false, baritone will not replant nether wart.
Also fixed spacing.
This commit is contained in:
Orinion 2019-08-29 10:36:31 +02:00
parent d2a046c8b4
commit 65a9b1a78a
2 changed files with 9 additions and 6 deletions

View File

@ -662,7 +662,7 @@ public final class Settings {
public final Setting<Boolean> replantCrops = new Setting<>(true);
/**
* Replant nether wart while farming
* 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,16 +112,18 @@ public final class FarmProcess extends BaritoneProcessHelper implements IFarmPro
SUGARCANE(Blocks.REEDS, null) {
@Override
public boolean readyToHarvest(World world, BlockPos pos, IBlockState state) {
if(Baritone.settings().replantCrops.value)
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)
if (Baritone.settings().replantCrops.value) {
return world.getBlockState(pos.down()).getBlock() instanceof BlockCactus;
}
return true;
}
};
@ -172,10 +174,11 @@ public final class FarmProcess extends BaritoneProcessHelper implements IFarmPro
}
if (Baritone.settings().replantCrops.value) {
scan.add(Blocks.FARMLAND);
if (Baritone.settings().replantNetherWart.value) {
scan.add(Blocks.SOUL_SAND);
}
}
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));
}