This commit is contained in:
Leijurv
2019-09-19 12:53:15 -07:00
parent 0504a1d4bf
commit 396a96d604
77 changed files with 658 additions and 683 deletions

View File

@@ -21,17 +21,14 @@ import baritone.api.BaritoneAPI;
import baritone.api.IBaritone;
import baritone.api.Settings;
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;

View File

@@ -28,7 +28,6 @@ import net.minecraft.inventory.ClickType;
import net.minecraft.item.*;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import java.util.ArrayList;
import java.util.OptionalInt;

View File

@@ -19,11 +19,7 @@ package baritone.behavior;
import baritone.Baritone;
import baritone.api.behavior.IPathingBehavior;
import baritone.api.event.events.PathEvent;
import baritone.api.event.events.PlayerUpdateEvent;
import baritone.api.event.events.RenderEvent;
import baritone.api.event.events.SprintStateEvent;
import baritone.api.event.events.TickEvent;
import baritone.api.event.events.*;
import baritone.api.pathing.calc.IPath;
import baritone.api.pathing.goals.Goal;
import baritone.api.pathing.goals.GoalXZ;
@@ -137,8 +133,8 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
BetterBlockPos calcFrom = inProgress.getStart();
Optional<IPath> currentBest = inProgress.bestPathSoFar();
if ((current == null || !current.getPath().getDest().equals(calcFrom)) // if current ends in inProgress's start, then we're ok
&& !calcFrom.equals(ctx.playerFeet()) && !calcFrom.equals(expectedSegmentStart) // if current starts in our playerFeet or pathStart, then we're ok
&& (!currentBest.isPresent() || (!currentBest.get().positions().contains(ctx.playerFeet()) && !currentBest.get().positions().contains(expectedSegmentStart))) // if
&& !calcFrom.equals(ctx.playerFeet()) && !calcFrom.equals(expectedSegmentStart) // if current starts in our playerFeet or pathStart, then we're ok
&& (!currentBest.isPresent() || (!currentBest.get().positions().contains(ctx.playerFeet()) && !currentBest.get().positions().contains(expectedSegmentStart))) // if
) {
// when it was *just* started, currentBest will be empty so we need to also check calcFrom since that's always present
inProgress.cancel(); // cancellation doesn't dispatch any events

View File

@@ -88,7 +88,8 @@ public final class ChunkPacker {
IBlockState[] blocks = new IBlockState[256];
for (int z = 0; z < 16; z++) {
https://www.ibm.com/developerworks/library/j-perry-writing-good-java-code/index.html
https:
//www.ibm.com/developerworks/library/j-perry-writing-good-java-code/index.html
for (int x = 0; x < 16; x++) {
for (int y = 255; y >= 0; y--) {
int index = CachedChunk.getPositionIndex(x, y, z);

View File

@@ -21,7 +21,6 @@ import baritone.api.cache.IWaypoint;
import baritone.api.cache.IWaypointCollection;
import baritone.api.cache.Waypoint;
import baritone.api.utils.BetterBlockPos;
import net.minecraft.util.math.BlockPos;
import java.io.*;
import java.nio.file.Files;

View File

@@ -31,11 +31,7 @@ import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.*;
import java.util.stream.IntStream;
import static java.util.Objects.nonNull;
@@ -89,8 +85,8 @@ public enum WorldScanner implements IWorldScanner {
}
}
if ((allUnloaded && foundChunks)
|| (res.size() >= max
&& (searchRadiusSq > maxSearchRadiusSq || (searchRadiusSq > 1 && foundWithinY)))
|| (res.size() >= max
&& (searchRadiusSq > maxSearchRadiusSq || (searchRadiusSq > 1 && foundWithinY)))
) {
return res;
}

View File

@@ -29,7 +29,6 @@ import baritone.utils.BaritoneProcessHelper;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.BlockPos;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Predicate;
import java.util.stream.Collectors;
@@ -83,11 +82,11 @@ public final class FollowProcess extends BaritoneProcessHelper implements IFollo
private void scanWorld() {
cache = Stream.of(ctx.world().loadedEntityList, ctx.world().playerEntities)
.flatMap(List::stream)
.filter(this::followable)
.filter(this.filter)
.distinct()
.collect(Collectors.toList());
.flatMap(List::stream)
.filter(this::followable)
.filter(this.filter)
.distinct()
.collect(Collectors.toList());
}
@Override

View File

@@ -33,7 +33,10 @@ import net.minecraft.init.Blocks;
import net.minecraft.inventory.ContainerPlayer;
import net.minecraft.util.math.BlockPos;
import java.util.*;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
public final class GetToBlockProcess extends BaritoneProcessHelper implements IGetToBlockProcess {

View File

@@ -19,21 +19,21 @@ public class Selection implements ISelection {
this.pos2 = pos2;
this.min = new BetterBlockPos(
Math.min(pos1.x, pos2.x),
Math.min(pos1.y, pos2.y),
Math.min(pos1.z, pos2.z)
Math.min(pos1.x, pos2.x),
Math.min(pos1.y, pos2.y),
Math.min(pos1.z, pos2.z)
);
this.max = new BetterBlockPos(
Math.max(pos1.x, pos2.x),
Math.max(pos1.y, pos2.y),
Math.max(pos1.z, pos2.z)
Math.max(pos1.x, pos2.x),
Math.max(pos1.y, pos2.y),
Math.max(pos1.z, pos2.z)
);
this.size = new Vec3i(
max.x - min.x + 1,
max.y - min.y + 1,
max.z - min.z + 1
max.x - min.x + 1,
max.y - min.y + 1,
max.z - min.z + 1
);
this.aabb = new AxisAlignedBB(this.min, this.max.add(1, 1, 1));
@@ -81,7 +81,7 @@ public class Selection implements ISelection {
/**
* Since it might not be immediately obvious what this does, let me explain.
*
* <p>
* Let's say you specify EnumFacing.UP, this functions returns if pos2 is the highest BlockPos.
* If you specify EnumFacing.DOWN, it returns if pos2 is the lowest BlockPos.
*

View File

@@ -28,7 +28,7 @@ import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.math.AxisAlignedBB;
import java.awt.Color;
import java.awt.*;
import static org.lwjgl.opengl.GL11.*;

View File

@@ -36,7 +36,7 @@ import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import java.awt.Color;
import java.awt.*;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

View File

@@ -118,7 +118,7 @@ public class ToolSet {
} else if (speed == highestSpeed) {
int cost = getMaterialCost(itemStack);
if ((cost < lowestCost && (silkTouch || !bestSilkTouch)) ||
(preferSilkTouch && !bestSilkTouch && silkTouch)) {
(preferSilkTouch && !bestSilkTouch && silkTouch)) {
highestSpeed = speed;
best = i;
lowestCost = cost;

View File

@@ -54,10 +54,10 @@ public class AxisCommand extends Command {
@Override
public List<String> getLongDesc() {
return asList(
"The axis command sets a goal that tells Baritone to head towards the nearest axis. That is, X=0 or Z=0.",
"",
"Usage:",
"> axis"
"The axis command sets a goal that tells Baritone to head towards the nearest axis. That is, X=0 or Z=0.",
"",
"Usage:",
"> axis"
);
}
}

View File

@@ -62,10 +62,10 @@ public class BlacklistCommand extends Command {
@Override
public List<String> getLongDesc() {
return asList(
"While, for example, mining, this command blacklists the closest block so that Baritone won't attempt to get to it.",
"",
"Usage:",
"> blacklist"
"While, for example, mining, this command blacklists the closest block so that Baritone won't attempt to get to it.",
"",
"Usage:",
"> blacklist"
);
}
}

View File

@@ -89,11 +89,11 @@ public class BuildCommand extends Command {
@Override
public List<String> getLongDesc() {
return asList(
"Build a schematic from a file.",
"",
"Usage:",
"> build <filename> - Loads and builds '<filename>.schematic'",
"> build <filename> <x> <y> <z> - Custom position"
"Build a schematic from a file.",
"",
"Usage:",
"> build <filename> - Loads and builds '<filename>.schematic'",
"> build <filename> <x> <y> <z> - Custom position"
);
}
}

View File

@@ -51,10 +51,10 @@ public class CancelCommand extends Command {
@Override
public List<String> getLongDesc() {
return asList(
"The cancel command tells Baritons to stop whatever it's currently doing.",
"",
"Usage:",
"> cancel"
"The cancel command tells Baritons to stop whatever it's currently doing.",
"",
"Usage:",
"> cancel"
);
}
}

View File

@@ -43,7 +43,7 @@ public class ChestsCommand extends Command {
protected void executed(String label, ArgConsumer args, Settings settings) {
args.requireMax(0);
Set<Map.Entry<BlockPos, IRememberedInventory>> entries =
ctx.worldData().getContainerMemory().getRememberedInventories().entrySet();
ctx.worldData().getContainerMemory().getRememberedInventories().entrySet();
if (entries.isEmpty()) {
throw new CommandInvalidStateException("No remembered inventories");
@@ -77,10 +77,10 @@ public class ChestsCommand extends Command {
@Override
public List<String> getLongDesc() {
return asList(
"The chests command lists remembered inventories, I guess?",
"",
"Usage:",
"> chests"
"The chests command lists remembered inventories, I guess?",
"",
"Usage:",
"> chests"
);
}
}

View File

@@ -73,11 +73,11 @@ public class ClearareaCommand extends Command {
@Override
public List<String> getLongDesc() {
return asList(
"Clear an area of all blocks.",
"",
"Usage:",
"> cleararea - Clears the area marked by your current position and the current GoalBlock",
"> cleararea <x> <y> <z> - Custom second corner rather than your goal"
"Clear an area of all blocks.",
"",
"Usage:",
"> cleararea - Clears the area marked by your current position and the current GoalBlock",
"> cleararea <x> <y> <z> - Custom second corner rather than your goal"
);
}
}

View File

@@ -51,10 +51,10 @@ public class ClickCommand extends Command {
@Override
public List<String> getLongDesc() {
return asList(
"Opens click dude",
"",
"Usage:",
"> click"
"Opens click dude",
"",
"Usage:",
"> click"
);
}
}

View File

@@ -62,12 +62,12 @@ public class ComeCommand extends Command {
@Override
public List<String> getLongDesc() {
return asList(
"The come command tells Baritone to head towards your camera.",
"",
"This can be useful in hacked clients where freecam doesn't move your player position.",
"",
"Usage:",
"> come"
"The come command tells Baritone to head towards your camera.",
"",
"This can be useful in hacked clients where freecam doesn't move your player position.",
"",
"Usage:",
"> come"
);
}
}

View File

@@ -26,44 +26,44 @@ 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()
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()
));
}

View File

@@ -49,10 +49,10 @@ public class EmptyCommand extends Command {
@Override
public List<String> getLongDesc() {
return asList(
"",
"",
"Usage:",
"> "
"",
"",
"Usage:",
"> "
);
}
}

View File

@@ -42,8 +42,8 @@ public class ExploreCommand extends Command {
}
GoalXZ goal = args.has()
? args.getDatatypePost(RelativeGoalXZ.class, ctx.playerFeet())
: new GoalXZ(ctx.playerFeet());
? args.getDatatypePost(RelativeGoalXZ.class, ctx.playerFeet())
: new GoalXZ(ctx.playerFeet());
baritone.getExploreProcess().explore(goal.getX(), goal.getZ());
logDirect(String.format("Exploring from %s", goal.toString()));
@@ -66,11 +66,11 @@ public class ExploreCommand extends Command {
@Override
public List<String> getLongDesc() {
return asList(
"Tell Baritone to explore randomly. If you used explorefilter before this, it will be applied.",
"",
"Usage:",
"> explore - Explore from your current position.",
"> explore <x> <z> - Explore from the specified X and Z position."
"Tell Baritone to explore randomly. If you used explorefilter before this, it will be applied.",
"",
"Usage:",
"> explore - Explore from your current position.",
"> explore <x> <z> - Explore from the specified X and Z position."
);
}
}

View File

@@ -81,14 +81,14 @@ public class ExploreFilterCommand extends Command {
@Override
public List<String> getLongDesc() {
return asList(
"Apply an explore filter before using explore, which tells the explore process which chunks have been explored/not explored.",
"",
"The JSON file will follow this format: [{\"x\":0,\"z\":0},...]",
"",
"If 'invert' is specified, the chunks listed will be considered NOT explored, rather than explored.",
"",
"Usage:",
"> explorefilter <path> [invert] - Load the JSON file referenced by the specified path. If invert is specified, it must be the literal word 'invert'."
"Apply an explore filter before using explore, which tells the explore process which chunks have been explored/not explored.",
"",
"The JSON file will follow this format: [{\"x\":0,\"z\":0},...]",
"",
"If 'invert' is specified, the chunks listed will be considered NOT explored, rather than explored.",
"",
"Usage:",
"> explorefilter <path> [invert] - Load the JSON file referenced by the specified path. If invert is specified, it must be the literal word 'invert'."
);
}
}

View File

@@ -51,10 +51,10 @@ public class FarmCommand extends Command {
@Override
public List<String> getLongDesc() {
return asList(
"The farm command starts farming nearby plants. It harvests mature crops and plants new ones.",
"",
"Usage:",
"> farm"
"The farm command starts farming nearby plants. It harvests mature crops and plants new ones.",
"",
"Usage:",
"> farm"
);
}
}

View File

@@ -46,18 +46,18 @@ public class FindCommand extends Command {
BetterBlockPos origin = ctx.playerFeet();
toFind.stream()
.flatMap(block ->
ctx.worldData().getCachedWorld().getLocationsOf(
Block.REGISTRY.getNameForObject(block).getPath(),
Integer.MAX_VALUE,
origin.x,
origin.y,
4
).stream()
)
.map(BetterBlockPos::new)
.map(BetterBlockPos::toString)
.forEach(this::logDirect);
.flatMap(block ->
ctx.worldData().getCachedWorld().getLocationsOf(
Block.REGISTRY.getNameForObject(block).getPath(),
Integer.MAX_VALUE,
origin.x,
origin.y,
4
).stream()
)
.map(BetterBlockPos::new)
.map(BetterBlockPos::toString)
.forEach(this::logDirect);
}
@Override
@@ -73,10 +73,10 @@ public class FindCommand extends Command {
@Override
public List<String> getLongDesc() {
return asList(
"",
"",
"Usage:",
"> "
"",
"",
"Usage:",
"> "
);
}
}

View File

@@ -77,9 +77,9 @@ public class FollowCommand extends Command {
}
baritone.getFollowProcess().follow(
classes.isEmpty()
? entities::contains
: e -> classes.stream().anyMatch(c -> c.isInstance(e))
classes.isEmpty()
? entities::contains
: e -> classes.stream().anyMatch(c -> c.isInstance(e))
);
}
@@ -90,14 +90,14 @@ public class FollowCommand extends Command {
if (classes.isEmpty()) {
entities.stream()
.map(Entity::toString)
.forEach(this::logDirect);
.map(Entity::toString)
.forEach(this::logDirect);
} else {
classes.stream()
.map(EntityList::getKey)
.map(Objects::requireNonNull)
.map(ResourceLocation::toString)
.forEach(this::logDirect);
.map(EntityList::getKey)
.map(Objects::requireNonNull)
.map(ResourceLocation::toString)
.forEach(this::logDirect);
}
}
}
@@ -106,10 +106,10 @@ public class FollowCommand extends Command {
protected Stream<String> tabCompleted(String label, ArgConsumer args, Settings settings) {
if (args.hasExactlyOne()) {
return new TabCompleteHelper()
.append(FollowGroup.class)
.append(FollowList.class)
.filterPrefix(args.getString())
.stream();
.append(FollowGroup.class)
.append(FollowList.class)
.filterPrefix(args.getString())
.stream();
} else {
Class<? extends IDatatype> followType;
@@ -139,13 +139,13 @@ public class FollowCommand extends Command {
@Override
public List<String> getLongDesc() {
return asList(
"The follow command tells Baritone to follow certain kinds of entities.",
"",
"Usage:",
"> follow entities - Follows all entities.",
"> follow entity <entity1> <entity2> <...> - Follow certain entities (for example 'skeleton', 'horse' etc.)",
"> follow players - Follow players",
"> follow player <username1> <username2> <...> - Follow certain players"
"The follow command tells Baritone to follow certain kinds of entities.",
"",
"Usage:",
"> follow entities - Follows all entities.",
"> follow entity <entity1> <entity2> <...> - Follow certain entities (for example 'skeleton', 'horse' etc.)",
"> follow players - Follow players",
"> follow player <username1> <username2> <...> - Follow certain players"
);
}

View File

@@ -54,10 +54,10 @@ public class ForceCancelCommand extends Command {
@Override
public List<String> getLongDesc() {
return asList(
"Like cancel, but more forceful.",
"",
"Usage:",
"> forcecancel"
"Like cancel, but more forceful.",
"",
"Usage:",
"> forcecancel"
);
}
}

View File

@@ -53,10 +53,10 @@ public class GcCommand extends Command {
@Override
public List<String> getLongDesc() {
return asList(
"Calls System.gc().",
"",
"Usage:",
"> gc"
"Calls System.gc().",
"",
"Usage:",
"> gc"
);
}
}

View File

@@ -94,16 +94,16 @@ public class GoalCommand extends Command {
@Override
public List<String> getLongDesc() {
return asList(
"The goal command allows you to set or clear Baritone's goal.",
"",
"Wherever a coordinate is expected, you can use ~ just like in regular Minecraft commands. Or, you can just use regular numbers.",
"",
"Usage:",
"> goal - Set the goal to your current position",
"> goal <reset/clear/none> - Erase the goal",
"> goal <y> - Set the goal to a Y level",
"> goal <x> <z> - Set the goal to an X,Z position",
"> goal <x> <y> <z> - Set the goal to an X,Y,Z position"
"The goal command allows you to set or clear Baritone's goal.",
"",
"Wherever a coordinate is expected, you can use ~ just like in regular Minecraft commands. Or, you can just use regular numbers.",
"",
"Usage:",
"> goal - Set the goal to your current position",
"> goal <reset/clear/none> - Erase the goal",
"> goal <y> - Set the goal to a Y level",
"> goal <x> <z> - Set the goal to an X,Z position",
"> goal <x> <y> <z> - Set the goal to an X,Y,Z position"
);
}
}

View File

@@ -50,38 +50,38 @@ public class HelpCommand extends Command {
if (!args.has() || args.is(Integer.class)) {
Paginator.paginate(
args, new Paginator<>(
CommandManager.REGISTRY.descendingStream()
.filter(command -> !command.hiddenFromHelp())
.collect(Collectors.toList())
),
() -> logDirect("All Baritone commands (clickable):"),
command -> {
String names = String.join("/", command.names);
String name = command.names.get(0);
args, new Paginator<>(
CommandManager.REGISTRY.descendingStream()
.filter(command -> !command.hiddenFromHelp())
.collect(Collectors.toList())
),
() -> logDirect("All Baritone commands (clickable):"),
command -> {
String names = String.join("/", command.names);
String name = command.names.get(0);
ITextComponent shortDescComponent = new TextComponentString(" - " + command.getShortDesc());
shortDescComponent.getStyle().setColor(TextFormatting.DARK_GRAY);
ITextComponent shortDescComponent = new TextComponentString(" - " + command.getShortDesc());
shortDescComponent.getStyle().setColor(TextFormatting.DARK_GRAY);
ITextComponent namesComponent = new TextComponentString(names);
namesComponent.getStyle().setColor(TextFormatting.WHITE);
ITextComponent namesComponent = new TextComponentString(names);
namesComponent.getStyle().setColor(TextFormatting.WHITE);
ITextComponent hoverComponent = new TextComponentString("");
hoverComponent.getStyle().setColor(TextFormatting.GRAY);
hoverComponent.appendSibling(namesComponent);
hoverComponent.appendText("\n" + command.getShortDesc());
hoverComponent.appendText("\n\nClick to view full help");
String clickCommand = FORCE_COMMAND_PREFIX + String.format("%s %s", label, command.names.get(0));
ITextComponent hoverComponent = new TextComponentString("");
hoverComponent.getStyle().setColor(TextFormatting.GRAY);
hoverComponent.appendSibling(namesComponent);
hoverComponent.appendText("\n" + command.getShortDesc());
hoverComponent.appendText("\n\nClick to view full help");
String clickCommand = FORCE_COMMAND_PREFIX + String.format("%s %s", label, command.names.get(0));
ITextComponent component = new TextComponentString(name);
component.getStyle().setColor(TextFormatting.GRAY);
component.appendSibling(shortDescComponent);
component.getStyle()
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverComponent))
.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, clickCommand));
return component;
},
FORCE_COMMAND_PREFIX + label
ITextComponent component = new TextComponentString(name);
component.getStyle().setColor(TextFormatting.GRAY);
component.appendSibling(shortDescComponent);
component.getStyle()
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverComponent))
.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, clickCommand));
return component;
},
FORCE_COMMAND_PREFIX + label
);
} else {
String commandName = args.getString().toLowerCase();
@@ -98,8 +98,8 @@ public class HelpCommand extends Command {
ITextComponent returnComponent = new TextComponentString("Click to return to the help menu");
returnComponent.getStyle().setClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,
FORCE_COMMAND_PREFIX + label
ClickEvent.Action.RUN_COMMAND,
FORCE_COMMAND_PREFIX + label
));
logDirect(returnComponent);
@@ -123,11 +123,11 @@ public class HelpCommand extends Command {
@Override
public List<String> getLongDesc() {
return asList(
"Using this command, you can view detailed help information on how to use certain commands of Baritone.",
"",
"Usage:",
"> help - Lists all commands and their short descriptions.",
"> help <command> - Displays help information on a specific command."
"Using this command, you can view detailed help information on how to use certain commands of Baritone.",
"",
"Usage:",
"> help - Lists all commands and their short descriptions.",
"> help <command> - Displays help information on a specific command."
);
}
}

View File

@@ -70,10 +70,10 @@ public class InvertCommand extends Command {
@Override
public List<String> getLongDesc() {
return asList(
"The invert command tells Baritone to head away from the current goal rather than towards it.",
"",
"Usage:",
"> invert - Invert the current goal."
"The invert command tells Baritone to head away from the current goal rather than towards it.",
"",
"Usage:",
"> invert - Invert the current goal."
);
}
}

View File

@@ -64,16 +64,16 @@ public class MineCommand extends Command {
@Override
public List<String> getLongDesc() {
return asList(
"The mine command allows you to tell Baritone to search for and mine individual blocks.",
"",
"The specified blocks can be ores (which are commonly cached), or any other block.",
"",
"Also see the legitMine settings (see #set l legitMine).",
"",
"Usage:",
"> mine diamond_ore - Mines all diamonds it can find.",
"> mine redstone_ore lit_redstone_ore - Mines redstone ore.",
"> mine log:0 - Mines only oak logs."
"The mine command allows you to tell Baritone to search for and mine individual blocks.",
"",
"The specified blocks can be ores (which are commonly cached), or any other block.",
"",
"Also see the legitMine settings (see #set l legitMine).",
"",
"Usage:",
"> mine diamond_ore - Mines all diamonds it can find.",
"> mine redstone_ore lit_redstone_ore - Mines redstone ore.",
"> mine log:0 - Mines only oak logs."
);
}
}

View File

@@ -69,9 +69,9 @@ public class PathCommand extends Command {
if (!args.has(2)) {
return new TabCompleteHelper()
.append("~")
.filterPrefix(args.getString())
.stream();
.append("~")
.filterPrefix(args.getString())
.stream();
}
}
}
@@ -87,13 +87,13 @@ public class PathCommand extends Command {
@Override
public List<String> getLongDesc() {
return asList(
"The path command tells Baritone to head towards the current goal.",
"",
"Usage:",
"> path - Start the pathing.",
"> path <y>",
"> path <x> <z>",
"> path <x> <y> <z> - Define the goal here"
"The path command tells Baritone to head towards the current goal.",
"",
"Usage:",
"> path - Start the pathing.",
"> path <y>",
"> path <x> <z>",
"> path <x> <y> <z> - Define the goal here"
);
}
}

View File

@@ -33,7 +33,7 @@ import static java.util.Arrays.asList;
/**
* Contains the pause, resume, and paused commands.
*
* <p>
* This thing is scoped to hell, private so far you can't even access it using reflection, because you AREN'T SUPPOSED
* TO USE THIS to pause and resume Baritone. Make your own process that returns {@link PathingCommandType#REQUEST_PAUSE
* REQUEST_PAUSE} as needed.
@@ -48,35 +48,35 @@ public class PauseResumeCommands {
final boolean[] paused = {false};
BaritoneAPI.getProvider().getPrimaryBaritone().getPathingControlManager().registerProcess(
new IBaritoneProcess() {
@Override
public boolean isActive() {
return paused[0];
}
new IBaritoneProcess() {
@Override
public boolean isActive() {
return paused[0];
}
@Override
public PathingCommand onTick(boolean calcFailed, boolean isSafeToCancel) {
return new PathingCommand(null, PathingCommandType.REQUEST_PAUSE);
}
@Override
public PathingCommand onTick(boolean calcFailed, boolean isSafeToCancel) {
return new PathingCommand(null, PathingCommandType.REQUEST_PAUSE);
}
@Override
public boolean isTemporary() {
return true;
}
@Override
public boolean isTemporary() {
return true;
}
@Override
public void onLostControl() {}
@Override
public void onLostControl() {}
@Override
public double priority() {
return DEFAULT_PRIORITY + 1;
}
@Override
public double priority() {
return DEFAULT_PRIORITY + 1;
}
@Override
public String displayName0() {
return "Pause/Resume Commands";
@Override
public String displayName0() {
return "Pause/Resume Commands";
}
}
}
);
pauseCommand = new Command("pause") {
@@ -105,12 +105,12 @@ public class PauseResumeCommands {
@Override
public List<String> getLongDesc() {
return asList(
"The pause command tells Baritone to temporarily stop whatever it's doing.",
"",
"This can be used to pause pathing, building, following, whatever. A single use of the resume command will start it right back up again!",
"",
"Usage:",
"> pause"
"The pause command tells Baritone to temporarily stop whatever it's doing.",
"",
"This can be used to pause pathing, building, following, whatever. A single use of the resume command will start it right back up again!",
"",
"Usage:",
"> pause"
);
}
};
@@ -141,10 +141,10 @@ public class PauseResumeCommands {
@Override
public List<String> getLongDesc() {
return asList(
"The resume command tells Baritone to resume whatever it was doing when you last used pause.",
"",
"Usage:",
"> resume"
"The resume command tells Baritone to resume whatever it was doing when you last used pause.",
"",
"Usage:",
"> resume"
);
}
};
@@ -170,10 +170,10 @@ public class PauseResumeCommands {
@Override
public List<String> getLongDesc() {
return asList(
"The paused command tells you if Baritone is currently paused by use of the pause command.",
"",
"Usage:",
"> paused"
"The paused command tells you if Baritone is currently paused by use of the pause command.",
"",
"Usage:",
"> paused"
);
}
};

View File

@@ -48,19 +48,19 @@ public class ProcCommand extends Command {
}
logDirect(String.format(
"Class: %s\n" +
"Priority: %f\n" +
"Temporary: %b\n" +
"Display name: %s\n" +
"Last command: %s",
process.getClass().getTypeName(),
process.priority(),
process.isTemporary(),
process.displayName(),
pathingControlManager
.mostRecentCommand()
.map(PathingCommand::toString)
.orElse("None")
"Class: %s\n" +
"Priority: %f\n" +
"Temporary: %b\n" +
"Display name: %s\n" +
"Last command: %s",
process.getClass().getTypeName(),
process.priority(),
process.isTemporary(),
process.displayName(),
pathingControlManager
.mostRecentCommand()
.map(PathingCommand::toString)
.orElse("None")
));
}
@@ -77,12 +77,12 @@ public class ProcCommand extends Command {
@Override
public List<String> getLongDesc() {
return asList(
"The proc command provides miscellaneous information about the process currently controlling Baritone.",
"",
"You are not expected to understand this if you aren't familiar with how Baritone works.",
"",
"Usage:",
"> proc - View process information, if present"
"The proc command provides miscellaneous information about the process currently controlling Baritone.",
"",
"You are not expected to understand this if you aren't familiar with how Baritone works.",
"",
"Usage:",
"> proc - View process information, if present"
);
}
}

View File

@@ -51,10 +51,10 @@ public class ReloadAllCommand extends Command {
@Override
public List<String> getLongDesc() {
return asList(
"The reloadall command reloads Baritone's world cache.",
"",
"Usage:",
"> reloadall"
"The reloadall command reloads Baritone's world cache.",
"",
"Usage:",
"> reloadall"
);
}
}

View File

@@ -39,12 +39,12 @@ public class RenderCommand extends Command {
BetterBlockPos origin = ctx.playerFeet();
int renderDistance = (MC.gameSettings.renderDistanceChunks + 1) * 16;
MC.renderGlobal.markBlockRangeForRenderUpdate(
origin.x - renderDistance,
0,
origin.z - renderDistance,
origin.x + renderDistance,
255,
origin.z + renderDistance
origin.x - renderDistance,
0,
origin.z - renderDistance,
origin.x + renderDistance,
255,
origin.z + renderDistance
);
logDirect("Done");
@@ -63,10 +63,10 @@ public class RenderCommand extends Command {
@Override
public List<String> getLongDesc() {
return asList(
"The render command fixes glitched chunk rendering without having to reload all of them.",
"",
"Usage:",
"> render"
"The render command fixes glitched chunk rendering without having to reload all of them.",
"",
"Usage:",
"> render"
);
}
}

View File

@@ -51,10 +51,10 @@ public class RepackCommand extends Command {
@Override
public List<String> getLongDesc() {
return asList(
"Repack chunks around you. This basically re-caches them.",
"",
"Usage:",
"> repack - Repack chunks."
"Repack chunks around you. This basically re-caches them.",
"",
"Usage:",
"> repack - Repack chunks."
);
}
}

View File

@@ -51,10 +51,10 @@ public class SaveAllCommand extends Command {
@Override
public List<String> getLongDesc() {
return asList(
"The saveall command saves Baritone's world cache.",
"",
"Usage:",
"> saveall"
"The saveall command saves Baritone's world cache.",
"",
"Usage:",
"> saveall"
);
}
}

View File

@@ -50,10 +50,10 @@ public class SchematicaCommand extends Command {
@Override
public List<String> getLongDesc() {
return asList(
"Builds the schematica currently open in Schematica.",
"",
"Usage:",
"> schematica"
"Builds the schematica currently open in Schematica.",
"",
"Usage:",
"> schematica"
);
}
}

View File

@@ -19,11 +19,7 @@ package baritone.utils.command.defaults;
import baritone.api.Settings;
import baritone.api.event.events.RenderEvent;
import baritone.api.schematic.CompositeSchematic;
import baritone.api.schematic.FillSchematic;
import baritone.api.schematic.ReplaceSchematic;
import baritone.api.schematic.ShellSchematic;
import baritone.api.schematic.WallsSchematic;
import baritone.api.schematic.*;
import baritone.api.selection.ISelection;
import baritone.api.selection.ISelectionManager;
import baritone.api.utils.BetterBlockPos;
@@ -44,7 +40,7 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.Vec3i;
import java.awt.Color;
import java.awt.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
@@ -109,8 +105,8 @@ public class SelCommand extends Command {
}
} else if (action == Action.SET || action == Action.WALLS || action == Action.SHELL || action == Action.CLEARAREA || action == Action.REPLACE) {
BlockOptionalMeta type = action == Action.CLEARAREA
? new BlockOptionalMeta(Blocks.AIR)
: args.getDatatypeFor(ForBlockOptionalMeta.class);
? new BlockOptionalMeta(Blocks.AIR)
: args.getDatatypeFor(ForBlockOptionalMeta.class);
BlockOptionalMetaLookup replaces = null;
if (action == Action.REPLACE) {
@@ -142,9 +138,9 @@ public class SelCommand extends Command {
for (ISelection selection : selections) {
BetterBlockPos min = selection.min();
origin = new BetterBlockPos(
Math.min(origin.x, min.x),
Math.min(origin.y, min.y),
Math.min(origin.z, min.z)
Math.min(origin.x, min.x),
Math.min(origin.y, min.y),
Math.min(origin.z, min.z)
);
}
@@ -204,10 +200,10 @@ public class SelCommand extends Command {
protected Stream<String> tabCompleted(String label, ArgConsumer args, Settings settings) {
if (args.hasExactlyOne()) {
return new TabCompleteHelper()
.append(Action.getAllNames())
.filterPrefix(args.getString())
.sortAlphabetically()
.stream();
.append(Action.getAllNames())
.filterPrefix(args.getString())
.sortAlphabetically()
.stream();
} else {
Action action = Action.getByName(args.getString());
@@ -227,10 +223,10 @@ public class SelCommand extends Command {
} else if (action == Action.EXPAND || action == Action.CONTRACT || action == Action.SHIFT) {
if (args.hasExactlyOne()) {
return new TabCompleteHelper()
.append(TransformTarget.getAllNames())
.filterPrefix(args.getString())
.sortAlphabetically()
.stream();
.append(TransformTarget.getAllNames())
.filterPrefix(args.getString())
.sortAlphabetically()
.stream();
} else {
TransformTarget target = TransformTarget.getByName(args.getString());
@@ -253,29 +249,29 @@ public class SelCommand extends Command {
@Override
public List<String> getLongDesc() {
return asList(
"The sel command allows you to manipulate Baritone's selections, similarly to WorldEdit.",
"",
"Using these selections, you can clear areas, fill them with blocks, or something else.",
"",
"The expand/contract/shift commands use a kind of selector to choose which selections to target. Supported ones are a/all, n/newest, and o/oldest.",
"",
"Usage:",
"> sel pos1/p1/1 - Set position 1 to your current position.",
"> sel pos1/p1/1 <x> <y> <z> - Set position 1 to a relative position.",
"> sel pos2/p2/2 - Set position 2 to your current position.",
"> sel pos2/p2/2 <x> <y> <z> - Set position 2 to a relative position.",
"",
"> sel clear/c - Clear the selection.",
"> sel undo/u - Undo the last action (setting positions, creating selections, etc.)",
"> sel set/fill/s/f [block] - Completely fill all selections with a block.",
"> sel walls/w [block] - Fill in the walls of the selection with a specified block.",
"> sel shell/shl [block] - The same as walls, but fills in a ceiling and floor too.",
"> sel cleararea/ca - Basically 'set air'.",
"> sel replace/r <blocks...> <with> - Replaces blocks with another block.",
"",
"> sel expand <target> <direction> <blocks> - Expand the targets.",
"> sel contract <target> <direction> <blocks> - Contract the targets.",
"> sel shift <target> <direction> <blocks> - Shift the targets (does not resize)."
"The sel command allows you to manipulate Baritone's selections, similarly to WorldEdit.",
"",
"Using these selections, you can clear areas, fill them with blocks, or something else.",
"",
"The expand/contract/shift commands use a kind of selector to choose which selections to target. Supported ones are a/all, n/newest, and o/oldest.",
"",
"Usage:",
"> sel pos1/p1/1 - Set position 1 to your current position.",
"> sel pos1/p1/1 <x> <y> <z> - Set position 1 to a relative position.",
"> sel pos2/p2/2 - Set position 2 to your current position.",
"> sel pos2/p2/2 <x> <y> <z> - Set position 2 to a relative position.",
"",
"> sel clear/c - Clear the selection.",
"> sel undo/u - Undo the last action (setting positions, creating selections, etc.)",
"> sel set/fill/s/f [block] - Completely fill all selections with a block.",
"> sel walls/w [block] - Fill in the walls of the selection with a specified block.",
"> sel shell/shl [block] - The same as walls, but fills in a ceiling and floor too.",
"> sel cleararea/ca - Basically 'set air'.",
"> sel replace/r <blocks...> <with> - Replaces blocks with another block.",
"",
"> sel expand <target> <direction> <blocks> - Expand the targets.",
"> sel contract <target> <direction> <blocks> - Contract the targets.",
"> sel shift <target> <direction> <blocks> - Shift the targets (does not resize)."
);
}
@@ -327,8 +323,8 @@ public class SelCommand extends Command {
enum TransformTarget {
ALL(sels -> sels, "all", "a"),
NEWEST(sels -> new ISelection[] {sels[sels.length - 1]}, "newest", "n"),
OLDEST(sels -> new ISelection[] {sels[0]}, "oldest", "o");
NEWEST(sels -> new ISelection[]{sels[sels.length - 1]}, "newest", "n"),
OLDEST(sels -> new ISelection[]{sels[0]}, "oldest", "o");
private final Function<ISelection[], ISelection[]> transform;
private final String[] names;

View File

@@ -66,44 +66,44 @@ public class SetCommand extends Command {
args.requireMax(1);
List<? extends Settings.Setting> toPaginate =
(viewModified ? SettingsUtil.modifiedSettings(settings) : settings.allSettings).stream()
.filter(s -> !s.getName().equals("logger"))
.filter(s -> s.getName().toLowerCase(Locale.US).contains(search.toLowerCase(Locale.US)))
.sorted((s1, s2) -> String.CASE_INSENSITIVE_ORDER.compare(s1.getName(), s2.getName()))
.collect(Collectors.toList());
(viewModified ? SettingsUtil.modifiedSettings(settings) : settings.allSettings).stream()
.filter(s -> !s.getName().equals("logger"))
.filter(s -> s.getName().toLowerCase(Locale.US).contains(search.toLowerCase(Locale.US)))
.sorted((s1, s2) -> String.CASE_INSENSITIVE_ORDER.compare(s1.getName(), s2.getName()))
.collect(Collectors.toList());
Paginator.paginate(
args,
new Paginator<>(toPaginate),
() -> logDirect(
!search.isEmpty()
? String.format("All %ssettings containing the string '%s':", viewModified ? "modified " : "", search)
: String.format("All %ssettings:", viewModified ? "modified " : "")
),
setting -> {
ITextComponent typeComponent = new TextComponentString(String.format(
" (%s)",
settingTypeToString(setting)
));
typeComponent.getStyle().setColor(TextFormatting.DARK_GRAY);
args,
new Paginator<>(toPaginate),
() -> logDirect(
!search.isEmpty()
? String.format("All %ssettings containing the string '%s':", viewModified ? "modified " : "", search)
: String.format("All %ssettings:", viewModified ? "modified " : "")
),
setting -> {
ITextComponent typeComponent = new TextComponentString(String.format(
" (%s)",
settingTypeToString(setting)
));
typeComponent.getStyle().setColor(TextFormatting.DARK_GRAY);
ITextComponent hoverComponent = new TextComponentString("");
hoverComponent.getStyle().setColor(TextFormatting.GRAY);
hoverComponent.appendText(setting.getName());
hoverComponent.appendText(String.format("\nType: %s", settingTypeToString(setting)));
hoverComponent.appendText(String.format("\n\nValue:\n%s", settingValueToString(setting)));
String commandSuggestion = settings.prefix.value + String.format("set %s ", setting.getName());
ITextComponent hoverComponent = new TextComponentString("");
hoverComponent.getStyle().setColor(TextFormatting.GRAY);
hoverComponent.appendText(setting.getName());
hoverComponent.appendText(String.format("\nType: %s", settingTypeToString(setting)));
hoverComponent.appendText(String.format("\n\nValue:\n%s", settingValueToString(setting)));
String commandSuggestion = settings.prefix.value + String.format("set %s ", setting.getName());
ITextComponent component = new TextComponentString(setting.getName());
component.getStyle().setColor(TextFormatting.GRAY);
component.appendSibling(typeComponent);
component.getStyle()
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverComponent))
.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, commandSuggestion));
ITextComponent component = new TextComponentString(setting.getName());
component.getStyle().setColor(TextFormatting.GRAY);
component.appendSibling(typeComponent);
component.getStyle()
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverComponent))
.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, commandSuggestion));
return component;
},
FORCE_COMMAND_PREFIX + "set " + arg + " " + search
return component;
},
FORCE_COMMAND_PREFIX + "set " + arg + " " + search
);
return;
@@ -135,9 +135,9 @@ public class SetCommand extends Command {
String settingName = doingSomething ? args.getString() : arg;
Settings.Setting<?> setting = settings.allSettings.stream()
.filter(s -> s.getName().equalsIgnoreCase(settingName))
.findFirst()
.orElse(null);
.filter(s -> s.getName().equalsIgnoreCase(settingName))
.findFirst()
.orElse(null);
if (isNull(setting)) {
throw new CommandInvalidTypeException(args.consumed(), "a valid setting");
@@ -160,9 +160,9 @@ public class SetCommand extends Command {
((Settings.Setting<Boolean>) setting).value ^= true;
logDirect(String.format(
"Toggled setting %s to %s",
setting.getName(),
Boolean.toString((Boolean) setting.value)
"Toggled setting %s to %s",
setting.getName(),
Boolean.toString((Boolean) setting.value)
));
} else {
String newValue = args.getString();
@@ -177,29 +177,29 @@ public class SetCommand extends Command {
if (!toggling) {
logDirect(String.format(
"Successfully %s %s to %s",
resetting ? "reset" : "set",
setting.getName(),
settingValueToString(setting)
"Successfully %s %s to %s",
resetting ? "reset" : "set",
setting.getName(),
settingValueToString(setting)
));
}
ITextComponent oldValueComponent = new TextComponentString(String.format("Old value: %s", oldValue));
oldValueComponent.getStyle()
.setColor(TextFormatting.GRAY)
.setHoverEvent(new HoverEvent(
HoverEvent.Action.SHOW_TEXT,
new TextComponentString("Click to set the setting back to this value")
))
.setClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,
FORCE_COMMAND_PREFIX + String.format("set %s %s", setting.getName(), oldValue)
));
.setColor(TextFormatting.GRAY)
.setHoverEvent(new HoverEvent(
HoverEvent.Action.SHOW_TEXT,
new TextComponentString("Click to set the setting back to this value")
))
.setClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,
FORCE_COMMAND_PREFIX + String.format("set %s %s", setting.getName(), oldValue)
));
logDirect(oldValueComponent);
if ((setting.getName().equals("chatControl") && !(Boolean) setting.value && !settings.chatControlAnyway.value) ||
setting.getName().equals("chatControlAnyway") && !(Boolean) setting.value && !settings.chatControl.value) {
setting.getName().equals("chatControlAnyway") && !(Boolean) setting.value && !settings.chatControl.value) {
logDirect("Warning: Chat commands will no longer work. If you want to revert this change, use prefix control (if enabled) or click the old value listed above.", TextFormatting.RED);
} else if (setting.getName().equals("prefixControl") && !(Boolean) setting.value) {
logDirect("Warning: Prefixed commands will no longer work. If you want to revert this change, use chat control (if enabled) or click the old value listed above.", TextFormatting.RED);
@@ -217,15 +217,15 @@ public class SetCommand extends Command {
if (args.hasExactlyOne() && !asList("s", "save").contains(args.peekString().toLowerCase(Locale.US))) {
if (arg.equalsIgnoreCase("reset")) {
return new TabCompleteHelper()
.addModifiedSettings()
.prepend("all")
.filterPrefix(args.getString())
.stream();
.addModifiedSettings()
.prepend("all")
.filterPrefix(args.getString())
.stream();
} else if (arg.equalsIgnoreCase("toggle")) {
return new TabCompleteHelper()
.addToggleableSettings()
.filterPrefix(args.getString())
.stream();
.addToggleableSettings()
.filterPrefix(args.getString())
.stream();
}
Settings.Setting setting = settings.byLowerName.get(arg.toLowerCase(Locale.US));
@@ -247,11 +247,11 @@ public class SetCommand extends Command {
}
} else if (!args.has()) {
return new TabCompleteHelper()
.addSettings()
.sortAlphabetically()
.prepend("list", "modified", "reset", "toggle", "save")
.filterPrefix(arg)
.stream();
.addSettings()
.sortAlphabetically()
.prepend("list", "modified", "reset", "toggle", "save")
.filterPrefix(arg)
.stream();
}
}
@@ -266,18 +266,18 @@ public class SetCommand extends Command {
@Override
public List<String> getLongDesc() {
return asList(
"Using the set command, you can manage all of Baritone's settings. Almost every aspect is controlled by these settings - go wild!",
"",
"Usage:",
"> set - Same as `set list`",
"> set list [page] - View all settings",
"> set modified [page] - View modified settings",
"> set <setting> - View the current value of a setting",
"> set <setting> <value> - Set the value of a setting",
"> set reset all - Reset ALL SETTINGS to their defaults",
"> set reset <setting> - Reset a setting to its default",
"> set toggle <setting> - Toggle a boolean setting",
"> set save - Save all settings (this is automatic tho)"
"Using the set command, you can manage all of Baritone's settings. Almost every aspect is controlled by these settings - go wild!",
"",
"Usage:",
"> set - Same as `set list`",
"> set list [page] - View all settings",
"> set modified [page] - View modified settings",
"> set <setting> - View the current value of a setting",
"> set <setting> <value> - Set the value of a setting",
"> set reset all - Reset ALL SETTINGS to their defaults",
"> set reset <setting> - Reset a setting to its default",
"> set toggle <setting> - Toggle a boolean setting",
"> set save - Save all settings (this is automatic tho)"
);
}
}

View File

@@ -37,9 +37,9 @@ public class ThisWayCommand extends Command {
args.requireExactly(1);
GoalXZ goal = GoalXZ.fromDirection(
ctx.playerFeetAsVec(),
ctx.player().rotationYawHead,
args.getAs(Double.class)
ctx.playerFeetAsVec(),
ctx.player().rotationYawHead,
args.getAs(Double.class)
);
baritone.getCustomGoalProcess().setGoal(goal);
@@ -59,10 +59,10 @@ public class ThisWayCommand extends Command {
@Override
public List<String> getLongDesc() {
return asList(
"Creates a GoalXZ some amount of blocks in the direction you're currently looking",
"",
"Usage:",
"> thisway <distance> - makes a GoalXZ distance blocks in front of you"
"Creates a GoalXZ some amount of blocks in the direction you're currently looking",
"",
"Usage:",
"> thisway <distance> - makes a GoalXZ distance blocks in front of you"
);
}
}

View File

@@ -38,8 +38,8 @@ public class TunnelCommand extends Command {
args.requireMax(0);
Goal goal = new GoalStrictDirection(
ctx.playerFeet(),
ctx.player().getHorizontalFacing()
ctx.playerFeet(),
ctx.player().getHorizontalFacing()
);
baritone.getCustomGoalProcess().setGoal(goal);
@@ -59,10 +59,10 @@ public class TunnelCommand extends Command {
@Override
public List<String> getLongDesc() {
return asList(
"The tunnel command sets a goal that tells Baritone to mine completely straight in the direction that you're facing.",
"",
"Usage:",
"> tunnel"
"The tunnel command sets a goal that tells Baritone to mine completely straight in the direction that you're facing.",
"",
"Usage:",
"> tunnel"
);
}
}

View File

@@ -59,10 +59,10 @@ public class VersionCommand extends Command {
@Override
public List<String> getLongDesc() {
return asList(
"The version command prints the version of Baritone you're currently running.",
"",
"Usage:",
"> version - View version information, if present"
"The version command prints the version of Baritone you're currently running.",
"",
"Usage:",
"> version - View version information, if present"
);
}
}

View File

@@ -76,27 +76,27 @@ public class WaypointsCommand extends Command {
component.appendSibling(nameComponent);
component.appendSibling(timestamp);
component.getStyle()
.setHoverEvent(new HoverEvent(
HoverEvent.Action.SHOW_TEXT,
new TextComponentString("Click to select")
))
.setClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,
String.format(
"%s%s %s %s @ %d",
FORCE_COMMAND_PREFIX,
label,
_action.names[0],
waypoint.getTag().getName(),
waypoint.getCreationTimestamp()
.setHoverEvent(new HoverEvent(
HoverEvent.Action.SHOW_TEXT,
new TextComponentString("Click to select")
))
);
.setClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,
String.format(
"%s%s %s %s @ %d",
FORCE_COMMAND_PREFIX,
label,
_action.names[0],
waypoint.getTag().getName(),
waypoint.getCreationTimestamp()
))
);
return component;
};
Function<IWaypoint, ITextComponent> transform = waypoint ->
toComponent.apply(waypoint, action == Action.LIST ? Action.INFO : action);
toComponent.apply(waypoint, action == Action.LIST ? Action.INFO : action);
if (action == Action.LIST) {
IWaypoint.Tag tag = args.has() ? IWaypoint.Tag.getByName(args.peekString()) : null;
@@ -106,34 +106,34 @@ public class WaypointsCommand extends Command {
}
IWaypoint[] waypoints = tag != null
? ForWaypoints.getWaypointsByTag(tag)
: ForWaypoints.getWaypoints();
? ForWaypoints.getWaypointsByTag(tag)
: ForWaypoints.getWaypoints();
if (waypoints.length > 0) {
args.requireMax(1);
Paginator.paginate(
args,
waypoints,
() -> logDirect(
tag != null
? String.format("All waypoints by tag %s:", tag.name())
: "All waypoints:"
),
transform,
String.format(
"%s%s %s%s",
FORCE_COMMAND_PREFIX,
label,
action.names[0],
tag != null ? " " + tag.getName() : ""
)
args,
waypoints,
() -> logDirect(
tag != null
? String.format("All waypoints by tag %s:", tag.name())
: "All waypoints:"
),
transform,
String.format(
"%s%s %s%s",
FORCE_COMMAND_PREFIX,
label,
action.names[0],
tag != null ? " " + tag.getName() : ""
)
);
} else {
args.requireMax(0);
throw new CommandInvalidStateException(
tag != null
? "No waypoints found by that tag"
: "No waypoints found"
tag != null
? "No waypoints found by that tag"
: "No waypoints found"
);
}
} else if (action == Action.SAVE) {
@@ -145,8 +145,8 @@ public class WaypointsCommand extends Command {
String name = args.has() ? args.getString() : "";
BetterBlockPos pos = args.has()
? args.getDatatypePost(RelativeBlockPos.class, ctx.playerFeet())
: ctx.playerFeet();
? args.getDatatypePost(RelativeBlockPos.class, ctx.playerFeet())
: ctx.playerFeet();
args.requireMax(0);
@@ -198,17 +198,17 @@ public class WaypointsCommand extends Command {
if (waypoint == null) {
args.requireMax(1);
Paginator.paginate(
args,
waypoints,
() -> logDirect("Multiple waypoints were found:"),
transform,
String.format(
"%s%s %s %s",
FORCE_COMMAND_PREFIX,
label,
action.names[0],
args.consumedString()
)
args,
waypoints,
() -> logDirect("Multiple waypoints were found:"),
transform,
String.format(
"%s%s %s %s",
FORCE_COMMAND_PREFIX,
label,
action.names[0],
args.consumedString()
)
);
} else {
if (action == Action.INFO) {
@@ -216,34 +216,34 @@ public class WaypointsCommand extends Command {
logDirect(String.format("Position: %s", waypoint.getLocation()));
ITextComponent deleteComponent = new TextComponentString("Click to delete this waypoint");
deleteComponent.getStyle().setClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,
String.format(
"%s%s delete %s @ %d",
FORCE_COMMAND_PREFIX,
label,
waypoint.getTag().getName(),
waypoint.getCreationTimestamp()
)
ClickEvent.Action.RUN_COMMAND,
String.format(
"%s%s delete %s @ %d",
FORCE_COMMAND_PREFIX,
label,
waypoint.getTag().getName(),
waypoint.getCreationTimestamp()
)
));
ITextComponent goalComponent = new TextComponentString("Click to set goal to this waypoint");
goalComponent.getStyle().setClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,
String.format(
"%s%s goal %s @ %d",
FORCE_COMMAND_PREFIX,
label,
waypoint.getTag().getName(),
waypoint.getCreationTimestamp()
)
ClickEvent.Action.RUN_COMMAND,
String.format(
"%s%s goal %s @ %d",
FORCE_COMMAND_PREFIX,
label,
waypoint.getTag().getName(),
waypoint.getCreationTimestamp()
)
));
ITextComponent backComponent = new TextComponentString("Click to return to the waypoints list");
backComponent.getStyle().setClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,
String.format(
"%s%s list",
FORCE_COMMAND_PREFIX,
label
)
ClickEvent.Action.RUN_COMMAND,
String.format(
"%s%s list",
FORCE_COMMAND_PREFIX,
label
)
));
logDirect(deleteComponent);
logDirect(goalComponent);
@@ -265,20 +265,20 @@ public class WaypointsCommand extends Command {
if (args.has()) {
if (args.hasExactlyOne()) {
return new TabCompleteHelper()
.append(Action.getAllNames())
.sortAlphabetically()
.filterPrefix(args.getString())
.stream();
.append(Action.getAllNames())
.sortAlphabetically()
.filterPrefix(args.getString())
.stream();
} else {
Action action = Action.getByName(args.getString());
if (args.hasExactlyOne()) {
if (action == Action.LIST || action == Action.SAVE || action == Action.CLEAR) {
return new TabCompleteHelper()
.append(IWaypoint.Tag.getAllNames())
.sortAlphabetically()
.filterPrefix(args.getString())
.stream();
.append(IWaypoint.Tag.getAllNames())
.sortAlphabetically()
.filterPrefix(args.getString())
.stream();
} else {
return args.tabCompleteDatatype(ForWaypoints.class);
}
@@ -301,20 +301,20 @@ public class WaypointsCommand extends Command {
@Override
public List<String> getLongDesc() {
return asList(
"The waypoint command allows you to manage Baritone's waypoints.",
"",
"Waypoints can be used to mark positions for later. Waypoints are each given a tag and an optional name.",
"",
"Note that the info, delete, and goal commands let you specify a waypoint by tag. If there is more than one waypoint with a certain tag, then they will let you select which waypoint you mean.",
"",
"Usage:",
"> wp [l/list] - List all waypoints.",
"> wp <s/save> <tag> - Save your current position as an unnamed waypoint with the specified tag.",
"> wp <s/save> <tag> <name> - Save the waypoint with the specified name.",
"> wp <s/save> <tag> <name> <pos> - Save the waypoint with the specified name and position.",
"> wp <i/info/show> <tag> - Show info on a waypoint by tag.",
"> wp <d/delete> <tag> - Delete a waypoint by tag.",
"> wp <g/goal/goto> <tag> - Set a goal to a waypoint by tag."
"The waypoint command allows you to manage Baritone's waypoints.",
"",
"Waypoints can be used to mark positions for later. Waypoints are each given a tag and an optional name.",
"",
"Note that the info, delete, and goal commands let you specify a waypoint by tag. If there is more than one waypoint with a certain tag, then they will let you select which waypoint you mean.",
"",
"Usage:",
"> wp [l/list] - List all waypoints.",
"> wp <s/save> <tag> - Save your current position as an unnamed waypoint with the specified tag.",
"> wp <s/save> <tag> <name> - Save the waypoint with the specified name.",
"> wp <s/save> <tag> <name> <pos> - Save the waypoint with the specified name and position.",
"> wp <i/info/show> <tag> - Show info on a waypoint by tag.",
"> wp <d/delete> <tag> - Delete a waypoint by tag.",
"> wp <g/goal/goto> <tag> - Set a goal to a waypoint by tag."
);
}

View File

@@ -18,7 +18,6 @@
package baritone.utils.schematic.schematica;
import baritone.api.utils.ISchematic;
import com.github.lunatrius.schematica.client.world.SchematicWorld;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;

View File

@@ -39,7 +39,7 @@ public enum SchematicaHelper {
public static Optional<Tuple<ISchematic, BlockPos>> getOpenSchematic() {
return Optional.ofNullable(ClientProxy.schematic)
.map(world -> new Tuple<>(new SchematicAdapter(world), world.position));
.map(world -> new Tuple<>(new SchematicAdapter(world), world.position));
}
}