its too many blank lines
This commit is contained in:
parent
0a38e6f690
commit
61d4f102ba
@ -21,6 +21,7 @@ package baritone.api.event.events.type;
|
||||
* @author LoganDark
|
||||
*/
|
||||
public class Overrideable<T> {
|
||||
|
||||
private T value;
|
||||
private boolean modified;
|
||||
|
||||
|
@ -30,7 +30,6 @@ public class CompositeSchematic extends AbstractSchematic {
|
||||
|
||||
private void recalcArr() {
|
||||
schematicArr = schematics.toArray(new CompositeSchematicEntry[0]);
|
||||
|
||||
for (CompositeSchematicEntry entry : schematicArr) {
|
||||
this.x = Math.max(x, entry.x + entry.schematic.widthX());
|
||||
this.y = Math.max(y, entry.y + entry.schematic.heightY());
|
||||
@ -56,7 +55,6 @@ public class CompositeSchematic extends AbstractSchematic {
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -69,11 +67,9 @@ public class CompositeSchematic extends AbstractSchematic {
|
||||
@Override
|
||||
public IBlockState desiredState(int x, int y, int z, IBlockState current, List<IBlockState> approxPlaceable) {
|
||||
CompositeSchematicEntry entry = getSchematic(x, y, z, current);
|
||||
|
||||
if (entry == null) {
|
||||
throw new IllegalStateException("couldn't find schematic for this position");
|
||||
}
|
||||
|
||||
return entry.schematic.desiredState(x - entry.x, y - entry.y, z - entry.z, current, approxPlaceable);
|
||||
}
|
||||
}
|
||||
|
@ -43,13 +43,11 @@ public class FillSchematic extends AbstractSchematic {
|
||||
} else if (current.getBlock() != Blocks.AIR) {
|
||||
return Blocks.AIR.getDefaultState();
|
||||
}
|
||||
|
||||
for (IBlockState placeable : approxPlaceable) {
|
||||
if (bom.matches(placeable)) {
|
||||
return placeable;
|
||||
}
|
||||
}
|
||||
|
||||
return bom.getAnyBlockState();
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,6 @@ public class ReplaceSchematic extends MaskSchematic {
|
||||
if (cache[x][y][z] == null) {
|
||||
cache[x][y][z] = filter.has(currentState);
|
||||
}
|
||||
|
||||
return cache[x][y][z];
|
||||
}
|
||||
}
|
||||
|
@ -68,12 +68,9 @@ public class BaritoneChatControl implements Helper, AbstractGameEventListener {
|
||||
String msg = event.getMessage();
|
||||
String prefix = settings.prefix.value;
|
||||
boolean forceRun = msg.startsWith(FORCE_COMMAND_PREFIX);
|
||||
|
||||
if ((settings.prefixControl.value && msg.startsWith(prefix)) || forceRun) {
|
||||
event.cancel();
|
||||
|
||||
String commandStr = msg.substring(forceRun ? FORCE_COMMAND_PREFIX.length() : prefix.length());
|
||||
|
||||
if (!runCommand(commandStr) && !commandStr.trim().isEmpty()) {
|
||||
new CommandNotFoundException(CommandExecution.expand(commandStr).first()).handle(null, null);
|
||||
}
|
||||
@ -86,7 +83,6 @@ public class BaritoneChatControl implements Helper, AbstractGameEventListener {
|
||||
if (settings.echoCommands.value) {
|
||||
String msg = command + rest;
|
||||
String toDisplay = settings.censorRanCommands.value ? command + " ..." : msg;
|
||||
|
||||
ITextComponent component = new TextComponentString(String.format("> %s", toDisplay));
|
||||
component.getStyle()
|
||||
.setColor(TextFormatting.WHITE)
|
||||
@ -98,7 +94,6 @@ public class BaritoneChatControl implements Helper, AbstractGameEventListener {
|
||||
ClickEvent.Action.RUN_COMMAND,
|
||||
FORCE_COMMAND_PREFIX + msg
|
||||
));
|
||||
|
||||
logDirect(component);
|
||||
}
|
||||
}
|
||||
@ -111,31 +106,24 @@ public class BaritoneChatControl implements Helper, AbstractGameEventListener {
|
||||
try {
|
||||
((IGuiScreen) mc.currentScreen).openLink(new URI("https://www.dominos.com/en/pages/order/"));
|
||||
} catch (NullPointerException | URISyntaxException ignored) {}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (msg.isEmpty()) {
|
||||
msg = "help";
|
||||
}
|
||||
|
||||
Pair<String, List<CommandArgument>> pair = CommandExecution.expand(msg);
|
||||
String command = pair.first();
|
||||
String rest = msg.substring(pair.first().length());
|
||||
ArgConsumer argc = new ArgConsumer(pair.second());
|
||||
|
||||
if (!argc.has()) {
|
||||
Settings.Setting setting = settings.byLowerName.get(command.toLowerCase(Locale.US));
|
||||
|
||||
if (setting != null) {
|
||||
logRanCommand(command, rest);
|
||||
|
||||
if (setting.getValueClass() == Boolean.class) {
|
||||
CommandManager.execute(String.format("set toggle %s", setting.getName()));
|
||||
} else {
|
||||
CommandManager.execute(String.format("set %s", setting.getName()));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
} else if (argc.hasExactlyOne()) {
|
||||
@ -143,7 +131,6 @@ public class BaritoneChatControl implements Helper, AbstractGameEventListener {
|
||||
if (setting.getName().equals("logger")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (setting.getName().equalsIgnoreCase(pair.first())) {
|
||||
logRanCommand(command, rest);
|
||||
CommandManager.execute(String.format("set %s %s", setting.getName(), argc.getString()));
|
||||
@ -151,16 +138,12 @@ public class BaritoneChatControl implements Helper, AbstractGameEventListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CommandExecution execution = CommandExecution.from(pair);
|
||||
|
||||
if (isNull(execution)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logRanCommand(command, rest);
|
||||
CommandManager.execute(execution);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -169,30 +152,23 @@ public class BaritoneChatControl implements Helper, AbstractGameEventListener {
|
||||
if (!settings.prefixControl.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
String prefix = event.prefix.get();
|
||||
String commandPrefix = settings.prefix.value;
|
||||
|
||||
if (!prefix.startsWith(commandPrefix)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String msg = prefix.substring(commandPrefix.length());
|
||||
|
||||
List<CommandArgument> args = CommandArgument.from(msg, true);
|
||||
Stream<String> stream = tabComplete(msg);
|
||||
|
||||
if (args.size() == 1) {
|
||||
stream = stream.map(x -> commandPrefix + x);
|
||||
}
|
||||
|
||||
event.completions.set(stream.toArray(String[]::new));
|
||||
}
|
||||
|
||||
public Stream<String> tabComplete(String msg) {
|
||||
List<CommandArgument> args = CommandArgument.from(msg, true);
|
||||
ArgConsumer argc = new ArgConsumer(args);
|
||||
|
||||
if (argc.hasAtMost(2)) {
|
||||
if (argc.hasExactly(1)) {
|
||||
return new TabCompleteHelper()
|
||||
@ -201,26 +177,21 @@ public class BaritoneChatControl implements Helper, AbstractGameEventListener {
|
||||
.filterPrefix(argc.getString())
|
||||
.stream();
|
||||
}
|
||||
|
||||
Settings.Setting setting = settings.byLowerName.get(argc.getString().toLowerCase(Locale.US));
|
||||
|
||||
if (nonNull(setting)) {
|
||||
if (setting.getValueClass() == Boolean.class) {
|
||||
TabCompleteHelper helper = new TabCompleteHelper();
|
||||
|
||||
if ((Boolean) setting.value) {
|
||||
helper.append(Stream.of("true", "false"));
|
||||
} else {
|
||||
helper.append(Stream.of("false", "true"));
|
||||
}
|
||||
|
||||
return helper.filterPrefix(argc.getString()).stream();
|
||||
} else {
|
||||
return Stream.of(SettingsUtil.settingValueToString(setting));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return CommandManager.tabComplete(msg);
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,6 @@ public abstract class Command implements Helper {
|
||||
protected IBaritone baritone;
|
||||
protected IPlayerContext ctx;
|
||||
protected Minecraft MC = mc;
|
||||
|
||||
/**
|
||||
* The names of this command. This is what you put after the command prefix.
|
||||
*/
|
||||
|
@ -18,6 +18,7 @@
|
||||
package baritone.api.utils.command.argparser;
|
||||
|
||||
public abstract class ArgParser<T> implements IArgParser<T> {
|
||||
|
||||
private final Class<T> klass;
|
||||
|
||||
protected ArgParser(Class<T> klass) {
|
||||
@ -30,6 +31,7 @@ public abstract class ArgParser<T> implements IArgParser<T> {
|
||||
}
|
||||
|
||||
public static abstract class Stated<T, S> extends ArgParser<T> implements IArgParser.Stated<T, S> {
|
||||
|
||||
private final Class<S> stateKlass;
|
||||
|
||||
protected Stated(Class<T> klass, Class<S> stateKlass) {
|
||||
|
@ -25,6 +25,7 @@ import baritone.api.utils.command.registry.Registry;
|
||||
import static java.util.Objects.isNull;
|
||||
|
||||
public class ArgParserManager {
|
||||
|
||||
public static final Registry<ArgParser> REGISTRY = new Registry<>();
|
||||
|
||||
static {
|
||||
@ -73,11 +74,9 @@ public class ArgParserManager {
|
||||
*/
|
||||
public static <T> T parseStateless(Class<T> klass, CommandArgument arg) {
|
||||
ArgParser.Stateless<T> parser = getParserStateless(klass);
|
||||
|
||||
if (isNull(parser)) {
|
||||
throw new CommandNoParserForTypeException(klass);
|
||||
}
|
||||
|
||||
try {
|
||||
return parser.parseArg(arg);
|
||||
} catch (RuntimeException exc) {
|
||||
@ -98,11 +97,9 @@ public class ArgParserManager {
|
||||
*/
|
||||
public static <T, S> T parseStated(Class<T> klass, Class<S> stateKlass, CommandArgument arg, S state) {
|
||||
ArgParser.Stated<T, S> parser = getParserStated(klass, stateKlass);
|
||||
|
||||
if (isNull(parser)) {
|
||||
throw new CommandNoParserForTypeException(klass);
|
||||
}
|
||||
|
||||
try {
|
||||
return parser.parseArg(arg, state);
|
||||
} catch (RuntimeException exc) {
|
||||
|
@ -25,7 +25,9 @@ import java.util.Locale;
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
public class DefaultArgParsers {
|
||||
|
||||
public static class IntArgumentParser extends ArgParser<Integer> implements IArgParser.Stateless<Integer> {
|
||||
|
||||
public static final IntArgumentParser INSTANCE = new IntArgumentParser();
|
||||
|
||||
public IntArgumentParser() {
|
||||
@ -39,6 +41,7 @@ public class DefaultArgParsers {
|
||||
}
|
||||
|
||||
public static class LongArgumentParser extends ArgParser<Long> implements IArgParser.Stateless<Long> {
|
||||
|
||||
public static final LongArgumentParser INSTANCE = new LongArgumentParser();
|
||||
|
||||
public LongArgumentParser() {
|
||||
@ -52,6 +55,7 @@ public class DefaultArgParsers {
|
||||
}
|
||||
|
||||
public static class FloatArgumentParser extends ArgParser<Float> implements IArgParser.Stateless<Float> {
|
||||
|
||||
public static final FloatArgumentParser INSTANCE = new FloatArgumentParser();
|
||||
|
||||
public FloatArgumentParser() {
|
||||
@ -61,16 +65,15 @@ public class DefaultArgParsers {
|
||||
@Override
|
||||
public Float parseArg(CommandArgument arg) throws RuntimeException {
|
||||
String value = arg.value;
|
||||
|
||||
if (!value.matches("^([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)|)$")) {
|
||||
throw new RuntimeException("failed float format check");
|
||||
}
|
||||
|
||||
return Float.parseFloat(value);
|
||||
}
|
||||
}
|
||||
|
||||
public static class DoubleArgumentParser extends ArgParser<Double> implements IArgParser.Stateless<Double> {
|
||||
|
||||
public static final DoubleArgumentParser INSTANCE = new DoubleArgumentParser();
|
||||
|
||||
public DoubleArgumentParser() {
|
||||
@ -80,18 +83,16 @@ public class DefaultArgParsers {
|
||||
@Override
|
||||
public Double parseArg(CommandArgument arg) throws RuntimeException {
|
||||
String value = arg.value;
|
||||
|
||||
if (!value.matches("^([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)|)$")) {
|
||||
throw new RuntimeException("failed double format check");
|
||||
}
|
||||
|
||||
return Double.parseDouble(value);
|
||||
}
|
||||
}
|
||||
|
||||
public static class BooleanArgumentParser extends ArgParser<Boolean> implements IArgParser.Stateless<Boolean> {
|
||||
public static final BooleanArgumentParser INSTANCE = new BooleanArgumentParser();
|
||||
|
||||
public static final BooleanArgumentParser INSTANCE = new BooleanArgumentParser();
|
||||
public static final List<String> TRUTHY_VALUES = asList("1", "true", "yes", "t", "y", "on", "enable");
|
||||
public static final List<String> FALSY_VALUES = asList("0", "false", "no", "f", "n", "off", "disable");
|
||||
|
||||
@ -102,7 +103,6 @@ public class DefaultArgParsers {
|
||||
@Override
|
||||
public Boolean parseArg(CommandArgument arg) throws RuntimeException {
|
||||
String value = arg.value;
|
||||
|
||||
if (TRUTHY_VALUES.contains(value.toLowerCase(Locale.US))) {
|
||||
return true;
|
||||
} else if (FALSY_VALUES.contains(value.toLowerCase(Locale.US))) {
|
||||
|
@ -20,6 +20,7 @@ package baritone.api.utils.command.argparser;
|
||||
import baritone.api.utils.command.argument.CommandArgument;
|
||||
|
||||
public interface IArgParser<T> {
|
||||
|
||||
/**
|
||||
* @return the class of this parser.
|
||||
*/
|
||||
@ -31,6 +32,7 @@ public interface IArgParser<T> {
|
||||
* @see ArgParserManager#REGISTRY
|
||||
*/
|
||||
interface Stateless<T> extends IArgParser<T> {
|
||||
|
||||
/**
|
||||
* @param arg The argument to parse.
|
||||
* @return What it was parsed into.
|
||||
@ -47,6 +49,7 @@ public interface IArgParser<T> {
|
||||
* @see ArgParserManager#REGISTRY
|
||||
*/
|
||||
interface Stated<T, S> extends IArgParser<T> {
|
||||
|
||||
Class<S> getStateKlass();
|
||||
|
||||
/**
|
||||
|
@ -38,6 +38,7 @@ import java.util.regex.Pattern;
|
||||
* You're recommended to use {@link ArgConsumer}s to handle these. Check out {@link ArgConsumer#from(String)}
|
||||
*/
|
||||
public class CommandArgument {
|
||||
|
||||
public final int index;
|
||||
public final String value;
|
||||
public final String rawRest;
|
||||
@ -149,14 +150,11 @@ public class CommandArgument {
|
||||
argMatcher.group(),
|
||||
string.substring(argMatcher.start())
|
||||
));
|
||||
|
||||
lastEnd = argMatcher.end();
|
||||
}
|
||||
|
||||
if (preserveEmptyLast && lastEnd < string.length()) {
|
||||
args.add(new CommandArgument(args.size(), "", ""));
|
||||
}
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@ import net.minecraft.util.ResourceLocation;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class BlockById implements IDatatypeFor<Block> {
|
||||
|
||||
public final Block block;
|
||||
|
||||
public BlockById() {
|
||||
@ -34,7 +35,6 @@ public class BlockById implements IDatatypeFor<Block> {
|
||||
|
||||
public BlockById(ArgConsumer consumer) {
|
||||
ResourceLocation id = new ResourceLocation(consumer.getString());
|
||||
|
||||
if ((block = Block.REGISTRY.getObject(id)) == Blocks.AIR) {
|
||||
throw new IllegalArgumentException("no block found by that id");
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ import java.util.stream.Stream;
|
||||
import static java.util.Objects.isNull;
|
||||
|
||||
public class EntityClassById implements IDatatypeFor<Class<? extends Entity>> {
|
||||
|
||||
public final Class<? extends Entity> entity;
|
||||
|
||||
public EntityClassById() {
|
||||
@ -36,7 +37,6 @@ public class EntityClassById implements IDatatypeFor<Class<? extends Entity>> {
|
||||
|
||||
public EntityClassById(ArgConsumer consumer) {
|
||||
ResourceLocation id = new ResourceLocation(consumer.getString());
|
||||
|
||||
if (isNull(entity = EntityList.REGISTRY.getObject(id))) {
|
||||
throw new IllegalArgumentException("no entity found by that id");
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import baritone.api.utils.command.helpers.arguments.ArgConsumer;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class ForBlockOptionalMeta implements IDatatypeFor<BlockOptionalMeta> {
|
||||
|
||||
public final BlockOptionalMeta selector;
|
||||
|
||||
public ForBlockOptionalMeta() {
|
||||
|
@ -26,6 +26,7 @@ import java.util.Locale;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class ForEnumFacing implements IDatatypeFor<EnumFacing> {
|
||||
|
||||
private final EnumFacing facing;
|
||||
|
||||
public ForEnumFacing() {
|
||||
|
@ -28,6 +28,7 @@ import java.util.Comparator;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class ForWaypoints implements IDatatypeFor<IWaypoint[]> {
|
||||
|
||||
private final IWaypoint[] waypoints;
|
||||
|
||||
public ForWaypoints() {
|
||||
|
@ -31,6 +31,7 @@ import java.util.stream.Stream;
|
||||
* can create an instance for tab completion.
|
||||
*/
|
||||
public interface IDatatype {
|
||||
|
||||
/**
|
||||
* One benefit over datatypes over {@link ArgParser}s is that instead of each command trying to guess what values
|
||||
* the datatype will accept, or simply not tab completing at all, datatypes that support tab completion can provide
|
||||
|
@ -18,5 +18,6 @@
|
||||
package baritone.api.utils.command.datatypes;
|
||||
|
||||
public interface IDatatypeFor<T> extends IDatatype {
|
||||
|
||||
T get();
|
||||
}
|
||||
|
@ -18,5 +18,6 @@
|
||||
package baritone.api.utils.command.datatypes;
|
||||
|
||||
public interface IDatatypePost<T, O> extends IDatatype {
|
||||
|
||||
T apply(O original);
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ import java.util.stream.Stream;
|
||||
import static java.util.Objects.isNull;
|
||||
|
||||
public class PlayerByUsername implements IDatatypeFor<EntityPlayer> {
|
||||
|
||||
private final List<EntityPlayer> players =
|
||||
BaritoneAPI.getProvider().getPrimaryBaritone().getPlayerContext().world().playerEntities;
|
||||
public final EntityPlayer player;
|
||||
@ -38,13 +39,11 @@ public class PlayerByUsername implements IDatatypeFor<EntityPlayer> {
|
||||
|
||||
public PlayerByUsername(ArgConsumer consumer) {
|
||||
String username = consumer.getString();
|
||||
|
||||
player = players
|
||||
.stream()
|
||||
.filter(s -> s.getName().equalsIgnoreCase(username))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
if (isNull(player)) {
|
||||
throw new IllegalArgumentException("no player found by that username");
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ import java.util.stream.Stream;
|
||||
import static java.util.Objects.isNull;
|
||||
|
||||
public class RelativeBlockPos implements IDatatypePost<BetterBlockPos, BetterBlockPos> {
|
||||
|
||||
final RelativeCoordinate x;
|
||||
final RelativeCoordinate y;
|
||||
final RelativeCoordinate z;
|
||||
@ -57,13 +58,10 @@ public class RelativeBlockPos implements IDatatypePost<BetterBlockPos, BetterBlo
|
||||
if (isNull(consumer.peekDatatypeOrNull(RelativeCoordinate.class))) {
|
||||
break;
|
||||
}
|
||||
|
||||
consumer.get();
|
||||
}
|
||||
|
||||
return consumer.tabCompleteDatatype(RelativeCoordinate.class);
|
||||
}
|
||||
|
||||
return Stream.empty();
|
||||
}
|
||||
}
|
||||
|
@ -25,8 +25,8 @@ import java.util.regex.Pattern;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class RelativeCoordinate implements IDatatypePost<Double, Double> {
|
||||
public static Pattern PATTERN = Pattern.compile("^(~?)([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)|)$");
|
||||
|
||||
public static Pattern PATTERN = Pattern.compile("^(~?)([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)|)$");
|
||||
final boolean isRelative;
|
||||
final double offset;
|
||||
|
||||
@ -37,11 +37,9 @@ public class RelativeCoordinate implements IDatatypePost<Double, Double> {
|
||||
|
||||
public RelativeCoordinate(ArgConsumer consumer) {
|
||||
Matcher matcher = PATTERN.matcher(consumer.getString());
|
||||
|
||||
if (!matcher.matches()) {
|
||||
throw new IllegalArgumentException("pattern doesn't match");
|
||||
}
|
||||
|
||||
isRelative = !matcher.group(1).isEmpty();
|
||||
offset = matcher.group(2).isEmpty() ? 0 : Double.parseDouble(matcher.group(2));
|
||||
}
|
||||
@ -51,7 +49,6 @@ public class RelativeCoordinate implements IDatatypePost<Double, Double> {
|
||||
if (isRelative) {
|
||||
return origin + offset;
|
||||
}
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
@ -64,7 +61,6 @@ public class RelativeCoordinate implements IDatatypePost<Double, Double> {
|
||||
if (!consumer.has(2) && consumer.getString().matches("^(~|$)")) {
|
||||
return Stream.of("~");
|
||||
}
|
||||
|
||||
return Stream.empty();
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ import java.util.stream.Stream;
|
||||
import static baritone.api.utils.Helper.HELPER;
|
||||
|
||||
public class RelativeFile implements IDatatypePost<File, File> {
|
||||
|
||||
private final Path path;
|
||||
|
||||
public RelativeFile() {
|
||||
@ -75,7 +76,6 @@ public class RelativeFile implements IDatatypePost<File, File> {
|
||||
Path basePath = currentPath.isAbsolute() ? currentPath.getRoot() : base.toPath();
|
||||
boolean useParent = !currentPathStringThing.isEmpty() && !currentPathStringThing.endsWith(File.separator);
|
||||
File currentFile = currentPath.isAbsolute() ? currentPath.toFile() : new File(base, currentPathStringThing);
|
||||
|
||||
return Arrays.stream(Objects.requireNonNull(SHUT_THE_FUCK_UP_IOEXCEPTION_NOBODY_LIKES_YOU(
|
||||
useParent
|
||||
? currentFile.getParentFile()
|
||||
@ -94,11 +94,9 @@ public class RelativeFile implements IDatatypePost<File, File> {
|
||||
|
||||
public static File gameDir() {
|
||||
File gameDir = HELPER.mc.gameDir.getAbsoluteFile();
|
||||
|
||||
if (gameDir.getName().equals(".")) {
|
||||
return gameDir.getParentFile();
|
||||
}
|
||||
|
||||
return gameDir;
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ import java.util.stream.Stream;
|
||||
import static java.util.Objects.nonNull;
|
||||
|
||||
public class RelativeGoal implements IDatatypePost<Goal, BetterBlockPos> {
|
||||
|
||||
final RelativeCoordinate[] coords;
|
||||
|
||||
public RelativeGoal() {
|
||||
@ -39,13 +40,11 @@ public class RelativeGoal implements IDatatypePost<Goal, BetterBlockPos> {
|
||||
|
||||
public RelativeGoal(ArgConsumer consumer) {
|
||||
List<RelativeCoordinate> coordsList = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (nonNull(consumer.peekDatatypeOrNull(RelativeCoordinate.class))) {
|
||||
coordsList.add(consumer.getDatatype(RelativeCoordinate.class));
|
||||
}
|
||||
}
|
||||
|
||||
coords = coordsList.toArray(new RelativeCoordinate[0]);
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@ import baritone.api.utils.command.helpers.arguments.ArgConsumer;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class RelativeGoalBlock implements IDatatypePost<GoalBlock, BetterBlockPos> {
|
||||
|
||||
final RelativeCoordinate[] coords;
|
||||
|
||||
public RelativeGoalBlock() {
|
||||
@ -52,7 +53,6 @@ public class RelativeGoalBlock implements IDatatypePost<GoalBlock, BetterBlockPo
|
||||
if (consumer.hasAtMost(3)) {
|
||||
return consumer.tabCompleteDatatype(RelativeCoordinate.class);
|
||||
}
|
||||
|
||||
return Stream.empty();
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ import baritone.api.utils.command.helpers.arguments.ArgConsumer;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class RelativeGoalXZ implements IDatatypePost<GoalXZ, BetterBlockPos> {
|
||||
|
||||
final RelativeCoordinate[] coords;
|
||||
|
||||
public RelativeGoalXZ() {
|
||||
@ -50,7 +51,6 @@ public class RelativeGoalXZ implements IDatatypePost<GoalXZ, BetterBlockPos> {
|
||||
if (consumer.hasAtMost(2)) {
|
||||
return consumer.tabCompleteDatatype(RelativeCoordinate.class);
|
||||
}
|
||||
|
||||
return Stream.empty();
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ import baritone.api.utils.command.helpers.arguments.ArgConsumer;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class RelativeGoalYLevel implements IDatatypePost<GoalYLevel, BetterBlockPos> {
|
||||
|
||||
final RelativeCoordinate coord;
|
||||
|
||||
public RelativeGoalYLevel() {
|
||||
@ -44,7 +45,6 @@ public class RelativeGoalYLevel implements IDatatypePost<GoalYLevel, BetterBlock
|
||||
if (consumer.hasAtMost(1)) {
|
||||
return consumer.tabCompleteDatatype(RelativeCoordinate.class);
|
||||
}
|
||||
|
||||
return Stream.empty();
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import java.util.List;
|
||||
import static baritone.api.utils.Helper.HELPER;
|
||||
|
||||
public abstract class CommandErrorMessageException extends CommandException {
|
||||
|
||||
protected CommandErrorMessageException(String reason) {
|
||||
super(reason);
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import baritone.api.utils.command.argument.CommandArgument;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class CommandException extends RuntimeException {
|
||||
|
||||
protected CommandException(String reason) {
|
||||
super(reason);
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ package baritone.api.utils.command.exception;
|
||||
import baritone.api.utils.command.argument.CommandArgument;
|
||||
|
||||
public abstract class CommandInvalidArgumentException extends CommandErrorMessageException {
|
||||
|
||||
public final CommandArgument arg;
|
||||
|
||||
protected CommandInvalidArgumentException(CommandArgument arg, String reason) {
|
||||
@ -28,7 +29,6 @@ public abstract class CommandInvalidArgumentException extends CommandErrorMessag
|
||||
arg.index == -1 ? "<unknown>" : Integer.toString(arg.index + 1),
|
||||
reason
|
||||
));
|
||||
|
||||
this.arg = arg;
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
package baritone.api.utils.command.exception;
|
||||
|
||||
public class CommandInvalidStateException extends CommandErrorMessageException {
|
||||
|
||||
public CommandInvalidStateException(String reason) {
|
||||
super(reason);
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ package baritone.api.utils.command.exception;
|
||||
import baritone.api.utils.command.argument.CommandArgument;
|
||||
|
||||
public class CommandInvalidTypeException extends CommandInvalidArgumentException {
|
||||
|
||||
public CommandInvalidTypeException(CommandArgument arg, String expected) {
|
||||
super(arg, String.format("Expected %s", expected));
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
package baritone.api.utils.command.exception;
|
||||
|
||||
public class CommandNoParserForTypeException extends CommandErrorMessageException {
|
||||
|
||||
public final Class<?> klass;
|
||||
|
||||
public CommandNoParserForTypeException(Class<?> klass) {
|
||||
|
@ -18,6 +18,7 @@
|
||||
package baritone.api.utils.command.exception;
|
||||
|
||||
public class CommandNotEnoughArgumentsException extends CommandErrorMessageException {
|
||||
|
||||
public CommandNotEnoughArgumentsException(int minArgs) {
|
||||
super(String.format("Not enough arguments (expected at least %d)", minArgs));
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ import java.util.List;
|
||||
import static baritone.api.utils.Helper.HELPER;
|
||||
|
||||
public class CommandNotFoundException extends CommandException {
|
||||
|
||||
public final String command;
|
||||
|
||||
public CommandNotFoundException(String command) {
|
||||
|
@ -18,6 +18,7 @@
|
||||
package baritone.api.utils.command.exception;
|
||||
|
||||
public class CommandTooManyArgumentsException extends CommandErrorMessageException {
|
||||
|
||||
public CommandTooManyArgumentsException(int maxArgs) {
|
||||
super(String.format("Too many arguments (expected at most %d)", maxArgs));
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import java.util.stream.Collectors;
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
public class CommandUnhandledException extends CommandErrorMessageException {
|
||||
|
||||
public static String getStackTrace(Throwable throwable) {
|
||||
StringWriter sw = new StringWriter();
|
||||
throwable.printStackTrace(new PrintWriter(sw));
|
||||
@ -35,14 +36,12 @@ public class CommandUnhandledException extends CommandErrorMessageException {
|
||||
public static String getBaritoneStackTrace(String stackTrace) {
|
||||
List<String> lines = Arrays.stream(stackTrace.split("\n"))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
int lastBaritoneLine = 0;
|
||||
for (int i = 0; i < lines.size(); i++) {
|
||||
if (lines.get(i).startsWith("\tat baritone.") && lines.get(i).contains("BaritoneChatControl")) {
|
||||
lastBaritoneLine = i;
|
||||
}
|
||||
}
|
||||
|
||||
return String.join("\n", lines.subList(0, lastBaritoneLine + 1));
|
||||
}
|
||||
|
||||
@ -52,21 +51,18 @@ public class CommandUnhandledException extends CommandErrorMessageException {
|
||||
|
||||
public static String getFriendlierStackTrace(String stackTrace) {
|
||||
List<String> lines = asList(stackTrace.split("\n"));
|
||||
|
||||
for (int i = 0; i < lines.size(); i++) {
|
||||
String line = lines.get(i);
|
||||
if (line.startsWith("\tat ")) {
|
||||
if (line.startsWith("\tat baritone.")) {
|
||||
line = line.replaceFirst("^\tat [a-z.]+?([A-Z])", "\tat $1");
|
||||
}
|
||||
|
||||
// line = line.replaceFirst("\\(([^)]+)\\)$", "\n\t . $1");
|
||||
line = line.replaceFirst("\\([^:]+:(\\d+)\\)$", ":$1");
|
||||
line = line.replaceFirst("\\(Unknown Source\\)$", "");
|
||||
lines.set(i, line);
|
||||
}
|
||||
}
|
||||
|
||||
return String.join("\n", lines);
|
||||
}
|
||||
|
||||
|
@ -33,21 +33,19 @@ import java.util.stream.Stream;
|
||||
import static java.util.Objects.isNull;
|
||||
|
||||
public class CommandExecution {
|
||||
|
||||
/**
|
||||
* The command itself
|
||||
*/
|
||||
private final Command command;
|
||||
|
||||
/**
|
||||
* The name this command was called with
|
||||
*/
|
||||
public final String label;
|
||||
|
||||
/**
|
||||
* The arg consumer
|
||||
*/
|
||||
public final ArgConsumer args;
|
||||
|
||||
/**
|
||||
* The Baritone settings
|
||||
*/
|
||||
@ -80,7 +78,6 @@ public class CommandExecution {
|
||||
e.handle(command, args.args);
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
|
||||
new CommandUnhandledException(t).handle(command, args.args);
|
||||
}
|
||||
}
|
||||
@ -91,11 +88,9 @@ public class CommandExecution {
|
||||
|
||||
public static CommandExecution from(String label, ArgConsumer args) {
|
||||
Command command = CommandManager.getCommand(label);
|
||||
|
||||
if (isNull(command)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new CommandExecution(
|
||||
command,
|
||||
label,
|
||||
|
@ -55,11 +55,11 @@ import java.util.stream.Stream;
|
||||
* </ul>
|
||||
*/
|
||||
public class ArgConsumer implements Cloneable {
|
||||
|
||||
/**
|
||||
* The list of arguments in this ArgConsumer
|
||||
*/
|
||||
public final LinkedList<CommandArgument> args;
|
||||
|
||||
/**
|
||||
* The list of consumed arguments for this ArgConsumer. The most recently consumed argument is the last one
|
||||
*/
|
||||
@ -362,7 +362,6 @@ public class ArgConsumer implements Cloneable {
|
||||
return peekAsOrDefault(type, def, 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tries to use a <b>stateless</b> {@link ArgParser} to parse the argument at the specified index into the specified
|
||||
* class
|
||||
@ -743,7 +742,6 @@ public class ArgConsumer implements Cloneable {
|
||||
public <T extends IDatatype> T getDatatypeOrNull(Class<T> datatype) {
|
||||
List<CommandArgument> argsSnapshot = new ArrayList<>(args);
|
||||
List<CommandArgument> consumedSnapshot = new ArrayList<>(consumed);
|
||||
|
||||
try {
|
||||
return getDatatype(datatype);
|
||||
} catch (CommandInvalidTypeException e) {
|
||||
@ -751,7 +749,6 @@ public class ArgConsumer implements Cloneable {
|
||||
args.addAll(argsSnapshot);
|
||||
consumed.clear();
|
||||
consumed.addAll(consumedSnapshot);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -790,7 +787,6 @@ public class ArgConsumer implements Cloneable {
|
||||
public <T, O, D extends IDatatypePost<T, O>> T getDatatypePostOrDefault(Class<D> datatype, O original, T def) {
|
||||
List<CommandArgument> argsSnapshot = new ArrayList<>(args);
|
||||
List<CommandArgument> consumedSnapshot = new ArrayList<>(consumed);
|
||||
|
||||
try {
|
||||
return getDatatypePost(datatype, original);
|
||||
} catch (CommandException e) {
|
||||
@ -798,7 +794,6 @@ public class ArgConsumer implements Cloneable {
|
||||
args.addAll(argsSnapshot);
|
||||
consumed.clear();
|
||||
consumed.addAll(consumedSnapshot);
|
||||
|
||||
return def;
|
||||
}
|
||||
}
|
||||
@ -855,7 +850,6 @@ public class ArgConsumer implements Cloneable {
|
||||
public <T, D extends IDatatypeFor<T>> T getDatatypeForOrDefault(Class<D> datatype, T def) {
|
||||
List<CommandArgument> argsSnapshot = new ArrayList<>(args);
|
||||
List<CommandArgument> consumedSnapshot = new ArrayList<>(consumed);
|
||||
|
||||
try {
|
||||
return getDatatypeFor(datatype);
|
||||
} catch (CommandInvalidTypeException e) {
|
||||
@ -863,7 +857,6 @@ public class ArgConsumer implements Cloneable {
|
||||
args.addAll(argsSnapshot);
|
||||
consumed.clear();
|
||||
consumed.addAll(consumedSnapshot);
|
||||
|
||||
return def;
|
||||
}
|
||||
}
|
||||
@ -904,7 +897,6 @@ public class ArgConsumer implements Cloneable {
|
||||
} catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
} catch (CommandException ignored) {}
|
||||
|
||||
return Stream.empty();
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,7 @@ import static java.util.Arrays.asList;
|
||||
import static java.util.Objects.nonNull;
|
||||
|
||||
public class Paginator<E> implements Helper {
|
||||
|
||||
public final List<E> entries;
|
||||
public int pageSize = 8;
|
||||
public int page = 1;
|
||||
@ -47,7 +48,6 @@ public class Paginator<E> implements Helper {
|
||||
|
||||
public Paginator<E> setPageSize(int pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -61,13 +61,11 @@ public class Paginator<E> implements Helper {
|
||||
|
||||
public Paginator<E> skipPages(int pages) {
|
||||
page += pages;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public void display(Function<E, ITextComponent> transform, String commandPrefix) {
|
||||
int offset = (page - 1) * pageSize;
|
||||
|
||||
for (int i = offset; i < offset + pageSize; i++) {
|
||||
if (i < entries.size()) {
|
||||
logDirect(transform.apply(entries.get(i)));
|
||||
@ -75,12 +73,9 @@ public class Paginator<E> implements Helper {
|
||||
logDirect("--", TextFormatting.DARK_GRAY);
|
||||
}
|
||||
}
|
||||
|
||||
boolean hasPrevPage = nonNull(commandPrefix) && validPage(page - 1);
|
||||
boolean hasNextPage = nonNull(commandPrefix) && validPage(page + 1);
|
||||
|
||||
ITextComponent prevPageComponent = new TextComponentString("<<");
|
||||
|
||||
if (hasPrevPage) {
|
||||
prevPageComponent.getStyle()
|
||||
.setClickEvent(new ClickEvent(
|
||||
@ -94,9 +89,7 @@ public class Paginator<E> implements Helper {
|
||||
} else {
|
||||
prevPageComponent.getStyle().setColor(TextFormatting.DARK_GRAY);
|
||||
}
|
||||
|
||||
ITextComponent nextPageComponent = new TextComponentString(">>");
|
||||
|
||||
if (hasNextPage) {
|
||||
nextPageComponent.getStyle()
|
||||
.setClickEvent(new ClickEvent(
|
||||
@ -110,7 +103,6 @@ public class Paginator<E> implements Helper {
|
||||
} else {
|
||||
nextPageComponent.getStyle().setColor(TextFormatting.DARK_GRAY);
|
||||
}
|
||||
|
||||
ITextComponent pagerComponent = new TextComponentString("");
|
||||
pagerComponent.getStyle().setColor(TextFormatting.GRAY);
|
||||
pagerComponent.appendSibling(prevPageComponent);
|
||||
@ -126,12 +118,9 @@ public class Paginator<E> implements Helper {
|
||||
|
||||
public static <T> void paginate(ArgConsumer consumer, Paginator<T> pagi, Runnable pre, Function<T, ITextComponent> transform, String commandPrefix) {
|
||||
int page = 1;
|
||||
|
||||
consumer.requireMax(1);
|
||||
|
||||
if (consumer.has()) {
|
||||
page = consumer.getAs(Integer.class);
|
||||
|
||||
if (!pagi.validPage(page)) {
|
||||
throw new CommandInvalidTypeException(
|
||||
consumer.consumed(),
|
||||
@ -143,13 +132,10 @@ public class Paginator<E> implements Helper {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
pagi.skipPages(page - pagi.page);
|
||||
|
||||
if (nonNull(pre)) {
|
||||
pre.run();
|
||||
}
|
||||
|
||||
pagi.display(transform, commandPrefix);
|
||||
}
|
||||
|
||||
|
@ -53,6 +53,7 @@ import java.util.stream.Stream;
|
||||
* array.
|
||||
*/
|
||||
public class TabCompleteHelper {
|
||||
|
||||
private Stream<String> stream;
|
||||
|
||||
public TabCompleteHelper(String[] base) {
|
||||
@ -80,7 +81,6 @@ public class TabCompleteHelper {
|
||||
*/
|
||||
public TabCompleteHelper append(Stream<String> source) {
|
||||
stream = Stream.concat(stream, source);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -131,7 +131,6 @@ public class TabCompleteHelper {
|
||||
*/
|
||||
public TabCompleteHelper prepend(Stream<String> source) {
|
||||
stream = Stream.concat(source, stream);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -178,7 +177,6 @@ public class TabCompleteHelper {
|
||||
*/
|
||||
public TabCompleteHelper map(Function<String, String> transform) {
|
||||
stream = stream.map(transform);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -191,7 +189,6 @@ public class TabCompleteHelper {
|
||||
*/
|
||||
public TabCompleteHelper filter(Predicate<String> filter) {
|
||||
stream = stream.filter(filter);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -204,7 +201,6 @@ public class TabCompleteHelper {
|
||||
*/
|
||||
public TabCompleteHelper sort(Comparator<String> comparator) {
|
||||
stream = stream.sorted(comparator);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,7 @@ import static java.util.Objects.isNull;
|
||||
import static java.util.Objects.nonNull;
|
||||
|
||||
public class CommandManager {
|
||||
|
||||
public static final Registry<Command> REGISTRY = new Registry<>();
|
||||
|
||||
/**
|
||||
@ -44,7 +45,6 @@ public class CommandManager {
|
||||
return command;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -54,11 +54,9 @@ public class CommandManager {
|
||||
|
||||
public static boolean execute(String string) {
|
||||
CommandExecution execution = CommandExecution.from(string);
|
||||
|
||||
if (nonNull(execution)) {
|
||||
execution.execute();
|
||||
}
|
||||
|
||||
return nonNull(execution);
|
||||
}
|
||||
|
||||
@ -75,7 +73,6 @@ public class CommandManager {
|
||||
Pair<String, List<CommandArgument>> pair = CommandExecution.expand(prefix, true);
|
||||
String label = pair.first();
|
||||
List<CommandArgument> args = pair.second();
|
||||
|
||||
if (args.isEmpty()) {
|
||||
return new TabCompleteHelper()
|
||||
.addCommands()
|
||||
|
@ -33,6 +33,7 @@ import java.util.stream.StreamSupport;
|
||||
*/
|
||||
@SuppressWarnings({"unused", "UnusedReturnValue"})
|
||||
public class Registry<V> {
|
||||
|
||||
/**
|
||||
* An internal linked list of all the entries that are currently registered. This is a linked list so that entries
|
||||
* can be inserted at the beginning, which means that newer entries are encountered first during iteration. This is
|
||||
@ -40,14 +41,12 @@ public class Registry<V> {
|
||||
* not just use a map.
|
||||
*/
|
||||
private final Deque<V> _entries = new LinkedList<>();
|
||||
|
||||
/**
|
||||
* A HashSet containing every entry currently registered. Entries are added to this set when something is registered
|
||||
* and removed from the set when they are unregistered. An entry being present in this set indicates that it is
|
||||
* currently registered, can be removed, and should not be reregistered until it is removed.
|
||||
*/
|
||||
private final Set<V> registered = new HashSet<>();
|
||||
|
||||
/**
|
||||
* The collection of entries that are currently in this registry. This is a collection (and not a list) because,
|
||||
* internally, entries are stored in a linked list, which is not the same as a normal list.
|
||||
@ -74,10 +73,8 @@ public class Registry<V> {
|
||||
if (!registered(entry)) {
|
||||
_entries.addFirst(entry);
|
||||
registered.add(entry);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -91,7 +88,6 @@ public class Registry<V> {
|
||||
if (registered(entry)) {
|
||||
return;
|
||||
}
|
||||
|
||||
_entries.remove(entry);
|
||||
registered.remove(entry);
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ import baritone.pathing.calc.PathNode;
|
||||
* @author leijurv
|
||||
*/
|
||||
class LinkedListOpenSet implements IOpenSet {
|
||||
|
||||
private Node first = null;
|
||||
|
||||
@Override
|
||||
@ -83,6 +84,7 @@ class LinkedListOpenSet implements IOpenSet {
|
||||
}
|
||||
|
||||
public static class Node { //wrapper with next
|
||||
|
||||
private Node nextOpen;
|
||||
private PathNode val;
|
||||
}
|
||||
|
@ -39,11 +39,9 @@ public class BlacklistCommand extends Command {
|
||||
protected void executed(String label, ArgConsumer args, Settings settings) {
|
||||
args.requireMax(0);
|
||||
IGetToBlockProcess proc = baritone.getGetToBlockProcess();
|
||||
|
||||
if (!proc.isActive()) {
|
||||
throw new CommandInvalidStateException("GetToBlockProcess is not currently active");
|
||||
}
|
||||
|
||||
if (proc.blacklistClosest()) {
|
||||
logDirect("Blacklisted closest instances");
|
||||
} else {
|
||||
|
@ -45,14 +45,11 @@ public class BuildCommand extends Command {
|
||||
@Override
|
||||
protected void executed(String label, ArgConsumer args, Settings settings) {
|
||||
File file = args.getDatatypePost(RelativeFile.class, schematicsDir).getAbsoluteFile();
|
||||
|
||||
if (!file.getName().toLowerCase(Locale.US).endsWith(".schematic")) {
|
||||
file = new File(file.getAbsolutePath() + ".schematic");
|
||||
}
|
||||
|
||||
BetterBlockPos origin = ctx.playerFeet();
|
||||
BetterBlockPos buildOrigin;
|
||||
|
||||
if (args.has()) {
|
||||
args.requireMax(3);
|
||||
buildOrigin = args.getDatatype(RelativeBlockPos.class).apply(origin);
|
||||
@ -60,13 +57,10 @@ public class BuildCommand extends Command {
|
||||
args.requireMax(0);
|
||||
buildOrigin = origin;
|
||||
}
|
||||
|
||||
boolean success = baritone.getBuilderProcess().build(file.getName(), file, buildOrigin);
|
||||
|
||||
if (!success) {
|
||||
throw new CommandInvalidStateException("Couldn't load the schematic");
|
||||
}
|
||||
|
||||
logDirect(String.format("Successfully loaded schematic for building\nOrigin: %s", buildOrigin));
|
||||
}
|
||||
|
||||
@ -76,10 +70,8 @@ public class BuildCommand extends Command {
|
||||
return RelativeFile.tabComplete(args, schematicsDir);
|
||||
} else if (args.has(2)) {
|
||||
args.get();
|
||||
|
||||
return args.tabCompleteDatatype(RelativeBlockPos.class);
|
||||
}
|
||||
|
||||
return Stream.empty();
|
||||
}
|
||||
|
||||
|
@ -46,18 +46,14 @@ public class ChestsCommand extends Command {
|
||||
args.requireMax(0);
|
||||
Set<Map.Entry<BlockPos, IRememberedInventory>> entries =
|
||||
ctx.worldData().getContainerMemory().getRememberedInventories().entrySet();
|
||||
|
||||
if (entries.isEmpty()) {
|
||||
throw new CommandInvalidStateException("No remembered inventories");
|
||||
}
|
||||
|
||||
for (Map.Entry<BlockPos, IRememberedInventory> entry : entries) {
|
||||
// betterblockpos has censoring
|
||||
BetterBlockPos pos = new BetterBlockPos(entry.getKey());
|
||||
IRememberedInventory inv = entry.getValue();
|
||||
|
||||
logDirect(pos.toString());
|
||||
|
||||
for (ItemStack item : inv.getContents()) {
|
||||
ITextComponent component = item.getTextComponent();
|
||||
component.appendText(String.format(" x %d", item.getCount()));
|
||||
|
@ -42,22 +42,18 @@ public class ClearareaCommand extends Command {
|
||||
protected void executed(String label, ArgConsumer args, Settings settings) {
|
||||
BetterBlockPos pos1 = ctx.playerFeet();
|
||||
BetterBlockPos pos2;
|
||||
|
||||
if (args.has()) {
|
||||
args.requireMax(3);
|
||||
pos2 = args.getDatatype(RelativeBlockPos.class).apply(pos1);
|
||||
} else {
|
||||
args.requireMax(0);
|
||||
|
||||
Goal goal = baritone.getCustomGoalProcess().getGoal();
|
||||
|
||||
if (!(goal instanceof GoalBlock)) {
|
||||
throw new CommandInvalidStateException("Goal is not a GoalBlock");
|
||||
} else {
|
||||
pos2 = new BetterBlockPos(((GoalBlock) goal).getGoalPos());
|
||||
}
|
||||
}
|
||||
|
||||
baritone.getBuilderProcess().clearArea(pos1, pos2);
|
||||
logDirect("Success");
|
||||
}
|
||||
|
@ -42,11 +42,9 @@ public class ComeCommand extends Command {
|
||||
protected void executed(String label, ArgConsumer args, Settings settings) {
|
||||
args.requireMax(0);
|
||||
Entity entity = MC.getRenderViewEntity();
|
||||
|
||||
if (isNull(entity)) {
|
||||
throw new CommandInvalidStateException("render view entity is null");
|
||||
}
|
||||
|
||||
baritone.getCustomGoalProcess().setGoalAndPath(new GoalBlock(new BlockPos(entity)));
|
||||
logDirect("Coming");
|
||||
}
|
||||
|
@ -48,7 +48,6 @@ public class DefaultCommands {
|
||||
new GcCommand(baritone),
|
||||
new InvertCommand(baritone),
|
||||
new ClearareaCommand(baritone),
|
||||
|
||||
new TunnelCommand(baritone),
|
||||
new RenderCommand(baritone),
|
||||
new FarmCommand(baritone),
|
||||
|
@ -42,11 +42,9 @@ public class ExploreCommand extends Command {
|
||||
} else {
|
||||
args.requireMax(0);
|
||||
}
|
||||
|
||||
GoalXZ goal = args.has()
|
||||
? 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()));
|
||||
}
|
||||
@ -56,7 +54,6 @@ public class ExploreCommand extends Command {
|
||||
if (args.hasAtMost(2)) {
|
||||
return args.tabCompleteDatatype(RelativeGoalXZ.class);
|
||||
}
|
||||
|
||||
return Stream.empty();
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,7 @@ import java.util.stream.Stream;
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
public class ExploreFilterCommand extends Command {
|
||||
|
||||
public ExploreFilterCommand(IBaritone baritone) {
|
||||
super(baritone, "explorefilter");
|
||||
}
|
||||
@ -43,7 +44,6 @@ public class ExploreFilterCommand extends Command {
|
||||
args.requireMax(2);
|
||||
File file = args.getDatatypePost(RelativeFile.class, MC.gameDir.getAbsoluteFile().getParentFile());
|
||||
boolean invert = false;
|
||||
|
||||
if (args.has()) {
|
||||
if (args.getString().equalsIgnoreCase("invert")) {
|
||||
invert = true;
|
||||
@ -51,7 +51,6 @@ public class ExploreFilterCommand extends Command {
|
||||
throw new CommandInvalidTypeException(args.consumed(), "either \"invert\" or nothing");
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
baritone.getExploreProcess().applyJsonFilter(file.toPath().toAbsolutePath(), invert);
|
||||
} catch (NoSuchFileException e) {
|
||||
@ -61,7 +60,6 @@ public class ExploreFilterCommand extends Command {
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
logDirect(String.format("Explore filter applied. Inverted: %s", Boolean.toString(invert)));
|
||||
}
|
||||
|
||||
@ -70,7 +68,6 @@ public class ExploreFilterCommand extends Command {
|
||||
if (args.hasExactlyOne()) {
|
||||
return RelativeFile.tabComplete(args, RelativeFile.gameDir());
|
||||
}
|
||||
|
||||
return Stream.empty();
|
||||
}
|
||||
|
||||
|
@ -40,13 +40,10 @@ public class FindCommand extends Command {
|
||||
@Override
|
||||
protected void executed(String label, ArgConsumer args, Settings settings) {
|
||||
List<Block> toFind = new ArrayList<>();
|
||||
|
||||
while (args.has()) {
|
||||
toFind.add(args.getDatatypeFor(BlockById.class));
|
||||
}
|
||||
|
||||
BetterBlockPos origin = ctx.playerFeet();
|
||||
|
||||
toFind.stream()
|
||||
.flatMap(block ->
|
||||
ctx.worldData().getCachedWorld().getLocationsOf(
|
||||
|
@ -52,24 +52,19 @@ public class FollowCommand extends Command {
|
||||
@Override
|
||||
protected void executed(String label, ArgConsumer args, Settings settings) {
|
||||
args.requireMin(1);
|
||||
|
||||
FollowGroup group;
|
||||
FollowList list;
|
||||
List<Entity> entities = new ArrayList<>();
|
||||
List<Class<? extends Entity>> classes = new ArrayList<>();
|
||||
|
||||
if (args.hasExactlyOne()) {
|
||||
baritone.getFollowProcess().follow((group = args.getEnum(FollowGroup.class)).filter);
|
||||
} else {
|
||||
args.requireMin(2);
|
||||
|
||||
group = null;
|
||||
list = args.getEnum(FollowList.class);
|
||||
|
||||
while (args.has()) {
|
||||
//noinspection unchecked
|
||||
Object gotten = args.getDatatypeFor(list.datatype);
|
||||
|
||||
if (gotten instanceof Class) {
|
||||
//noinspection unchecked
|
||||
classes.add((Class<? extends Entity>) gotten);
|
||||
@ -77,19 +72,16 @@ public class FollowCommand extends Command {
|
||||
entities.add((Entity) gotten);
|
||||
}
|
||||
}
|
||||
|
||||
baritone.getFollowProcess().follow(
|
||||
classes.isEmpty()
|
||||
? entities::contains
|
||||
: e -> classes.stream().anyMatch(c -> c.isInstance(e))
|
||||
);
|
||||
}
|
||||
|
||||
if (nonNull(group)) {
|
||||
logDirect(String.format("Following all %s", group.name().toLowerCase(Locale.US)));
|
||||
} else {
|
||||
logDirect("Following these types of entities:");
|
||||
|
||||
if (classes.isEmpty()) {
|
||||
entities.stream()
|
||||
.map(Entity::toString)
|
||||
@ -114,21 +106,17 @@ public class FollowCommand extends Command {
|
||||
.stream();
|
||||
} else {
|
||||
Class<? extends IDatatype> followType;
|
||||
|
||||
try {
|
||||
followType = args.getEnum(FollowList.class).datatype;
|
||||
} catch (NullPointerException e) {
|
||||
return Stream.empty();
|
||||
}
|
||||
|
||||
while (args.has(2)) {
|
||||
if (isNull(args.peekDatatypeOrNull(followType))) {
|
||||
return Stream.empty();
|
||||
}
|
||||
|
||||
args.get();
|
||||
}
|
||||
|
||||
return args.tabCompleteDatatype(followType);
|
||||
}
|
||||
}
|
||||
@ -156,7 +144,6 @@ public class FollowCommand extends Command {
|
||||
PLAYERS(EntityPlayer.class::isInstance); /* ,
|
||||
FRIENDLY(entity -> entity.getAttackTarget() != HELPER.mc.player),
|
||||
HOSTILE(FRIENDLY.filter.negate()); */
|
||||
|
||||
final Predicate<Entity> filter;
|
||||
|
||||
FollowGroup(Predicate<Entity> filter) {
|
||||
@ -167,7 +154,6 @@ public class FollowCommand extends Command {
|
||||
private enum FollowList {
|
||||
ENTITY(EntityClassById.class),
|
||||
PLAYER(PlayerByUsername.class);
|
||||
|
||||
final Class<? extends IDatatypeFor> datatype;
|
||||
|
||||
FollowList(Class<? extends IDatatypeFor> datatype) {
|
||||
|
@ -36,9 +36,7 @@ public class GcCommand extends Command {
|
||||
@Override
|
||||
protected void executed(String label, ArgConsumer args, Settings settings) {
|
||||
args.requireMax(0);
|
||||
|
||||
System.gc();
|
||||
|
||||
logDirect("ok called System.gc()");
|
||||
}
|
||||
|
||||
|
@ -44,10 +44,8 @@ public class GoalCommand extends Command {
|
||||
@Override
|
||||
protected void executed(String label, ArgConsumer args, Settings settings) {
|
||||
ICustomGoalProcess goalProcess = baritone.getCustomGoalProcess();
|
||||
|
||||
if (args.has() && asList("reset", "clear", "none").contains(args.peekString())) {
|
||||
args.requireMax(1);
|
||||
|
||||
if (nonNull(goalProcess.getGoal())) {
|
||||
goalProcess.setGoal(null);
|
||||
logDirect("Cleared goal");
|
||||
@ -66,7 +64,6 @@ public class GoalCommand extends Command {
|
||||
@Override
|
||||
protected Stream<String> tabCompleted(String label, ArgConsumer args, Settings settings) {
|
||||
TabCompleteHelper helper = new TabCompleteHelper();
|
||||
|
||||
if (args.hasExactlyOne()) {
|
||||
helper.append(Stream.of("reset", "clear", "none", "~"));
|
||||
} else {
|
||||
@ -75,16 +72,13 @@ public class GoalCommand extends Command {
|
||||
if (isNull(args.peekDatatypeOrNull(RelativeCoordinate.class))) {
|
||||
break;
|
||||
}
|
||||
|
||||
args.get();
|
||||
|
||||
if (!args.has(2)) {
|
||||
helper.append("~");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return helper.filterPrefix(args.getString()).stream();
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,6 @@ public class HelpCommand extends Command {
|
||||
@Override
|
||||
protected void executed(String label, ArgConsumer args, Settings settings) {
|
||||
args.requireMax(1);
|
||||
|
||||
if (!args.has() || args.is(Integer.class)) {
|
||||
Paginator.paginate(
|
||||
args, new Paginator<>(
|
||||
@ -61,20 +60,16 @@ public class HelpCommand extends Command {
|
||||
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 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 component = new TextComponentString(name);
|
||||
component.getStyle().setColor(TextFormatting.GRAY);
|
||||
component.appendSibling(shortDescComponent);
|
||||
@ -88,22 +83,18 @@ public class HelpCommand extends Command {
|
||||
} else {
|
||||
String commandName = args.getString().toLowerCase();
|
||||
Command command = getCommand(commandName);
|
||||
|
||||
if (isNull(command)) {
|
||||
throw new CommandNotFoundException(commandName);
|
||||
}
|
||||
|
||||
logDirect(String.format("%s - %s", String.join(" / ", command.names), command.getShortDesc()));
|
||||
logDirect("");
|
||||
command.getLongDesc().forEach(this::logDirect);
|
||||
logDirect("");
|
||||
|
||||
ITextComponent returnComponent = new TextComponentString("Click to return to the help menu");
|
||||
returnComponent.getStyle().setClickEvent(new ClickEvent(
|
||||
ClickEvent.Action.RUN_COMMAND,
|
||||
FORCE_COMMAND_PREFIX + label
|
||||
));
|
||||
|
||||
logDirect(returnComponent);
|
||||
}
|
||||
}
|
||||
@ -113,7 +104,6 @@ public class HelpCommand extends Command {
|
||||
if (args.hasExactlyOne()) {
|
||||
return new TabCompleteHelper().addCommands().filterPrefix(args.getString()).stream();
|
||||
}
|
||||
|
||||
return Stream.empty();
|
||||
}
|
||||
|
||||
|
@ -41,20 +41,16 @@ public class InvertCommand extends Command {
|
||||
@Override
|
||||
protected void executed(String label, ArgConsumer args, Settings settings) {
|
||||
args.requireMax(0);
|
||||
|
||||
ICustomGoalProcess customGoalProcess = baritone.getCustomGoalProcess();
|
||||
Goal goal;
|
||||
|
||||
if (isNull(goal = customGoalProcess.getGoal())) {
|
||||
throw new CommandInvalidStateException("No goal");
|
||||
}
|
||||
|
||||
if (goal instanceof GoalInverted) {
|
||||
goal = ((GoalInverted) goal).origin;
|
||||
} else {
|
||||
goal = new GoalInverted(goal);
|
||||
}
|
||||
|
||||
customGoalProcess.setGoal(goal);
|
||||
logDirect(String.format("Goal: %s", goal.toString()));
|
||||
}
|
||||
|
@ -43,11 +43,9 @@ public class MineCommand extends Command {
|
||||
int quantity = args.getAsOrDefault(Integer.class, 0);
|
||||
args.requireMin(1);
|
||||
List<BlockOptionalMeta> boms = new ArrayList<>();
|
||||
|
||||
while (args.has()) {
|
||||
boms.add(args.getDatatypeFor(ForBlockOptionalMeta.class));
|
||||
}
|
||||
|
||||
WorldScanner.INSTANCE.repack(ctx);
|
||||
baritone.getMineProcess().mine(quantity, boms.toArray(new BlockOptionalMeta[0]));
|
||||
logDirect(String.format("Mining %s", boms.toString()));
|
||||
|
@ -45,14 +45,12 @@ public class PathCommand extends Command {
|
||||
protected void executed(String label, ArgConsumer args, Settings settings) {
|
||||
ICustomGoalProcess customGoalProcess = baritone.getCustomGoalProcess();
|
||||
Goal goal;
|
||||
|
||||
if (args.has()) {
|
||||
args.requireMax(3);
|
||||
goal = args.getDatatype(RelativeGoal.class).apply(ctx.playerFeet());
|
||||
} else if (isNull(goal = customGoalProcess.getGoal())) {
|
||||
throw new CommandInvalidStateException("No goal");
|
||||
}
|
||||
|
||||
args.requireMax(0);
|
||||
WorldScanner.INSTANCE.repack(ctx);
|
||||
customGoalProcess.setGoalAndPath(goal);
|
||||
@ -66,9 +64,7 @@ public class PathCommand extends Command {
|
||||
if (isNull(args.peekDatatypeOrNull(RelativeCoordinate.class))) {
|
||||
break;
|
||||
}
|
||||
|
||||
args.get();
|
||||
|
||||
if (!args.has(2)) {
|
||||
return new TabCompleteHelper()
|
||||
.append("~")
|
||||
@ -77,7 +73,6 @@ public class PathCommand extends Command {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Stream.empty();
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,6 @@ public class PauseResumeCommands {
|
||||
this.baritone = baritone;
|
||||
// array for mutability, non-field so reflection can't touch it
|
||||
final boolean[] paused = {false};
|
||||
|
||||
baritone.getPathingControlManager().registerProcess(
|
||||
new IBaritoneProcess() {
|
||||
@Override
|
||||
@ -81,16 +80,13 @@ public class PauseResumeCommands {
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
pauseCommand = new Command(baritone, "pause") {
|
||||
@Override
|
||||
protected void executed(String label, ArgConsumer args, Settings settings) {
|
||||
args.requireMax(0);
|
||||
|
||||
if (paused[0]) {
|
||||
throw new CommandInvalidStateException("Already paused");
|
||||
}
|
||||
|
||||
paused[0] = true;
|
||||
logDirect("Paused");
|
||||
}
|
||||
@ -117,16 +113,13 @@ public class PauseResumeCommands {
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
resumeCommand = new Command(baritone, "resume") {
|
||||
@Override
|
||||
protected void executed(String label, ArgConsumer args, Settings settings) {
|
||||
args.requireMax(0);
|
||||
|
||||
if (!paused[0]) {
|
||||
throw new CommandInvalidStateException("Not paused");
|
||||
}
|
||||
|
||||
paused[0] = false;
|
||||
logDirect("Resumed");
|
||||
}
|
||||
@ -151,12 +144,10 @@ public class PauseResumeCommands {
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
pausedCommand = new Command(baritone, "paused") {
|
||||
@Override
|
||||
protected void executed(String label, ArgConsumer args, Settings settings) {
|
||||
args.requireMax(0);
|
||||
|
||||
logDirect(String.format("Baritone is %spaused", paused[0] ? "" : "not "));
|
||||
}
|
||||
|
||||
|
@ -41,14 +41,11 @@ public class ProcCommand extends Command {
|
||||
@Override
|
||||
protected void executed(String label, ArgConsumer args, Settings settings) {
|
||||
args.requireMax(0);
|
||||
|
||||
IPathingControlManager pathingControlManager = baritone.getPathingControlManager();
|
||||
IBaritoneProcess process = pathingControlManager.mostRecentInControl().orElse(null);
|
||||
|
||||
if (isNull(process)) {
|
||||
throw new CommandInvalidStateException("No process in control");
|
||||
}
|
||||
|
||||
logDirect(String.format(
|
||||
"Class: %s\n" +
|
||||
"Priority: %f\n" +
|
||||
|
@ -37,7 +37,6 @@ public class RenderCommand extends Command {
|
||||
@Override
|
||||
protected void executed(String label, ArgConsumer args, Settings settings) {
|
||||
args.requireMax(0);
|
||||
|
||||
BetterBlockPos origin = ctx.playerFeet();
|
||||
int renderDistance = (MC.gameSettings.renderDistanceChunks + 1) * 16;
|
||||
MC.renderGlobal.markBlockRangeForRenderUpdate(
|
||||
@ -48,7 +47,6 @@ public class RenderCommand extends Command {
|
||||
255,
|
||||
origin.z + renderDistance
|
||||
);
|
||||
|
||||
logDirect("Done");
|
||||
}
|
||||
|
||||
|
@ -66,12 +66,10 @@ public class SelCommand extends Command {
|
||||
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);
|
||||
@ -82,20 +80,16 @@ public class SelCommand extends Command {
|
||||
@Override
|
||||
protected void executed(String label, ArgConsumer args, Settings settings) {
|
||||
Action action = Action.getByName(args.getString());
|
||||
|
||||
if (action == null) {
|
||||
throw new CommandInvalidTypeException(args.consumed(), "an action");
|
||||
}
|
||||
|
||||
if (action == Action.POS1 || action == Action.POS2) {
|
||||
if (action == Action.POS2 && pos1 == null) {
|
||||
throw new CommandInvalidStateException("Set pos1 first before using pos2");
|
||||
}
|
||||
|
||||
BetterBlockPos playerPos = ctx.playerFeet();
|
||||
BetterBlockPos pos = args.has() ? args.getDatatypePost(RelativeBlockPos.class, playerPos) : playerPos;
|
||||
args.requireMax(0);
|
||||
|
||||
if (action == Action.POS1) {
|
||||
pos1 = pos;
|
||||
logDirect("Position 1 has been set");
|
||||
@ -110,13 +104,11 @@ public class SelCommand extends Command {
|
||||
logDirect(String.format("Removed %d selections", manager.removeAllSelections().length));
|
||||
} else if (action == Action.UNDO) {
|
||||
args.requireMax(0);
|
||||
|
||||
if (pos1 != null) {
|
||||
pos1 = null;
|
||||
logDirect("Undid pos1");
|
||||
} else {
|
||||
ISelection[] selections = manager.getSelections();
|
||||
|
||||
if (selections.length < 1) {
|
||||
throw new CommandInvalidStateException("Nothing to undo!");
|
||||
} else {
|
||||
@ -129,33 +121,24 @@ public class SelCommand extends Command {
|
||||
? new BlockOptionalMeta(Blocks.AIR)
|
||||
: args.getDatatypeFor(ForBlockOptionalMeta.class);
|
||||
BlockOptionalMetaLookup replaces = null;
|
||||
|
||||
if (action == Action.REPLACE) {
|
||||
args.requireMin(1);
|
||||
|
||||
List<BlockOptionalMeta> replacesList = new ArrayList<>();
|
||||
|
||||
replacesList.add(type);
|
||||
|
||||
while (args.has(2)) {
|
||||
replacesList.add(args.getDatatypeFor(ForBlockOptionalMeta.class));
|
||||
}
|
||||
|
||||
type = args.getDatatypeFor(ForBlockOptionalMeta.class);
|
||||
replaces = new BlockOptionalMetaLookup(replacesList.toArray(new BlockOptionalMeta[0]));
|
||||
} else {
|
||||
args.requireMax(0);
|
||||
}
|
||||
|
||||
ISelection[] selections = manager.getSelections();
|
||||
|
||||
if (selections.length == 0) {
|
||||
throw new CommandInvalidStateException("No selections");
|
||||
}
|
||||
|
||||
BetterBlockPos origin = selections[0].min();
|
||||
CompositeSchematic composite = new CompositeSchematic(0, 0, 0);
|
||||
|
||||
for (ISelection selection : selections) {
|
||||
BetterBlockPos min = selection.min();
|
||||
origin = new BetterBlockPos(
|
||||
@ -164,13 +147,10 @@ public class SelCommand extends Command {
|
||||
Math.min(origin.z, min.z)
|
||||
);
|
||||
}
|
||||
|
||||
for (ISelection selection : selections) {
|
||||
Vec3i size = selection.size();
|
||||
BetterBlockPos min = selection.min();
|
||||
|
||||
ISchematic schematic = new FillSchematic(size.getX(), size.getY(), size.getZ(), type);
|
||||
|
||||
if (action == Action.WALLS) {
|
||||
schematic = new WallsSchematic(schematic);
|
||||
} else if (action == Action.SHELL) {
|
||||
@ -178,31 +158,23 @@ public class SelCommand extends Command {
|
||||
} else if (action == Action.REPLACE) {
|
||||
schematic = new ReplaceSchematic(schematic, replaces);
|
||||
}
|
||||
|
||||
composite.put(schematic, min.x - origin.x, min.y - origin.y, min.z - origin.z);
|
||||
}
|
||||
|
||||
baritone.getBuilderProcess().build("Fill", composite, origin);
|
||||
logDirect("Filling now");
|
||||
} else if (action == Action.EXPAND || action == Action.CONTRACT || action == Action.SHIFT) {
|
||||
args.requireExactly(3);
|
||||
TransformTarget transformTarget = TransformTarget.getByName(args.getString());
|
||||
|
||||
if (transformTarget == null) {
|
||||
throw new CommandInvalidStateException("Invalid transform type");
|
||||
}
|
||||
|
||||
EnumFacing direction = args.getDatatypeFor(ForEnumFacing.class);
|
||||
int blocks = args.getAs(Integer.class);
|
||||
|
||||
ISelection[] selections = manager.getSelections();
|
||||
|
||||
if (selections.length < 1) {
|
||||
throw new CommandInvalidStateException("No selections found");
|
||||
}
|
||||
|
||||
selections = transformTarget.transform(selections);
|
||||
|
||||
for (ISelection selection : selections) {
|
||||
if (action == Action.EXPAND) {
|
||||
manager.expand(selection, direction, blocks);
|
||||
@ -212,7 +184,6 @@ public class SelCommand extends Command {
|
||||
manager.shift(selection, direction, blocks);
|
||||
}
|
||||
}
|
||||
|
||||
logDirect(String.format("Transformed %d selections", selections.length));
|
||||
}
|
||||
}
|
||||
@ -227,7 +198,6 @@ public class SelCommand extends Command {
|
||||
.stream();
|
||||
} else {
|
||||
Action action = Action.getByName(args.getString());
|
||||
|
||||
if (action != null) {
|
||||
if (action == Action.POS1 || action == Action.POS2) {
|
||||
if (args.hasAtMost(3)) {
|
||||
@ -238,7 +208,6 @@ public class SelCommand extends Command {
|
||||
while (args.has(2)) {
|
||||
args.get();
|
||||
}
|
||||
|
||||
return args.tabCompleteDatatype(ForBlockOptionalMeta.class);
|
||||
}
|
||||
} else if (action == Action.EXPAND || action == Action.CONTRACT || action == Action.SHIFT) {
|
||||
@ -250,7 +219,6 @@ public class SelCommand extends Command {
|
||||
.stream();
|
||||
} else {
|
||||
TransformTarget target = TransformTarget.getByName(args.getString());
|
||||
|
||||
if (target != null && args.hasExactlyOne()) {
|
||||
return args.tabCompleteDatatype(ForEnumFacing.class);
|
||||
}
|
||||
@ -258,7 +226,6 @@ public class SelCommand extends Command {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Stream.empty();
|
||||
}
|
||||
|
||||
@ -299,20 +266,16 @@ public class SelCommand extends Command {
|
||||
enum Action {
|
||||
POS1("pos1", "p1", "1"),
|
||||
POS2("pos2", "p2", "2"),
|
||||
|
||||
CLEAR("clear", "c"),
|
||||
UNDO("undo", "u"),
|
||||
|
||||
SET("set", "fill", "s", "f"),
|
||||
WALLS("walls", "w"),
|
||||
SHELL("shell", "shl"),
|
||||
CLEARAREA("cleararea", "ca"),
|
||||
REPLACE("replace", "r"),
|
||||
|
||||
EXPAND("expand", "ex"),
|
||||
CONTRACT("contract", "ct"),
|
||||
SHIFT("shift", "sh");
|
||||
|
||||
private final String[] names;
|
||||
|
||||
Action(String... names) {
|
||||
@ -327,17 +290,14 @@ public class SelCommand extends Command {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String[] getAllNames() {
|
||||
Set<String> names = new HashSet<>();
|
||||
|
||||
for (Action action : Action.values()) {
|
||||
names.addAll(asList(action.names));
|
||||
}
|
||||
|
||||
return names.toArray(new String[0]);
|
||||
}
|
||||
}
|
||||
@ -346,7 +306,6 @@ public class SelCommand extends Command {
|
||||
ALL(sels -> sels, "all", "a"),
|
||||
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;
|
||||
|
||||
@ -367,17 +326,14 @@ public class SelCommand extends Command {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String[] getAllNames() {
|
||||
Set<String> names = new HashSet<>();
|
||||
|
||||
for (TransformTarget target : TransformTarget.values()) {
|
||||
names.addAll(asList(target.names));
|
||||
}
|
||||
|
||||
return names.toArray(new String[0]);
|
||||
}
|
||||
}
|
||||
|
@ -53,27 +53,23 @@ public class SetCommand extends Command {
|
||||
@Override
|
||||
protected void executed(String label, ArgConsumer args, Settings settings) {
|
||||
String arg = args.has() ? args.getString().toLowerCase(Locale.US) : "list";
|
||||
|
||||
if (asList("s", "save").contains(arg)) {
|
||||
SettingsUtil.save(settings);
|
||||
logDirect("Settings saved");
|
||||
return;
|
||||
}
|
||||
|
||||
boolean viewModified = asList("m", "mod", "modified").contains(arg);
|
||||
boolean viewAll = asList("all", "l", "list").contains(arg);
|
||||
boolean paginate = viewModified || viewAll;
|
||||
if (paginate) {
|
||||
String search = args.has() && args.peekAsOrNull(Integer.class) == null ? args.getString() : "";
|
||||
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());
|
||||
|
||||
Paginator.paginate(
|
||||
args,
|
||||
new Paginator<>(toPaginate),
|
||||
@ -88,35 +84,28 @@ public class SetCommand extends Command {
|
||||
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 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;
|
||||
}
|
||||
|
||||
args.requireMax(1);
|
||||
|
||||
boolean resetting = arg.equalsIgnoreCase("reset");
|
||||
boolean toggling = arg.equalsIgnoreCase("toggle");
|
||||
boolean doingSomething = resetting || toggling;
|
||||
|
||||
if (resetting) {
|
||||
if (!args.has()) {
|
||||
logDirect("Please specify 'all' as an argument to reset to confirm you'd really like to do this");
|
||||
@ -126,41 +115,33 @@ public class SetCommand extends Command {
|
||||
SettingsUtil.modifiedSettings(settings).forEach(Settings.Setting::reset);
|
||||
logDirect("All settings have been reset to their default values");
|
||||
SettingsUtil.save(settings);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (toggling) {
|
||||
args.requireMin(1);
|
||||
}
|
||||
|
||||
String settingName = doingSomething ? args.getString() : arg;
|
||||
Settings.Setting<?> setting = settings.allSettings.stream()
|
||||
.filter(s -> s.getName().equalsIgnoreCase(settingName))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
if (isNull(setting)) {
|
||||
throw new CommandInvalidTypeException(args.consumed(), "a valid setting");
|
||||
}
|
||||
|
||||
if (!doingSomething && !args.has()) {
|
||||
logDirect(String.format("Value of setting %s:", setting.getName()));
|
||||
logDirect(settingValueToString(setting));
|
||||
} else {
|
||||
String oldValue = settingValueToString(setting);
|
||||
|
||||
if (resetting) {
|
||||
setting.reset();
|
||||
} else if (toggling) {
|
||||
if (setting.getValueClass() != Boolean.class) {
|
||||
throw new CommandInvalidTypeException(args.consumed(), "a toggleable setting", "some other setting");
|
||||
}
|
||||
|
||||
//noinspection unchecked
|
||||
((Settings.Setting<Boolean>) setting).value ^= true;
|
||||
|
||||
logDirect(String.format(
|
||||
"Toggled setting %s to %s",
|
||||
setting.getName(),
|
||||
@ -168,7 +149,6 @@ public class SetCommand extends Command {
|
||||
));
|
||||
} else {
|
||||
String newValue = args.getString();
|
||||
|
||||
try {
|
||||
SettingsUtil.parseAndApply(settings, arg, newValue);
|
||||
} catch (Throwable t) {
|
||||
@ -176,7 +156,6 @@ public class SetCommand extends Command {
|
||||
throw new CommandInvalidTypeException(args.consumed(), "a valid value", t);
|
||||
}
|
||||
}
|
||||
|
||||
if (!toggling) {
|
||||
logDirect(String.format(
|
||||
"Successfully %s %s to %s",
|
||||
@ -185,7 +164,6 @@ public class SetCommand extends Command {
|
||||
settingValueToString(setting)
|
||||
));
|
||||
}
|
||||
|
||||
ITextComponent oldValueComponent = new TextComponentString(String.format("Old value: %s", oldValue));
|
||||
oldValueComponent.getStyle()
|
||||
.setColor(TextFormatting.GRAY)
|
||||
@ -197,9 +175,7 @@ public class SetCommand extends Command {
|
||||
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) {
|
||||
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);
|
||||
@ -207,7 +183,6 @@ public class SetCommand extends Command {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
SettingsUtil.save(settings);
|
||||
}
|
||||
|
||||
@ -215,7 +190,6 @@ public class SetCommand extends Command {
|
||||
protected Stream<String> tabCompleted(String label, ArgConsumer args, Settings settings) {
|
||||
if (args.has()) {
|
||||
String arg = args.getString();
|
||||
|
||||
if (args.hasExactlyOne() && !asList("s", "save").contains(args.peekString().toLowerCase(Locale.US))) {
|
||||
if (arg.equalsIgnoreCase("reset")) {
|
||||
return new TabCompleteHelper()
|
||||
@ -229,19 +203,15 @@ public class SetCommand extends Command {
|
||||
.filterPrefix(args.getString())
|
||||
.stream();
|
||||
}
|
||||
|
||||
Settings.Setting setting = settings.byLowerName.get(arg.toLowerCase(Locale.US));
|
||||
|
||||
if (nonNull(setting)) {
|
||||
if (setting.getType() == Boolean.class) {
|
||||
TabCompleteHelper helper = new TabCompleteHelper();
|
||||
|
||||
if ((Boolean) setting.value) {
|
||||
helper.append(of("true", "false"));
|
||||
} else {
|
||||
helper.append(of("false", "true"));
|
||||
}
|
||||
|
||||
return helper.filterPrefix(args.getString()).stream();
|
||||
} else {
|
||||
return Stream.of(settingValueToString(setting));
|
||||
@ -256,7 +226,6 @@ public class SetCommand extends Command {
|
||||
.stream();
|
||||
}
|
||||
}
|
||||
|
||||
return Stream.empty();
|
||||
}
|
||||
|
||||
|
@ -37,13 +37,11 @@ public class ThisWayCommand extends Command {
|
||||
@Override
|
||||
protected void executed(String label, ArgConsumer args, Settings settings) {
|
||||
args.requireExactly(1);
|
||||
|
||||
GoalXZ goal = GoalXZ.fromDirection(
|
||||
ctx.playerFeetAsVec(),
|
||||
ctx.player().rotationYawHead,
|
||||
args.getAs(Double.class)
|
||||
);
|
||||
|
||||
baritone.getCustomGoalProcess().setGoal(goal);
|
||||
logDirect(String.format("Goal: %s", goal));
|
||||
}
|
||||
|
@ -38,12 +38,10 @@ public class TunnelCommand extends Command {
|
||||
@Override
|
||||
protected void executed(String label, ArgConsumer args, Settings settings) {
|
||||
args.requireMax(0);
|
||||
|
||||
Goal goal = new GoalStrictDirection(
|
||||
ctx.playerFeet(),
|
||||
ctx.player().getHorizontalFacing()
|
||||
);
|
||||
|
||||
baritone.getCustomGoalProcess().setGoal(goal);
|
||||
logDirect(String.format("Goal: %s", goal.toString()));
|
||||
}
|
||||
|
@ -38,9 +38,7 @@ public class VersionCommand extends Command {
|
||||
@Override
|
||||
protected void executed(String label, ArgConsumer args, Settings settings) {
|
||||
args.requireMax(0);
|
||||
|
||||
String version = getClass().getPackage().getImplementationVersion();
|
||||
|
||||
if (isNull(version)) {
|
||||
throw new CommandInvalidStateException("Null version (this is normal in a dev environment)");
|
||||
} else {
|
||||
|
@ -58,14 +58,11 @@ public class WaypointsCommand extends Command {
|
||||
@Override
|
||||
protected void executed(String label, ArgConsumer args, Settings settings) {
|
||||
Action action = args.has() ? Action.getByName(args.getString()) : Action.LIST;
|
||||
|
||||
if (action == null) {
|
||||
throw new CommandInvalidTypeException(args.consumed(), "an action");
|
||||
}
|
||||
|
||||
BiFunction<IWaypoint, Action, ITextComponent> toComponent = (waypoint, _action) -> {
|
||||
ITextComponent component = new TextComponentString("");
|
||||
|
||||
ITextComponent tagComponent = new TextComponentString(waypoint.getTag().name() + " ");
|
||||
tagComponent.getStyle().setColor(TextFormatting.GRAY);
|
||||
String name = waypoint.getName();
|
||||
@ -73,7 +70,6 @@ public class WaypointsCommand extends Command {
|
||||
nameComponent.getStyle().setColor(!name.isEmpty() ? TextFormatting.GRAY : TextFormatting.DARK_GRAY);
|
||||
ITextComponent timestamp = new TextComponentString(" @ " + new Date(waypoint.getCreationTimestamp()));
|
||||
timestamp.getStyle().setColor(TextFormatting.DARK_GRAY);
|
||||
|
||||
component.appendSibling(tagComponent);
|
||||
component.appendSibling(nameComponent);
|
||||
component.appendSibling(timestamp);
|
||||
@ -93,24 +89,18 @@ public class WaypointsCommand extends Command {
|
||||
waypoint.getCreationTimestamp()
|
||||
))
|
||||
);
|
||||
|
||||
return component;
|
||||
};
|
||||
|
||||
Function<IWaypoint, ITextComponent> transform = waypoint ->
|
||||
toComponent.apply(waypoint, action == Action.LIST ? Action.INFO : action);
|
||||
|
||||
if (action == Action.LIST) {
|
||||
IWaypoint.Tag tag = args.has() ? IWaypoint.Tag.getByName(args.peekString()) : null;
|
||||
|
||||
if (tag != null) {
|
||||
args.get();
|
||||
}
|
||||
|
||||
IWaypoint[] waypoints = tag != null
|
||||
? ForWaypoints.getWaypointsByTag(tag)
|
||||
: ForWaypoints.getWaypoints();
|
||||
|
||||
if (waypoints.length > 0) {
|
||||
args.requireMax(1);
|
||||
Paginator.paginate(
|
||||
@ -140,21 +130,16 @@ public class WaypointsCommand extends Command {
|
||||
}
|
||||
} else if (action == Action.SAVE) {
|
||||
IWaypoint.Tag tag = IWaypoint.Tag.getByName(args.getString());
|
||||
|
||||
if (tag == null) {
|
||||
throw new CommandInvalidStateException(String.format("'%s' is not a tag ", args.consumedString()));
|
||||
}
|
||||
|
||||
String name = args.has() ? args.getString() : "";
|
||||
BetterBlockPos pos = args.has()
|
||||
? args.getDatatypePost(RelativeBlockPos.class, ctx.playerFeet())
|
||||
: ctx.playerFeet();
|
||||
|
||||
args.requireMax(0);
|
||||
|
||||
IWaypoint waypoint = new Waypoint(name, tag, pos);
|
||||
ForWaypoints.waypoints().addWaypoint(waypoint);
|
||||
|
||||
ITextComponent component = new TextComponentString("Waypoint added: ");
|
||||
component.getStyle().setColor(TextFormatting.GRAY);
|
||||
component.appendSibling(toComponent.apply(waypoint, Action.INFO));
|
||||
@ -163,28 +148,23 @@ public class WaypointsCommand extends Command {
|
||||
args.requireMax(1);
|
||||
IWaypoint.Tag tag = IWaypoint.Tag.getByName(args.getString());
|
||||
IWaypoint[] waypoints = ForWaypoints.getWaypointsByTag(tag);
|
||||
|
||||
for (IWaypoint waypoint : waypoints) {
|
||||
ForWaypoints.waypoints().removeWaypoint(waypoint);
|
||||
}
|
||||
|
||||
logDirect(String.format("Cleared %d waypoints", waypoints.length));
|
||||
} else {
|
||||
IWaypoint[] waypoints = args.getDatatypeFor(ForWaypoints.class);
|
||||
IWaypoint waypoint = null;
|
||||
|
||||
if (args.has() && args.peekString().equals("@")) {
|
||||
args.requireExactly(2);
|
||||
args.get();
|
||||
long timestamp = args.getAs(Long.class);
|
||||
|
||||
for (IWaypoint iWaypoint : waypoints) {
|
||||
if (iWaypoint.getCreationTimestamp() == timestamp) {
|
||||
waypoint = iWaypoint;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (waypoint == null) {
|
||||
throw new CommandInvalidStateException("Timestamp was specified but no waypoint was found");
|
||||
}
|
||||
@ -196,7 +176,6 @@ public class WaypointsCommand extends Command {
|
||||
waypoint = waypoints[0];
|
||||
}
|
||||
}
|
||||
|
||||
if (waypoint == null) {
|
||||
args.requireMax(1);
|
||||
Paginator.paginate(
|
||||
@ -273,7 +252,6 @@ public class WaypointsCommand extends Command {
|
||||
.stream();
|
||||
} else {
|
||||
Action action = Action.getByName(args.getString());
|
||||
|
||||
if (args.hasExactlyOne()) {
|
||||
if (action == Action.LIST || action == Action.SAVE || action == Action.CLEAR) {
|
||||
return new TabCompleteHelper()
|
||||
@ -291,7 +269,6 @@ public class WaypointsCommand extends Command {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Stream.empty();
|
||||
}
|
||||
|
||||
@ -327,7 +304,6 @@ public class WaypointsCommand extends Command {
|
||||
INFO("info", "show", "i"),
|
||||
DELETE("delete", "d"),
|
||||
GOAL("goal", "goto", "g");
|
||||
|
||||
private final String[] names;
|
||||
|
||||
Action(String... names) {
|
||||
@ -342,17 +318,14 @@ public class WaypointsCommand extends Command {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String[] getAllNames() {
|
||||
Set<String> names = new HashSet<>();
|
||||
|
||||
for (Action action : Action.values()) {
|
||||
names.addAll(asList(action.names));
|
||||
}
|
||||
|
||||
return names.toArray(new String[0]);
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ import net.minecraft.util.math.BlockPos;
|
||||
import java.util.List;
|
||||
|
||||
public final class SchematicAdapter implements ISchematic {
|
||||
|
||||
private final SchematicWorld schematic;
|
||||
|
||||
public SchematicAdapter(SchematicWorld schematicWorld) {
|
||||
|
@ -20,6 +20,7 @@ package com.github.lunatrius.core.util.math;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public class MBlockPos extends BlockPos {
|
||||
|
||||
MBlockPos() {
|
||||
super(6, 6, 6);
|
||||
}
|
||||
|
@ -20,5 +20,6 @@ package com.github.lunatrius.schematica;
|
||||
import com.github.lunatrius.schematica.proxy.CommonProxy;
|
||||
|
||||
public class Schematica {
|
||||
|
||||
public static CommonProxy proxy;
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public interface ISchematic {
|
||||
|
||||
IBlockState getBlockState(BlockPos var1);
|
||||
|
||||
int getWidth();
|
||||
|
@ -21,6 +21,7 @@ import com.github.lunatrius.core.util.math.MBlockPos;
|
||||
import com.github.lunatrius.schematica.api.ISchematic;
|
||||
|
||||
public class SchematicWorld {
|
||||
|
||||
public final MBlockPos position = (MBlockPos) (Object) "cringe";
|
||||
|
||||
public ISchematic getSchematic() {
|
||||
|
@ -20,5 +20,6 @@ package com.github.lunatrius.schematica.proxy;
|
||||
import com.github.lunatrius.schematica.client.world.SchematicWorld;
|
||||
|
||||
public class ClientProxy extends CommonProxy {
|
||||
|
||||
public static SchematicWorld schematic;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user