some efficiency fixes to filters + qol for leijurv

This commit is contained in:
Logan Darklock 2019-08-30 12:25:59 -07:00
parent e3c4d06b2b
commit 4354d09c20
No known key found for this signature in database
GPG Key ID: B8C37CEDE1AC60EA
25 changed files with 145 additions and 77 deletions

View File

@ -22,12 +22,12 @@ public class BlockListFilter implements IBlockFilter {
@Override @Override
public boolean selected(@Nonnull IBlockState blockstate) { public boolean selected(@Nonnull IBlockState blockstate) {
return false; return blocks.contains(blockstate.getBlock());
} }
@Override @Override
public List<Block> blocks() { public List<Block> blocks() {
return null; return blocks;
} }
@Override @Override

View File

@ -17,6 +17,7 @@ import static java.util.Objects.isNull;
public class BlockSelector implements IBlockFilter { public class BlockSelector implements IBlockFilter {
private final Block block; private final Block block;
private final IBlockState blockstate; private final IBlockState blockstate;
private final int damage;
private static final Pattern pattern = Pattern.compile("^(.+?)(?::(\\d+))?$"); private static final Pattern pattern = Pattern.compile("^(.+?)(?::(\\d+))?$");
public BlockSelector(@Nonnull String selector) { public BlockSelector(@Nonnull String selector) {
@ -38,12 +39,12 @@ public class BlockSelector implements IBlockFilter {
block = Block.REGISTRY.getObject(id); block = Block.REGISTRY.getObject(id);
//noinspection deprecation //noinspection deprecation
blockstate = hasData ? block.getStateFromMeta(Integer.parseInt(matchResult.group(2))) : null; blockstate = hasData ? block.getStateFromMeta(Integer.parseInt(matchResult.group(2))) : null;
damage = block.damageDropped(blockstate);
} }
@Override @Override
public boolean selected(@Nonnull IBlockState blockstate) { public boolean selected(@Nonnull IBlockState blockstate) {
return blockstate.getBlock() == block && (isNull(this.blockstate) || return blockstate.getBlock() == block && (isNull(this.blockstate) || block.damageDropped(blockstate) == damage);
block.damageDropped(blockstate) == block.damageDropped(this.blockstate));
} }
@Override @Override

View File

@ -5,37 +5,36 @@ import net.minecraft.block.state.IBlockState;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static java.util.Arrays.asList;
public class CompositeBlockFilter implements IBlockFilter { public class CompositeBlockFilter implements IBlockFilter {
List<IBlockFilter> filters = new ArrayList<>(); private IBlockFilter[] filters;
public CompositeBlockFilter() {
}
public CompositeBlockFilter(List<? extends IBlockFilter> filters) { public CompositeBlockFilter(List<? extends IBlockFilter> filters) {
this.filters.addAll(filters); this.filters = filters.toArray(new IBlockFilter[0]);
} }
public CompositeBlockFilter(IBlockFilter... filters) { public CompositeBlockFilter(IBlockFilter... filters) {
this.filters.addAll(asList(filters)); this.filters = filters;
} }
@Override @Override
public boolean selected(@Nonnull IBlockState blockstate) { public boolean selected(@Nonnull IBlockState blockstate) {
return filters.stream() for (IBlockFilter filter : filters) {
.map(f -> f.selected(blockstate)) if (filter.selected(blockstate)) {
.filter(Boolean::valueOf).findFirst() return true;
.orElse(false); }
}
return false;
} }
@Override @Override
public List<Block> blocks() { public List<Block> blocks() {
return filters.stream() return Arrays.stream(filters)
.map(IBlockFilter::blocks) .map(IBlockFilter::blocks)
.flatMap(Collection::stream) .flatMap(Collection::stream)
.collect(Collectors.toCollection(ArrayList::new)); .collect(Collectors.toCollection(ArrayList::new));
@ -45,7 +44,7 @@ public class CompositeBlockFilter implements IBlockFilter {
public String toString() { public String toString() {
return String.format( return String.format(
"CompositeBlockFilter{%s}", "CompositeBlockFilter{%s}",
String.join(",", filters.stream().map(Object::toString).toArray(String[]::new)) String.join(",", Arrays.stream(filters).map(Object::toString).toArray(String[]::new))
); );
} }
} }

View File

@ -151,7 +151,7 @@ public class BaritoneChatControl implements Helper, AbstractGameEventListener {
if (setting.getName().equalsIgnoreCase(pair.first())) { if (setting.getName().equalsIgnoreCase(pair.first())) {
logRanCommand(msg); logRanCommand(msg);
CommandManager.execute(String.format("set %s %s", setting.getName(), argc.getS())); CommandManager.execute(String.format("set %s %s", setting.getName(), argc.getString()));
return true; return true;
} }
} }
@ -203,11 +203,11 @@ public class BaritoneChatControl implements Helper, AbstractGameEventListener {
return new TabCompleteHelper() return new TabCompleteHelper()
.addCommands() .addCommands()
.addSettings() .addSettings()
.filterPrefix(argc.getS()) .filterPrefix(argc.getString())
.stream(); .stream();
} }
Settings.Setting setting = settings.byLowerName.get(argc.getS().toLowerCase(Locale.US)); Settings.Setting setting = settings.byLowerName.get(argc.getString().toLowerCase(Locale.US));
if (nonNull(setting)) { if (nonNull(setting)) {
if (setting.getValueClass() == Boolean.class) { if (setting.getValueClass() == Boolean.class) {
@ -219,7 +219,7 @@ public class BaritoneChatControl implements Helper, AbstractGameEventListener {
helper.append(of("false", "true")); helper.append(of("false", "true"));
} }
return helper.filterPrefix(argc.getS()).stream(); return helper.filterPrefix(argc.getString()).stream();
} else { } else {
return of(SettingsUtil.settingValueToString(setting)); return of(SettingsUtil.settingValueToString(setting));
} }

View File

@ -39,7 +39,7 @@ public class CommandArgument {
this.rawRest = rawRest; this.rawRest = rawRest;
} }
public <E extends Enum<?>> E getE(Class<E> enumClass) { public <E extends Enum<?>> E getEnum(Class<E> enumClass) {
//noinspection OptionalGetWithoutIsPresent //noinspection OptionalGetWithoutIsPresent
return Arrays.stream(enumClass.getEnumConstants()) return Arrays.stream(enumClass.getEnumConstants())
.filter(e -> e.name().equalsIgnoreCase(value)) .filter(e -> e.name().equalsIgnoreCase(value))

View File

@ -16,7 +16,7 @@ public class BlockById implements IDatatypeFor<Block> {
} }
public BlockById(ArgConsumer consumer) { public BlockById(ArgConsumer consumer) {
ResourceLocation id = new ResourceLocation(consumer.getS()); ResourceLocation id = new ResourceLocation(consumer.getString());
if ((block = Block.REGISTRY.getObject(id)) == Blocks.AIR) { if ((block = Block.REGISTRY.getObject(id)) == Blocks.AIR) {
throw new RuntimeException("no block found by that id"); throw new RuntimeException("no block found by that id");
@ -36,7 +36,7 @@ public class BlockById implements IDatatypeFor<Block> {
.stream() .stream()
.map(Object::toString) .map(Object::toString)
) )
.filterPrefixNamespaced(consumer.getS()) .filterPrefixNamespaced(consumer.getString())
.sortAlphabetically() .sortAlphabetically()
.stream(); .stream();
} }

View File

@ -18,7 +18,7 @@ public class EntityClassById implements IDatatypeFor<Class<? extends Entity>> {
} }
public EntityClassById(ArgConsumer consumer) { public EntityClassById(ArgConsumer consumer) {
ResourceLocation id = new ResourceLocation(consumer.getS()); ResourceLocation id = new ResourceLocation(consumer.getString());
if (isNull(entity = EntityList.REGISTRY.getObject(id))) { if (isNull(entity = EntityList.REGISTRY.getObject(id))) {
throw new RuntimeException("no entity found by that id"); throw new RuntimeException("no entity found by that id");
@ -38,7 +38,7 @@ public class EntityClassById implements IDatatypeFor<Class<? extends Entity>> {
.stream() .stream()
.map(Object::toString) .map(Object::toString)
) )
.filterPrefixNamespaced(consumer.getS()) .filterPrefixNamespaced(consumer.getString())
.sortAlphabetically() .sortAlphabetically()
.stream(); .stream();
} }

View File

@ -13,7 +13,7 @@ public class ForBlockSelector implements IDatatypeFor<BlockSelector> {
} }
public ForBlockSelector(ArgConsumer consumer) { public ForBlockSelector(ArgConsumer consumer) {
selector = new BlockSelector(consumer.getS()); selector = new BlockSelector(consumer.getString());
} }
@Override @Override

View File

@ -20,7 +20,7 @@ public class PlayerByUsername implements IDatatypeFor<EntityPlayer> {
} }
public PlayerByUsername(ArgConsumer consumer) { public PlayerByUsername(ArgConsumer consumer) {
String username = consumer.getS(); String username = consumer.getString();
if (isNull( if (isNull(
player = players player = players
@ -46,7 +46,7 @@ public class PlayerByUsername implements IDatatypeFor<EntityPlayer> {
.stream() .stream()
.map(EntityPlayer::getName) .map(EntityPlayer::getName)
) )
.filterPrefix(consumer.getS()) .filterPrefix(consumer.getString())
.sortAlphabetically() .sortAlphabetically()
.stream(); .stream();
} }

View File

@ -23,7 +23,7 @@ public class RelativeCoordinate implements IDatatypePost<Double, Double> {
throw new RuntimeException("relative coordinate requires an argument"); throw new RuntimeException("relative coordinate requires an argument");
} }
Matcher matcher = PATTERN.matcher(consumer.getS()); Matcher matcher = PATTERN.matcher(consumer.getString());
if (!matcher.matches()) { if (!matcher.matches()) {
throw new RuntimeException("pattern doesn't match"); throw new RuntimeException("pattern doesn't match");
@ -48,7 +48,7 @@ public class RelativeCoordinate implements IDatatypePost<Double, Double> {
@Override @Override
public Stream<String> tabComplete(ArgConsumer consumer) { public Stream<String> tabComplete(ArgConsumer consumer) {
if (!consumer.has(2) && consumer.getS().matches("^(~|$)")) { if (!consumer.has(2) && consumer.getString().matches("^(~|$)")) {
return Stream.of("~"); return Stream.of("~");
} }

View File

@ -20,7 +20,7 @@ public class RelativeFile implements IDatatypePost<File, File> {
public RelativeFile(ArgConsumer consumer) { public RelativeFile(ArgConsumer consumer) {
try { try {
path = FileSystems.getDefault().getPath(consumer.getS()); path = FileSystems.getDefault().getPath(consumer.getString());
} catch (InvalidPathException e) { } catch (InvalidPathException e) {
throw new RuntimeException("invalid path"); throw new RuntimeException("invalid path");
} }
@ -32,7 +32,7 @@ public class RelativeFile implements IDatatypePost<File, File> {
} }
public static Stream<String> tabComplete(ArgConsumer consumer, File base) { public static Stream<String> tabComplete(ArgConsumer consumer, File base) {
String currentPathStringThing = consumer.getS(); String currentPathStringThing = consumer.getString();
Path currentPath = FileSystems.getDefault().getPath(currentPathStringThing); Path currentPath = FileSystems.getDefault().getPath(currentPathStringThing);
Path basePath = currentPath.isAbsolute() ? currentPath.getRoot() : base.toPath(); Path basePath = currentPath.isAbsolute() ? currentPath.getRoot() : base.toPath();
boolean useParent = !currentPathStringThing.isEmpty() && !currentPathStringThing.endsWith(File.separator); boolean useParent = !currentPathStringThing.isEmpty() && !currentPathStringThing.endsWith(File.separator);

View File

@ -36,7 +36,7 @@ public class BuildCommand extends Command {
@Override @Override
protected void executed(String label, ArgConsumer args, Settings settings) { protected void executed(String label, ArgConsumer args, Settings settings) {
String filename = String.format("%s.schematic", args.getS()); String filename = String.format("%s.schematic", args.getString());
BetterBlockPos origin = ctx.playerFeet(); BetterBlockPos origin = ctx.playerFeet();
BetterBlockPos buildOrigin; BetterBlockPos buildOrigin;

View File

@ -44,7 +44,7 @@ public class ExploreFilterCommand extends Command {
boolean invert = false; boolean invert = false;
if (args.has()) { if (args.has()) {
if (args.getS().equalsIgnoreCase("invert")) { if (args.getString().equalsIgnoreCase("invert")) {
invert = true; invert = true;
} else { } else {
throw new CommandInvalidTypeException(args.consumed(), "either \"invert\" or nothing"); throw new CommandInvalidTypeException(args.consumed(), "either \"invert\" or nothing");

View File

@ -57,13 +57,13 @@ public class FollowCommand extends Command {
List<Class<? extends Entity>> classes = new ArrayList<>(); List<Class<? extends Entity>> classes = new ArrayList<>();
if (args.hasExactlyOne()) { if (args.hasExactlyOne()) {
baritone.getFollowProcess().follow((group = args.getE(FollowGroup.class)).filter); baritone.getFollowProcess().follow((group = args.getEnum(FollowGroup.class)).filter);
list = null; list = null;
} else { } else {
args.requireMin(2); args.requireMin(2);
group = null; group = null;
list = args.getE(FollowList.class); list = args.getEnum(FollowList.class);
while (args.has()) { while (args.has()) {
//noinspection unchecked //noinspection unchecked
@ -109,13 +109,13 @@ public class FollowCommand extends Command {
return new TabCompleteHelper() return new TabCompleteHelper()
.append(FollowGroup.class) .append(FollowGroup.class)
.append(FollowList.class) .append(FollowList.class)
.filterPrefix(args.getS()) .filterPrefix(args.getString())
.stream(); .stream();
} else { } else {
Class<? extends IDatatype> followType; Class<? extends IDatatype> followType;
try { try {
followType = args.getE(FollowList.class).datatype; followType = args.getEnum(FollowList.class).datatype;
} catch (NullPointerException e) { } catch (NullPointerException e) {
return Stream.empty(); return Stream.empty();
} }

View File

@ -43,7 +43,7 @@ public class GoalCommand extends Command {
protected void executed(String label, ArgConsumer args, Settings settings) { protected void executed(String label, ArgConsumer args, Settings settings) {
ICustomGoalProcess goalProcess = baritone.getCustomGoalProcess(); ICustomGoalProcess goalProcess = baritone.getCustomGoalProcess();
if (args.has() && asList("reset", "clear", "none").contains(args.peekS())) { if (args.has() && asList("reset", "clear", "none").contains(args.peekString())) {
args.requireMax(1); args.requireMax(1);
if (nonNull(goalProcess.getGoal())) { if (nonNull(goalProcess.getGoal())) {
@ -83,7 +83,7 @@ public class GoalCommand extends Command {
} }
} }
return helper.filterPrefix(args.getS()).stream(); return helper.filterPrefix(args.getString()).stream();
} }
@Override @Override

View File

@ -89,7 +89,7 @@ public class HelpCommand extends Command {
FORCE_COMMAND_PREFIX + "help %d" FORCE_COMMAND_PREFIX + "help %d"
); );
} else { } else {
String commandName = args.getS().toLowerCase(); String commandName = args.getString().toLowerCase();
Command command = getCommand(commandName); Command command = getCommand(commandName);
if (isNull(command)) { if (isNull(command)) {
@ -112,7 +112,7 @@ public class HelpCommand extends Command {
@Override @Override
protected Stream<String> tabCompleted(String label, ArgConsumer args, Settings settings) { protected Stream<String> tabCompleted(String label, ArgConsumer args, Settings settings) {
if (args.hasExactlyOne()) { if (args.hasExactlyOne()) {
return new TabCompleteHelper().addCommands().filterPrefix(args.getS()).stream(); return new TabCompleteHelper().addCommands().filterPrefix(args.getString()).stream();
} }
return Stream.empty(); return Stream.empty();

View File

@ -68,7 +68,7 @@ public class PathCommand extends Command {
if (!args.has(2)) { if (!args.has(2)) {
return new TabCompleteHelper() return new TabCompleteHelper()
.append("~") .append("~")
.filterPrefix(args.getS()) .filterPrefix(args.getString())
.stream(); .stream();
} }
} }

View File

@ -49,13 +49,13 @@ public class ProcCommand extends Command {
logDirect(String.format( logDirect(String.format(
"Class: %s\n" + "Class: %s\n" +
"Priority: %s\n" + "Priority: %f\n" +
"Temporary: %s\n" + "Temporary: %b\n" +
"Display name: %s\n" + "Display name: %s\n" +
"Last command: %s", "Last command: %s",
process.getClass().getTypeName(), process.getClass().getTypeName(),
Double.toString(process.priority()), process.priority(),
Boolean.toString(process.isTemporary()), process.isTemporary(),
process.displayName(), process.displayName(),
pathingControlManager pathingControlManager
.mostRecentCommand() .mostRecentCommand()

View File

@ -51,12 +51,12 @@ public class SetCommand extends Command {
@Override @Override
protected void executed(String label, ArgConsumer args, Settings settings) { protected void executed(String label, ArgConsumer args, Settings settings) {
String arg = args.has() ? args.getS().toLowerCase(Locale.US) : "list"; String arg = args.has() ? args.getString().toLowerCase(Locale.US) : "list";
boolean viewModified = asList("m", "mod", "modified").contains(arg); boolean viewModified = asList("m", "mod", "modified").contains(arg);
boolean viewAll = asList("all", "l", "list").contains(arg); boolean viewAll = asList("all", "l", "list").contains(arg);
boolean paginate = viewModified | viewAll; boolean paginate = viewModified | viewAll;
if (paginate) { if (paginate) {
String search = args.has() && args.peekAsOrNull(Integer.class) == null ? args.getS() : ""; String search = args.has() && args.peekAsOrNull(Integer.class) == null ? args.getString() : "";
args.requireMax(1); args.requireMax(1);
List<? extends Settings.Setting> toPaginate = List<? extends Settings.Setting> toPaginate =
@ -122,7 +122,7 @@ public class SetCommand extends Command {
logDirect("Please specify 'all' as an argument to reset to confirm you'd really like to do this"); logDirect("Please specify 'all' as an argument to reset to confirm you'd really like to do this");
logDirect("ALL settings will be reset. Use the 'set modified' or 'modified' commands to see what will be reset."); logDirect("ALL settings will be reset. Use the 'set modified' or 'modified' commands to see what will be reset.");
logDirect("Specify a setting name instead of 'all' to only reset one setting"); logDirect("Specify a setting name instead of 'all' to only reset one setting");
} else if (args.peekS().equalsIgnoreCase("all")) { } else if (args.peekString().equalsIgnoreCase("all")) {
SettingsUtil.modifiedSettings(settings).forEach(Settings.Setting::reset); SettingsUtil.modifiedSettings(settings).forEach(Settings.Setting::reset);
logDirect("All settings have been reset to their default values"); logDirect("All settings have been reset to their default values");
@ -134,7 +134,7 @@ public class SetCommand extends Command {
args.requireMin(1); args.requireMin(1);
} }
String settingName = doingSomething ? args.getS() : arg; String settingName = doingSomething ? args.getString() : arg;
Settings.Setting<?> setting = settings.allSettings.stream() Settings.Setting<?> setting = settings.allSettings.stream()
.filter(s -> s.getName().equalsIgnoreCase(settingName)) .filter(s -> s.getName().equalsIgnoreCase(settingName))
.findFirst() .findFirst()
@ -166,7 +166,7 @@ public class SetCommand extends Command {
Boolean.toString((Boolean) setting.value) Boolean.toString((Boolean) setting.value)
)); ));
} else { } else {
String newValue = args.getS(); String newValue = args.getString();
try { try {
SettingsUtil.parseAndApply(settings, arg, newValue); SettingsUtil.parseAndApply(settings, arg, newValue);
@ -210,19 +210,19 @@ public class SetCommand extends Command {
@Override @Override
protected Stream<String> tabCompleted(String label, ArgConsumer args, Settings settings) { protected Stream<String> tabCompleted(String label, ArgConsumer args, Settings settings) {
if (args.has()) { if (args.has()) {
String arg = args.getS(); String arg = args.getString();
if (args.hasExactlyOne()) { if (args.hasExactlyOne()) {
if (arg.equalsIgnoreCase("reset")) { if (arg.equalsIgnoreCase("reset")) {
return new TabCompleteHelper() return new TabCompleteHelper()
.addModifiedSettings() .addModifiedSettings()
.prepend("all") .prepend("all")
.filterPrefix(args.getS()) .filterPrefix(args.getString())
.stream(); .stream();
} else if (arg.equalsIgnoreCase("toggle")) { } else if (arg.equalsIgnoreCase("toggle")) {
return new TabCompleteHelper() return new TabCompleteHelper()
.addToggleableSettings() .addToggleableSettings()
.filterPrefix(args.getS()) .filterPrefix(args.getString())
.stream(); .stream();
} }
@ -238,7 +238,7 @@ public class SetCommand extends Command {
helper.append(of("false", "true")); helper.append(of("false", "true"));
} }
return helper.filterPrefix(args.getS()).stream(); return helper.filterPrefix(args.getString()).stream();
} else { } else {
return Stream.of(settingValueToString(setting)); return Stream.of(settingValueToString(setting));
} }

View File

@ -84,21 +84,21 @@ public class ArgConsumer {
return peek().is(type); return peek().is(type);
} }
public String peekS(int index) { public String peekString(int index) {
return peek(index).value; return peek(index).value;
} }
public String peekS() { public String peekString() {
return peekS(0); return peekString(0);
} }
public <E extends Enum<?>> E peekE(Class<E> enumClass) { public <E extends Enum<?>> E peekEnum(Class<E> enumClass) {
return peek().getE(enumClass); return peek().getEnum(enumClass);
} }
public <E extends Enum<?>> E peekEOrNull(Class<E> enumClass) { public <E extends Enum<?>> E peekEnumOrNull(Class<E> enumClass) {
try { try {
return peekE(enumClass); return peekEnum(enumClass);
} catch (NoSuchElementException e) { } catch (NoSuchElementException e) {
return null; return null;
} }
@ -171,22 +171,22 @@ public class ArgConsumer {
return arg; return arg;
} }
public String getS() { public String getString() {
return get().value; return get().value;
} }
public <E extends Enum<?>> E getE(Class<E> enumClass) { public <E extends Enum<?>> E getEnum(Class<E> enumClass) {
try { try {
return get().getE(enumClass); return get().getEnum(enumClass);
} catch (NoSuchElementException e) { } catch (NoSuchElementException e) {
throw new CommandInvalidTypeException(consumed(), enumClass.getSimpleName()); throw new CommandInvalidTypeException(consumed(), enumClass.getSimpleName());
} }
} }
public <E extends Enum<?>> E getEOrNull(Class<E> enumClass) { public <E extends Enum<?>> E getEnumOrNull(Class<E> enumClass) {
try { try {
peekE(enumClass); peekEnum(enumClass);
return getE(enumClass); return getEnum(enumClass);
} catch (CommandInvalidTypeException e) { } catch (CommandInvalidTypeException e) {
return null; return null;
} }

View File

@ -1,3 +1,20 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.launch.mixins; package baritone.launch.mixins;
import net.minecraft.client.gui.GuiChat; import net.minecraft.client.gui.GuiChat;

View File

@ -1,3 +1,20 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.launch.mixins; package baritone.launch.mixins;
import baritone.utils.accessor.ITabCompleter; import baritone.utils.accessor.ITabCompleter;

View File

@ -1,3 +1,20 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.launch.mixins; package baritone.launch.mixins;
import baritone.api.utils.command.Lol; import baritone.api.utils.command.Lol;

View File

@ -1,3 +1,20 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.launch.mixins; package baritone.launch.mixins;
import baritone.api.BaritoneAPI; import baritone.api.BaritoneAPI;
@ -86,7 +103,7 @@ public abstract class MixinTabCompleter implements ITabCompleter {
@Override @Override
public boolean onGuiChatSetCompletions(String[] newCompl) { public boolean onGuiChatSetCompletions(String[] newCompl) {
IBaritone baritone = BaritoneAPI.getProvider().getBaritoneForPlayer(Minecraft.getMinecraft().player); IBaritone baritone = BaritoneAPI.getProvider().getPrimaryBaritone();
if (isNull(baritone)) { if (isNull(baritone)) {
return false; return false;

View File

@ -10,6 +10,7 @@
"client": [ "client": [
"MixinAnvilChunkLoader", "MixinAnvilChunkLoader",
"MixinBlockPos", "MixinBlockPos",
"MixinChatTabCompleter",
"MixinChunkProviderClient", "MixinChunkProviderClient",
"MixinChunkProviderServer", "MixinChunkProviderServer",
"MixinChunkRenderContainer", "MixinChunkRenderContainer",
@ -17,16 +18,15 @@
"MixinEntityLivingBase", "MixinEntityLivingBase",
"MixinEntityPlayerSP", "MixinEntityPlayerSP",
"MixinEntityRenderer", "MixinEntityRenderer",
"MixinGuiChat",
"MixinGuiScreen",
"MixinMinecraft", "MixinMinecraft",
"MixinNetHandlerPlayClient", "MixinNetHandlerPlayClient",
"MixinNetworkManager", "MixinNetworkManager",
"MixinRenderChunk", "MixinRenderChunk",
"MixinRenderList", "MixinRenderList",
"MixinVboRenderList",
"MixinWorldClient",
"MixinTabCompleter", "MixinTabCompleter",
"MixinGuiChat", "MixinVboRenderList",
"MixinChatTabCompleter", "MixinWorldClient"
"MixinGuiScreen"
] ]
} }