move default commands to main module

This commit is contained in:
Logan Darklock 2019-09-04 11:17:36 -07:00
parent daa0d0c859
commit 69e3481a32
No known key found for this signature in database
GPG Key ID: B8C37CEDE1AC60EA
40 changed files with 42 additions and 93 deletions

View File

@ -29,7 +29,7 @@ public class ReplaceSchematic extends MaskSchematic {
public ReplaceSchematic(IBaritone baritone, ISchematic schematic, BlockOptionalMetaLookup filter) {
super(baritone, schematic);
this.filter = filter;
this.cache = new boolean[lengthZ()][heightY()][widthX()];
this.cache = new boolean[widthX()][heightY()][lengthZ()];
}
protected boolean partOfMask(int x, int y, int z, IBlockState currentState) {

View File

@ -1,49 +0,0 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.utils.command.Command;
import baritone.api.utils.command.helpers.arguments.ArgConsumer;
import java.util.Collections;
import java.util.List;
import java.util.stream.Stream;
public class ExcCommand extends Command {
public ExcCommand() {
super("exc", "Throw an unhandled exception");
}
@Override
protected void executed(String label, ArgConsumer args, Settings settings) {
args.requireMax(0);
throw new RuntimeException("HI THERE");
}
@Override
protected Stream<String> tabCompleted(String label, ArgConsumer args, Settings settings) {
return Stream.empty();
}
@Override
public List<String> getLongDesc() {
return Collections.emptyList();
}
}

View File

@ -19,7 +19,6 @@ package baritone.api.utils.command.manager;
import baritone.api.utils.command.Command;
import baritone.api.utils.command.argument.CommandArgument;
import baritone.api.utils.command.defaults.DefaultCommands;
import baritone.api.utils.command.execution.CommandExecution;
import baritone.api.utils.command.helpers.tabcomplete.TabCompleteHelper;
import baritone.api.utils.command.registry.Registry;
@ -35,10 +34,6 @@ import static java.util.Objects.nonNull;
public class CommandManager {
public static final Registry<Command> REGISTRY = new Registry<>();
static {
DefaultCommands.commands.forEach(REGISTRY::register);
}
/**
* @param name The command name to search for.
* @return The command, if found.

View File

@ -24,12 +24,14 @@ import baritone.api.event.listener.IEventBus;
import baritone.api.utils.command.BaritoneChatControl;
import baritone.api.utils.Helper;
import baritone.api.utils.IPlayerContext;
import baritone.api.utils.command.manager.CommandManager;
import baritone.behavior.*;
import baritone.cache.WorldProvider;
import baritone.event.GameEventHandler;
import baritone.process.*;
import baritone.selection.SelectionManager;
import baritone.utils.*;
import baritone.utils.command.defaults.DefaultCommands;
import baritone.utils.player.PrimaryPlayerContext;
import net.minecraft.client.Minecraft;
@ -111,6 +113,8 @@ public class Baritone implements IBaritone {
memoryBehavior = new MemoryBehavior(this);
inventoryBehavior = new InventoryBehavior(this);
inputOverrideHandler = new InputOverrideHandler(this);
DefaultCommands.commands.forEach(CommandManager.REGISTRY::register);
new BaritoneChatControl(this);
}

View File

@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.pathing.goals.Goal;

View File

@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.process.IGetToBlockProcess;

View File

@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.utils.BetterBlockPos;

View File

@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.utils.command.Command;

View File

@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.cache.IRememberedInventory;

View File

@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.pathing.goals.Goal;

View File

@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.utils.command.Command;

View File

@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.pathing.goals.GoalBlock;

View File

@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.utils.command.Command;

View File

@ -15,9 +15,10 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.utils.command.Command;
import baritone.api.utils.command.manager.CommandManager;
import java.util.Collections;
import java.util.List;
@ -30,7 +31,6 @@ public class DefaultCommands {
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 ExcCommand(), // TODO: remove this debug command... eventually
new GoalCommand(),
new PathCommand(),
new ProcCommand(),

View File

@ -15,10 +15,9 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.utils.Helper;
import baritone.api.utils.command.Command;
import baritone.api.utils.command.helpers.arguments.ArgConsumer;

View File

@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.pathing.goals.GoalXZ;

View File

@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.utils.command.Command;

View File

@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.utils.command.Command;

View File

@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.utils.BetterBlockPos;

View File

@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.utils.command.Command;

View File

@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.behavior.IPathingBehavior;

View File

@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.utils.command.Command;

View File

@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.pathing.goals.Goal;

View File

@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.utils.command.Command;

View File

@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.pathing.goals.Goal;

View File

@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.utils.BlockOptionalMeta;

View File

@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.pathing.goals.Goal;

View File

@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.BaritoneAPI;
import baritone.api.Settings;

View File

@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.pathing.calc.IPathingControlManager;

View File

@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.utils.command.Command;

View File

@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.utils.BetterBlockPos;

View File

@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.cache.ICachedWorld;

View File

@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.utils.command.Command;

View File

@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.utils.command.Command;

View File

@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.event.events.RenderEvent;

View File

@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.utils.SettingsUtil;

View File

@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.pathing.goals.GoalXZ;

View File

@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.pathing.goals.Goal;

View File

@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.utils.command.Command;

View File

@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.command.defaults;
package baritone.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.cache.IWaypoint;