Added defaults and javadocs
This commit is contained in:
parent
65a5677b33
commit
7218a46211
@ -21,5 +21,25 @@ import net.minecraft.util.math.BlockPos;
|
|||||||
|
|
||||||
public interface IFarmProcess extends IBaritoneProcess {
|
public interface IFarmProcess extends IBaritoneProcess {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Begin to search for crops to farm with in specified aria
|
||||||
|
* from specified location.
|
||||||
|
*
|
||||||
|
* @param range The distance from center to farm from
|
||||||
|
* @param pos The center position to base the range from
|
||||||
|
*/
|
||||||
void farm(int range, BlockPos pos);
|
void farm(int range, BlockPos pos);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Begin to search for nearby crops to farm.
|
||||||
|
*/
|
||||||
|
default void farm() {farm(0, null);}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Begin to search for crops to farm with in specified aria
|
||||||
|
* from the position the command was executed.
|
||||||
|
*
|
||||||
|
* @param range The distance to search for crops to farm
|
||||||
|
*/
|
||||||
|
default void farm(int range) {farm(range, null);}
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ public class FarmCommand extends Command {
|
|||||||
public void execute(String label, IArgConsumer args) throws CommandException {
|
public void execute(String label, IArgConsumer args) throws CommandException {
|
||||||
args.requireMax(2);
|
args.requireMax(2);
|
||||||
int range = 0;
|
int range = 0;
|
||||||
BetterBlockPos origin;
|
BetterBlockPos origin = null;
|
||||||
//range
|
//range
|
||||||
if (args.has(1)) {
|
if (args.has(1)) {
|
||||||
range = args.getAs(Integer.class);
|
range = args.getAs(Integer.class);
|
||||||
@ -81,11 +81,8 @@ public class FarmCommand extends Command {
|
|||||||
} else {
|
} else {
|
||||||
origin = waypoint.getLocation();
|
origin = waypoint.getLocation();
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
origin = baritone.getPlayerContext().playerFeet();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
baritone.getFarmProcess().farm(range, origin);
|
baritone.getFarmProcess().farm(range, origin);
|
||||||
logDirect("Farming");
|
logDirect("Farming");
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,11 @@ public final class FarmProcess extends BaritoneProcessHelper implements IFarmPro
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void farm(int range, BlockPos pos) {
|
public void farm(int range, BlockPos pos) {
|
||||||
center = pos;
|
if (pos == null) {
|
||||||
|
center = baritone.getPlayerContext().playerFeet();
|
||||||
|
} else {
|
||||||
|
center = pos;
|
||||||
|
}
|
||||||
this.range = range;
|
this.range = range;
|
||||||
active = true;
|
active = true;
|
||||||
locations = null;
|
locations = null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user