it launches
This commit is contained in:
parent
396a96d604
commit
23a592ec01
@ -34,12 +34,12 @@ public final class BaritoneAPI {
|
||||
private static final Settings settings;
|
||||
|
||||
static {
|
||||
settings = new Settings();
|
||||
SettingsUtil.readAndApply(settings);
|
||||
|
||||
ServiceLoader<IBaritoneProvider> baritoneLoader = ServiceLoader.load(IBaritoneProvider.class);
|
||||
Iterator<IBaritoneProvider> instances = baritoneLoader.iterator();
|
||||
provider = instances.next();
|
||||
|
||||
settings = new Settings();
|
||||
SettingsUtil.readAndApply(settings);
|
||||
}
|
||||
|
||||
public static IBaritoneProvider getProvider() {
|
||||
|
@ -33,15 +33,6 @@ import baritone.api.utils.IPlayerContext;
|
||||
*/
|
||||
public interface IBaritone {
|
||||
|
||||
/**
|
||||
* Call as soon as Minecraft is ready, initializes all of the processes, behaviors, etc. This will
|
||||
* only effectively be ran once, any additional calls are redundant because the initialization state
|
||||
* is saved.
|
||||
* <p>
|
||||
* Or whenever your overeager utility client wants.
|
||||
*/
|
||||
void init();
|
||||
|
||||
/**
|
||||
* @return The {@link IPathingBehavior} instance
|
||||
* @see IPathingBehavior
|
||||
|
@ -87,4 +87,4 @@ public interface ISchematic {
|
||||
* @return The length (Z axis length) of this schematic
|
||||
*/
|
||||
int lengthZ();
|
||||
}
|
||||
}
|
||||
|
@ -34,4 +34,4 @@ public class MyChunkPos {
|
||||
public String toString() {
|
||||
return x + ", " + z;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,10 +17,8 @@
|
||||
|
||||
package baritone.api.utils.command;
|
||||
|
||||
import baritone.api.BaritoneAPI;
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.event.listener.AbstractGameEventListener;
|
||||
import baritone.api.utils.Helper;
|
||||
import baritone.api.utils.IPlayerContext;
|
||||
import baritone.api.utils.command.execution.CommandExecution;
|
||||
@ -33,10 +31,9 @@ import java.util.Locale;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public abstract class Command implements Helper, AbstractGameEventListener {
|
||||
protected IBaritone baritone = BaritoneAPI.getProvider().getPrimaryBaritone();
|
||||
protected Settings settings = BaritoneAPI.getSettings();
|
||||
protected IPlayerContext ctx = baritone.getPlayerContext();
|
||||
public abstract class Command implements Helper {
|
||||
protected IBaritone baritone;
|
||||
protected IPlayerContext ctx;
|
||||
protected Minecraft MC = mc;
|
||||
|
||||
/**
|
||||
@ -49,15 +46,16 @@ public abstract class Command implements Helper, AbstractGameEventListener {
|
||||
*
|
||||
* @param names The names of this command. This is what you put after the command prefix.
|
||||
*/
|
||||
protected Command(List<String> names) {
|
||||
protected Command(IBaritone baritone, List<String> names) {
|
||||
this.names = names.stream()
|
||||
.map(s -> s.toLowerCase(Locale.US))
|
||||
.collect(Collectors.toList());
|
||||
baritone.getGameEventHandler().registerEventListener(this);
|
||||
this.baritone = baritone;
|
||||
this.ctx = baritone.getPlayerContext();
|
||||
}
|
||||
|
||||
protected Command(String name) {
|
||||
this(Collections.singletonList(name));
|
||||
protected Command(IBaritone baritone, String name) {
|
||||
this(baritone, Collections.singletonList(name));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
package baritone.launch.mixins;
|
||||
|
||||
import baritone.Baritone;
|
||||
import baritone.api.BaritoneAPI;
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.event.events.BlockInteractEvent;
|
||||
@ -59,7 +58,7 @@ public class MixinMinecraft {
|
||||
at = @At("RETURN")
|
||||
)
|
||||
private void postInit(CallbackInfo ci) {
|
||||
((Baritone) BaritoneAPI.getProvider().getPrimaryBaritone()).init();
|
||||
BaritoneAPI.getProvider().getPrimaryBaritone();
|
||||
}
|
||||
|
||||
@Inject(
|
||||
|
@ -60,11 +60,6 @@ public class Baritone implements IBaritone {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not {@link Baritone#init()} has been called yet
|
||||
*/
|
||||
private boolean initialized;
|
||||
|
||||
private GameEventHandler gameEventHandler;
|
||||
|
||||
private PathingBehavior pathingBehavior;
|
||||
@ -92,13 +87,6 @@ public class Baritone implements IBaritone {
|
||||
|
||||
Baritone() {
|
||||
this.gameEventHandler = new GameEventHandler(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void init() {
|
||||
if (initialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Define this before behaviors try and get it, or else it will be null and the builds will fail!
|
||||
this.playerContext = PrimaryPlayerContext.INSTANCE;
|
||||
@ -125,13 +113,11 @@ public class Baritone implements IBaritone {
|
||||
}
|
||||
|
||||
this.worldProvider = new WorldProvider();
|
||||
this.selectionManager = new SelectionManager();
|
||||
this.selectionManager = new SelectionManager(this);
|
||||
|
||||
if (BaritoneAutoTest.ENABLE_AUTO_TEST) {
|
||||
this.gameEventHandler.registerEventListener(BaritoneAutoTest.INSTANCE);
|
||||
}
|
||||
|
||||
this.initialized = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -240,4 +226,4 @@ public class Baritone implements IBaritone {
|
||||
public static Executor getExecutor() {
|
||||
return threadPool;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,11 +34,13 @@ import java.util.List;
|
||||
*/
|
||||
public final class BaritoneProvider implements IBaritoneProvider {
|
||||
|
||||
private final Baritone primary = new Baritone();
|
||||
private final List<IBaritone> all = Collections.singletonList(primary);
|
||||
private final Baritone primary;
|
||||
private final List<IBaritone> all;
|
||||
|
||||
{
|
||||
DefaultCommands.COMMANDS.forEach(CommandManager.REGISTRY::register);
|
||||
primary = new Baritone();
|
||||
all = Collections.singletonList(primary);
|
||||
DefaultCommands.commands(primary).forEach(CommandManager.REGISTRY::register);
|
||||
new BaritoneChatControl(primary);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package baritone.selection;
|
||||
|
||||
import baritone.Baritone;
|
||||
import baritone.api.selection.ISelection;
|
||||
import baritone.api.selection.ISelectionManager;
|
||||
import baritone.api.utils.BetterBlockPos;
|
||||
@ -12,8 +13,8 @@ public class SelectionManager implements ISelectionManager {
|
||||
private final LinkedList<ISelection> selections = new LinkedList<>();
|
||||
private ISelection[] selectionsArr = new ISelection[0];
|
||||
|
||||
public SelectionManager() {
|
||||
new SelectionRenderer(this);
|
||||
public SelectionManager(Baritone baritone) {
|
||||
new SelectionRenderer(baritone, this);
|
||||
}
|
||||
|
||||
private void resetSelectionsArr() {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package baritone.selection;
|
||||
|
||||
import baritone.Baritone;
|
||||
import baritone.api.event.events.RenderEvent;
|
||||
import baritone.api.event.listener.AbstractGameEventListener;
|
||||
import baritone.api.selection.ISelection;
|
||||
@ -11,7 +12,7 @@ public class SelectionRenderer implements IRenderer, AbstractGameEventListener {
|
||||
|
||||
private final SelectionManager manager;
|
||||
|
||||
SelectionRenderer(SelectionManager manager) {
|
||||
SelectionRenderer(Baritone baritone, SelectionManager manager) {
|
||||
this.manager = manager;
|
||||
baritone.getGameEventHandler().registerEventListener(this);
|
||||
}
|
||||
|
@ -18,7 +18,6 @@
|
||||
package baritone.utils;
|
||||
|
||||
import baritone.api.BaritoneAPI;
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.utils.Helper;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
@ -36,7 +35,6 @@ public interface IRenderer {
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
BufferBuilder buffer = tessellator.getBuffer();
|
||||
RenderManager renderManager = Helper.mc.getRenderManager();
|
||||
IBaritone baritone = BaritoneAPI.getProvider().getPrimaryBaritone();
|
||||
Settings settings = BaritoneAPI.getSettings();
|
||||
|
||||
static void glColor(Color color, float alpha) {
|
||||
|
@ -115,4 +115,4 @@ public final class InputOverrideHandler extends Behavior implements IInputOverri
|
||||
public BlockBreakHelper getBlockBreakHelper() {
|
||||
return blockBreakHelper;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.pathing.goals.Goal;
|
||||
import baritone.api.pathing.goals.GoalAxis;
|
||||
@ -29,8 +30,8 @@ import java.util.stream.Stream;
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
public class AxisCommand extends Command {
|
||||
public AxisCommand() {
|
||||
super(asList("axis", "highway"));
|
||||
public AxisCommand(IBaritone baritone) {
|
||||
super(baritone, asList("axis", "highway"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.process.IGetToBlockProcess;
|
||||
import baritone.api.utils.command.Command;
|
||||
@ -29,8 +30,8 @@ import java.util.stream.Stream;
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
public class BlacklistCommand extends Command {
|
||||
public BlacklistCommand() {
|
||||
super("blacklist");
|
||||
public BlacklistCommand(IBaritone baritone) {
|
||||
super(baritone, "blacklist");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.utils.BetterBlockPos;
|
||||
import baritone.api.utils.command.Command;
|
||||
@ -36,8 +37,8 @@ import static java.util.Arrays.asList;
|
||||
public class BuildCommand extends Command {
|
||||
private static final File schematicsDir = new File(Minecraft.getMinecraft().gameDir, "schematics");
|
||||
|
||||
public BuildCommand() {
|
||||
super("build");
|
||||
public BuildCommand(IBaritone baritone) {
|
||||
super(baritone, "build");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.utils.command.Command;
|
||||
import baritone.api.utils.command.helpers.arguments.ArgConsumer;
|
||||
@ -27,8 +28,8 @@ import java.util.stream.Stream;
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
public class CancelCommand extends Command {
|
||||
public CancelCommand() {
|
||||
super(asList("cancel", "stop"));
|
||||
public CancelCommand(IBaritone baritone) {
|
||||
super(baritone, asList("cancel", "stop"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.cache.IRememberedInventory;
|
||||
import baritone.api.utils.BetterBlockPos;
|
||||
@ -35,8 +36,8 @@ import java.util.stream.Stream;
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
public class ChestsCommand extends Command {
|
||||
public ChestsCommand() {
|
||||
super("chests");
|
||||
public ChestsCommand(IBaritone baritone) {
|
||||
super(baritone, "chests");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.pathing.goals.Goal;
|
||||
import baritone.api.pathing.goals.GoalBlock;
|
||||
@ -32,8 +33,8 @@ import java.util.stream.Stream;
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
public class ClearareaCommand extends Command {
|
||||
public ClearareaCommand() {
|
||||
super("cleararea");
|
||||
public ClearareaCommand(IBaritone baritone) {
|
||||
super(baritone, "cleararea");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.utils.command.Command;
|
||||
import baritone.api.utils.command.helpers.arguments.ArgConsumer;
|
||||
@ -27,8 +28,8 @@ import java.util.stream.Stream;
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
public class ClickCommand extends Command {
|
||||
public ClickCommand() {
|
||||
super("click");
|
||||
public ClickCommand(IBaritone baritone) {
|
||||
super(baritone, "click");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.pathing.goals.GoalBlock;
|
||||
import baritone.api.utils.command.Command;
|
||||
@ -32,8 +33,8 @@ import static java.util.Arrays.asList;
|
||||
import static java.util.Objects.isNull;
|
||||
|
||||
public class ComeCommand extends Command {
|
||||
public ComeCommand() {
|
||||
super("come");
|
||||
public ComeCommand(IBaritone baritone) {
|
||||
super(baritone, "come");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.utils.command.Command;
|
||||
import baritone.api.utils.command.helpers.arguments.ArgConsumer;
|
||||
@ -30,14 +31,14 @@ public class CommandAlias extends Command {
|
||||
private final String shortDesc;
|
||||
public final String target;
|
||||
|
||||
public CommandAlias(List<String> names, String shortDesc, String target) {
|
||||
super(names);
|
||||
public CommandAlias(IBaritone baritone, List<String> names, String shortDesc, String target) {
|
||||
super(baritone, names);
|
||||
this.shortDesc = shortDesc;
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
public CommandAlias(String name, String shortDesc, String target) {
|
||||
super(name);
|
||||
public CommandAlias(IBaritone baritone, String name, String shortDesc, String target) {
|
||||
super(baritone, name);
|
||||
this.shortDesc = shortDesc;
|
||||
this.target = target;
|
||||
}
|
||||
|
@ -17,53 +17,60 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.utils.command.Command;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
public class DefaultCommands {
|
||||
public static final List<Command> COMMANDS = Collections.unmodifiableList(asList(
|
||||
new HelpCommand(),
|
||||
new SetCommand(),
|
||||
new CommandAlias(asList("modified", "mod", "baritone", "modifiedsettings"), "List modified settings", "set modified"),
|
||||
new CommandAlias("reset", "Reset all settings or just one", "set reset"),
|
||||
new GoalCommand(),
|
||||
new PathCommand(),
|
||||
new ProcCommand(),
|
||||
new VersionCommand(),
|
||||
new RepackCommand(),
|
||||
new BuildCommand(),
|
||||
new SchematicaCommand(),
|
||||
new ComeCommand(),
|
||||
new AxisCommand(),
|
||||
new CancelCommand(),
|
||||
new ForceCancelCommand(),
|
||||
new GcCommand(),
|
||||
new InvertCommand(),
|
||||
new ClearareaCommand(),
|
||||
PauseResumeCommands.pauseCommand,
|
||||
PauseResumeCommands.resumeCommand,
|
||||
PauseResumeCommands.pausedCommand,
|
||||
new TunnelCommand(),
|
||||
new RenderCommand(),
|
||||
new FarmCommand(),
|
||||
new ChestsCommand(),
|
||||
new FollowCommand(),
|
||||
new ExploreFilterCommand(),
|
||||
new ReloadAllCommand(),
|
||||
new SaveAllCommand(),
|
||||
new ExploreCommand(),
|
||||
new BlacklistCommand(),
|
||||
new FindCommand(),
|
||||
new MineCommand(),
|
||||
new ClickCommand(),
|
||||
new ThisWayCommand(),
|
||||
new WaypointsCommand(),
|
||||
new CommandAlias("sethome", "Sets your home waypoint", "waypoints save home"),
|
||||
new CommandAlias("home", "Set goal to your home waypoint", "waypoints goal home"),
|
||||
new SelCommand()
|
||||
));
|
||||
public static List<Command> commands(IBaritone baritone) {
|
||||
Objects.requireNonNull(baritone);
|
||||
List<Command> commands = new ArrayList<>();
|
||||
commands.addAll(Arrays.asList(
|
||||
new HelpCommand(baritone),
|
||||
new SetCommand(baritone),
|
||||
new CommandAlias(baritone, asList("modified", "mod", "baritone", "modifiedsettings"), "List modified settings", "set modified"),
|
||||
new CommandAlias(baritone, "reset", "Reset all settings or just one", "set reset"),
|
||||
new GoalCommand(baritone),
|
||||
new PathCommand(baritone),
|
||||
new ProcCommand(baritone),
|
||||
new VersionCommand(baritone),
|
||||
new RepackCommand(baritone),
|
||||
new BuildCommand(baritone),
|
||||
new SchematicaCommand(baritone),
|
||||
new ComeCommand(baritone),
|
||||
new AxisCommand(baritone),
|
||||
new CancelCommand(baritone),
|
||||
new ForceCancelCommand(baritone),
|
||||
new GcCommand(baritone),
|
||||
new InvertCommand(baritone),
|
||||
new ClearareaCommand(baritone),
|
||||
|
||||
new TunnelCommand(baritone),
|
||||
new RenderCommand(baritone),
|
||||
new FarmCommand(baritone),
|
||||
new ChestsCommand(baritone),
|
||||
new FollowCommand(baritone),
|
||||
new ExploreFilterCommand(baritone),
|
||||
new ReloadAllCommand(baritone),
|
||||
new SaveAllCommand(baritone),
|
||||
new ExploreCommand(baritone),
|
||||
new BlacklistCommand(baritone),
|
||||
new FindCommand(baritone),
|
||||
new MineCommand(baritone),
|
||||
new ClickCommand(baritone),
|
||||
new ThisWayCommand(baritone),
|
||||
new WaypointsCommand(baritone),
|
||||
new CommandAlias(baritone, "sethome", "Sets your home waypoint", "waypoints save home"),
|
||||
new CommandAlias(baritone, "home", "Set goal to your home waypoint", "waypoints goal home"),
|
||||
new SelCommand(baritone)
|
||||
));
|
||||
PauseResumeCommands prc = new PauseResumeCommands(baritone);
|
||||
commands.add(prc.pauseCommand);
|
||||
commands.add(prc.resumeCommand);
|
||||
commands.add(prc.pausedCommand);
|
||||
return Collections.unmodifiableList(commands);
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.utils.command.Command;
|
||||
import baritone.api.utils.command.helpers.arguments.ArgConsumer;
|
||||
@ -27,8 +28,8 @@ import java.util.stream.Stream;
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
public class EmptyCommand extends Command {
|
||||
public EmptyCommand() {
|
||||
super(asList("name1", "name2"));
|
||||
public EmptyCommand(IBaritone baritone) {
|
||||
super(baritone, asList("name1", "name2"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.pathing.goals.GoalXZ;
|
||||
import baritone.api.utils.command.Command;
|
||||
@ -29,8 +30,8 @@ import java.util.stream.Stream;
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
public class ExploreCommand extends Command {
|
||||
public ExploreCommand() {
|
||||
super("explore");
|
||||
public ExploreCommand(IBaritone baritone) {
|
||||
super(baritone, "explore");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.utils.command.Command;
|
||||
import baritone.api.utils.command.datatypes.RelativeFile;
|
||||
@ -33,8 +34,8 @@ import java.util.stream.Stream;
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
public class ExploreFilterCommand extends Command {
|
||||
public ExploreFilterCommand() {
|
||||
super("explorefilter");
|
||||
public ExploreFilterCommand(IBaritone baritone) {
|
||||
super(baritone, "explorefilter");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.utils.command.Command;
|
||||
import baritone.api.utils.command.helpers.arguments.ArgConsumer;
|
||||
@ -27,8 +28,8 @@ import java.util.stream.Stream;
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
public class FarmCommand extends Command {
|
||||
public FarmCommand() {
|
||||
super("farm");
|
||||
public FarmCommand(IBaritone baritone) {
|
||||
super(baritone, "farm");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.utils.BetterBlockPos;
|
||||
import baritone.api.utils.command.Command;
|
||||
@ -31,8 +32,8 @@ import java.util.stream.Stream;
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
public class FindCommand extends Command {
|
||||
public FindCommand() {
|
||||
super("find");
|
||||
public FindCommand(IBaritone baritone) {
|
||||
super(baritone, "find");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.utils.command.Command;
|
||||
import baritone.api.utils.command.datatypes.EntityClassById;
|
||||
@ -43,8 +44,8 @@ import static java.util.Objects.isNull;
|
||||
import static java.util.Objects.nonNull;
|
||||
|
||||
public class FollowCommand extends Command {
|
||||
public FollowCommand() {
|
||||
super("follow");
|
||||
public FollowCommand(IBaritone baritone) {
|
||||
super(baritone, "follow");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.behavior.IPathingBehavior;
|
||||
import baritone.api.utils.command.Command;
|
||||
@ -28,8 +29,8 @@ import java.util.stream.Stream;
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
public class ForceCancelCommand extends Command {
|
||||
public ForceCancelCommand() {
|
||||
super("forcecancel");
|
||||
public ForceCancelCommand(IBaritone baritone) {
|
||||
super(baritone, "forcecancel");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.utils.command.Command;
|
||||
import baritone.api.utils.command.helpers.arguments.ArgConsumer;
|
||||
@ -27,8 +28,8 @@ import java.util.stream.Stream;
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
public class GcCommand extends Command {
|
||||
public GcCommand() {
|
||||
super("gc");
|
||||
public GcCommand(IBaritone baritone) {
|
||||
super(baritone, "gc");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.pathing.goals.Goal;
|
||||
import baritone.api.process.ICustomGoalProcess;
|
||||
@ -35,8 +36,8 @@ import static java.util.Objects.isNull;
|
||||
import static java.util.Objects.nonNull;
|
||||
|
||||
public class GoalCommand extends Command {
|
||||
public GoalCommand() {
|
||||
super("goal");
|
||||
public GoalCommand(IBaritone baritone) {
|
||||
super(baritone, "goal");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.utils.command.Command;
|
||||
import baritone.api.utils.command.exception.CommandNotFoundException;
|
||||
@ -40,8 +41,8 @@ import static java.util.Arrays.asList;
|
||||
import static java.util.Objects.isNull;
|
||||
|
||||
public class HelpCommand extends Command {
|
||||
public HelpCommand() {
|
||||
super(asList("help", "?"));
|
||||
public HelpCommand(IBaritone baritone) {
|
||||
super(baritone, asList("help", "?"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.pathing.goals.Goal;
|
||||
import baritone.api.pathing.goals.GoalInverted;
|
||||
@ -32,8 +33,8 @@ import static java.util.Arrays.asList;
|
||||
import static java.util.Objects.isNull;
|
||||
|
||||
public class InvertCommand extends Command {
|
||||
public InvertCommand() {
|
||||
super("invert");
|
||||
public InvertCommand(IBaritone baritone) {
|
||||
super(baritone, "invert");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.utils.BlockOptionalMeta;
|
||||
import baritone.api.utils.command.Command;
|
||||
@ -32,8 +33,8 @@ import java.util.stream.Stream;
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
public class MineCommand extends Command {
|
||||
public MineCommand() {
|
||||
super("mine");
|
||||
public MineCommand(IBaritone baritone) {
|
||||
super(baritone, "mine");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.pathing.goals.Goal;
|
||||
import baritone.api.process.ICustomGoalProcess;
|
||||
@ -35,8 +36,8 @@ import static java.util.Arrays.asList;
|
||||
import static java.util.Objects.isNull;
|
||||
|
||||
public class PathCommand extends Command {
|
||||
public PathCommand() {
|
||||
super(asList("path", "goto"));
|
||||
public PathCommand(IBaritone baritone) {
|
||||
super(baritone, asList("path", "goto"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.BaritoneAPI;
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.process.IBaritoneProcess;
|
||||
import baritone.api.process.PathingCommand;
|
||||
@ -39,15 +39,17 @@ import static java.util.Arrays.asList;
|
||||
* REQUEST_PAUSE} as needed.
|
||||
*/
|
||||
public class PauseResumeCommands {
|
||||
public static Command pauseCommand;
|
||||
public static Command resumeCommand;
|
||||
public static Command pausedCommand;
|
||||
private final IBaritone baritone;
|
||||
Command pauseCommand;
|
||||
Command resumeCommand;
|
||||
Command pausedCommand;
|
||||
|
||||
static {
|
||||
public PauseResumeCommands(IBaritone baritone) {
|
||||
this.baritone = baritone;
|
||||
// array for mutability, non-field so reflection can't touch it
|
||||
final boolean[] paused = {false};
|
||||
|
||||
BaritoneAPI.getProvider().getPrimaryBaritone().getPathingControlManager().registerProcess(
|
||||
baritone.getPathingControlManager().registerProcess(
|
||||
new IBaritoneProcess() {
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
@ -79,7 +81,7 @@ public class PauseResumeCommands {
|
||||
}
|
||||
);
|
||||
|
||||
pauseCommand = new Command("pause") {
|
||||
pauseCommand = new Command(baritone, "pause") {
|
||||
@Override
|
||||
protected void executed(String label, ArgConsumer args, Settings settings) {
|
||||
args.requireMax(0);
|
||||
@ -115,7 +117,7 @@ public class PauseResumeCommands {
|
||||
}
|
||||
};
|
||||
|
||||
resumeCommand = new Command("resume") {
|
||||
resumeCommand = new Command(baritone, "resume") {
|
||||
@Override
|
||||
protected void executed(String label, ArgConsumer args, Settings settings) {
|
||||
args.requireMax(0);
|
||||
@ -149,7 +151,7 @@ public class PauseResumeCommands {
|
||||
}
|
||||
};
|
||||
|
||||
pausedCommand = new Command("paused") {
|
||||
pausedCommand = new Command(baritone, "paused") {
|
||||
@Override
|
||||
protected void executed(String label, ArgConsumer args, Settings settings) {
|
||||
args.requireMax(0);
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.pathing.calc.IPathingControlManager;
|
||||
import baritone.api.process.IBaritoneProcess;
|
||||
@ -32,8 +33,8 @@ import static java.util.Arrays.asList;
|
||||
import static java.util.Objects.isNull;
|
||||
|
||||
public class ProcCommand extends Command {
|
||||
public ProcCommand() {
|
||||
super("proc");
|
||||
public ProcCommand(IBaritone baritone) {
|
||||
super(baritone, "proc");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.utils.command.Command;
|
||||
import baritone.api.utils.command.helpers.arguments.ArgConsumer;
|
||||
@ -27,8 +28,8 @@ import java.util.stream.Stream;
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
public class ReloadAllCommand extends Command {
|
||||
public ReloadAllCommand() {
|
||||
super("reloadall");
|
||||
public ReloadAllCommand(IBaritone baritone) {
|
||||
super(baritone, "reloadall");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.utils.BetterBlockPos;
|
||||
import baritone.api.utils.command.Command;
|
||||
@ -28,8 +29,8 @@ import java.util.stream.Stream;
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
public class RenderCommand extends Command {
|
||||
public RenderCommand() {
|
||||
super("render");
|
||||
public RenderCommand(IBaritone baritone) {
|
||||
super(baritone, "render");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.utils.command.Command;
|
||||
import baritone.api.utils.command.helpers.arguments.ArgConsumer;
|
||||
@ -28,8 +29,8 @@ import java.util.stream.Stream;
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
public class RepackCommand extends Command {
|
||||
public RepackCommand() {
|
||||
super(asList("repack", "rescan"));
|
||||
public RepackCommand(IBaritone baritone) {
|
||||
super(baritone, asList("repack", "rescan"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.utils.command.Command;
|
||||
import baritone.api.utils.command.helpers.arguments.ArgConsumer;
|
||||
@ -27,8 +28,8 @@ import java.util.stream.Stream;
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
public class SaveAllCommand extends Command {
|
||||
public SaveAllCommand() {
|
||||
super("saveall");
|
||||
public SaveAllCommand(IBaritone baritone) {
|
||||
super(baritone, "saveall");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.utils.command.Command;
|
||||
import baritone.api.utils.command.helpers.arguments.ArgConsumer;
|
||||
@ -27,8 +28,8 @@ import java.util.stream.Stream;
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
public class SchematicaCommand extends Command {
|
||||
public SchematicaCommand() {
|
||||
super("schematica");
|
||||
public SchematicaCommand(IBaritone baritone) {
|
||||
super(baritone, "schematica");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,8 +17,11 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.Baritone;
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.event.events.RenderEvent;
|
||||
import baritone.api.event.listener.AbstractGameEventListener;
|
||||
import baritone.api.schematic.*;
|
||||
import baritone.api.selection.ISelection;
|
||||
import baritone.api.selection.ISelectionManager;
|
||||
@ -54,8 +57,25 @@ public class SelCommand extends Command {
|
||||
private ISelectionManager manager = baritone.getSelectionManager();
|
||||
private BetterBlockPos pos1 = null;
|
||||
|
||||
public SelCommand() {
|
||||
super(asList("sel", "selection", "s"));
|
||||
public SelCommand(IBaritone baritone) {
|
||||
super(baritone, asList("sel", "selection", "s"));
|
||||
baritone.getGameEventHandler().registerEventListener(new AbstractGameEventListener() {
|
||||
@Override
|
||||
public void onRenderPass(RenderEvent event) {
|
||||
if (!Baritone.settings().renderSelectionCorners.value || pos1 == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Color color = Baritone.settings().colorSelectionPos1.value;
|
||||
float opacity = Baritone.settings().selectionOpacity.value;
|
||||
float lineWidth = Baritone.settings().selectionLineWidth.value;
|
||||
boolean ignoreDepth = Baritone.settings().renderSelectionIgnoreDepth.value;
|
||||
|
||||
IRenderer.startLines(color, opacity, lineWidth, ignoreDepth);
|
||||
IRenderer.drawAABB(new AxisAlignedBB(pos1, pos1.add(1, 1, 1)));
|
||||
IRenderer.endLines(ignoreDepth);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -360,20 +380,4 @@ public class SelCommand extends Command {
|
||||
return names.toArray(new String[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderPass(RenderEvent event) {
|
||||
if (!settings.renderSelectionCorners.value || pos1 == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Color color = settings.colorSelectionPos1.value;
|
||||
float opacity = settings.selectionOpacity.value;
|
||||
float lineWidth = settings.selectionLineWidth.value;
|
||||
boolean ignoreDepth = settings.renderSelectionIgnoreDepth.value;
|
||||
|
||||
IRenderer.startLines(color, opacity, lineWidth, ignoreDepth);
|
||||
IRenderer.drawAABB(new AxisAlignedBB(pos1, pos1.add(1, 1, 1)));
|
||||
IRenderer.endLines(ignoreDepth);
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.utils.SettingsUtil;
|
||||
import baritone.api.utils.command.Command;
|
||||
@ -44,8 +45,8 @@ import static java.util.Objects.nonNull;
|
||||
import static java.util.stream.Stream.of;
|
||||
|
||||
public class SetCommand extends Command {
|
||||
public SetCommand() {
|
||||
super(asList("set", "setting", "settings"));
|
||||
public SetCommand(IBaritone baritone) {
|
||||
super(baritone, asList("set", "setting", "settings"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.pathing.goals.GoalXZ;
|
||||
import baritone.api.utils.command.Command;
|
||||
@ -28,8 +29,8 @@ import java.util.stream.Stream;
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
public class ThisWayCommand extends Command {
|
||||
public ThisWayCommand() {
|
||||
super(asList("thisway", "forward"));
|
||||
public ThisWayCommand(IBaritone baritone) {
|
||||
super(baritone, asList("thisway", "forward"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.pathing.goals.Goal;
|
||||
import baritone.api.pathing.goals.GoalStrictDirection;
|
||||
@ -29,8 +30,8 @@ import java.util.stream.Stream;
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
public class TunnelCommand extends Command {
|
||||
public TunnelCommand() {
|
||||
super("tunnel");
|
||||
public TunnelCommand(IBaritone baritone) {
|
||||
super(baritone, "tunnel");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.utils.command.Command;
|
||||
import baritone.api.utils.command.exception.CommandInvalidStateException;
|
||||
@ -29,8 +30,8 @@ import static java.util.Arrays.asList;
|
||||
import static java.util.Objects.isNull;
|
||||
|
||||
public class VersionCommand extends Command {
|
||||
public VersionCommand() {
|
||||
super("version");
|
||||
public VersionCommand(IBaritone baritone) {
|
||||
super(baritone, "version");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.cache.IWaypoint;
|
||||
import baritone.api.cache.Waypoint;
|
||||
@ -49,8 +50,8 @@ import static baritone.api.utils.command.BaritoneChatControl.FORCE_COMMAND_PREFI
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
public class WaypointsCommand extends Command {
|
||||
public WaypointsCommand() {
|
||||
super(asList("waypoints", "waypoint", "wp"));
|
||||
public WaypointsCommand(IBaritone baritone) {
|
||||
super(baritone, asList("waypoints", "waypoint", "wp"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user