Merge pull request #1942 from CDAGaming/live/1.16.1

[1.16.1] Live Testing Week Changes
This commit is contained in:
Leijurv 2020-08-10 13:16:34 -07:00 committed by GitHub
commit 3f3358d0b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 235 additions and 95 deletions

14
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,14 @@
image: java:8
before_script:
- which java
- which javac
build:
script:
- ./gradlew build
- ./gradlew build -Pbaritone.forge_build
artifacts:
paths:
- dist/*
expire_in: 1 week

View File

@ -21,12 +21,14 @@
![Lines of Code](https://tokei.rs/b1/github/cabaletta/baritone?category=code)
[![GitHub contributors](https://img.shields.io/github/contributors/cabaletta/baritone.svg)](https://github.com/cabaletta/baritone/graphs/contributors/)
[![GitHub commits](https://img.shields.io/github/commits-since/cabaletta/baritone/v1.0.0.svg)](https://github.com/cabaletta/baritone/commit/)
[![Impact integration](https://img.shields.io/badge/Impact%20integration-v1.2.10%20/%20v1.3.5%20/%20v1.4.3-brightgreen.svg)](https://impactclient.net/)
[![Impact integration](https://img.shields.io/badge/Impact%20integration-v1.2.14%20/%20v1.3.8%20/%20v1.4.6%20/%20v1.5.3-brightgreen.svg)](https://impactclient.net/)
[![KAMI Blue integration](https://img.shields.io/badge/KAMI%20Blue%20integration-v1.2.14--master-green)](https://github.com/kami-blue/client)
[![ForgeHax integration](https://img.shields.io/badge/ForgeHax%20%22integration%22-scuffed-yellow.svg)](https://github.com/fr1kin/ForgeHax/)
[![Aristois add-on integration](https://img.shields.io/badge/Aristois%20add--on%20integration-v1.3.4%20/%20v1.4.1-green.svg)](https://gitlab.com/emc-mods-indrit/baritone_api)
[![rootNET integration](https://img.shields.io/badge/rootNET%20integration-v1.2.11-green.svg)](https://rootnet.dev/)
[![WWE integration](https://img.shields.io/badge/WWE%20%22integration%22-master%3F-green.svg)](https://wweclient.com/)
[![Future integration](https://img.shields.io/badge/Future%20integration-Soon™%3F%3F%3F-red.svg)](https://futureclient.net/)
[![Future integration](https://img.shields.io/badge/Future%20integration-v1.2.12%20%2F%20v1.3.6%20%2F%20v1.4.4-red)](https://futureclient.net/)
[![RusherHack integration](https://img.shields.io/badge/RusherHack%20integration-v1.2.14-green)](https://rusherhack.org/)
[![forthebadge](https://forthebadge.com/images/badges/built-with-swag.svg)](http://forthebadge.com/)
[![forthebadge](https://forthebadge.com/images/badges/mom-made-pizza-rolls.svg)](http://forthebadge.com/)
@ -34,9 +36,9 @@ A Minecraft pathfinder bot.
Baritone is the pathfinding system used in [Impact](https://impactclient.net/) since 4.4. There's a [showcase video](https://youtu.be/CZkLXWo4Fg4) made by @Adovin#0730 on Baritone which I recommend. [Here's](https://www.youtube.com/watch?v=StquF69-_wI) a (very old!) video I made showing off what it can do.
The easiest way to install Baritone is to install [Impact](https://impactclient.net/), which comes with Baritone. The second easiest way (for 1.12.2 only) is to install the v1.2.* forge api jar from [releases](https://github.com/cabaletta/baritone/releases). Otherwise, see [Installation & setup](SETUP.md). Once Baritone is installed, look [here](USAGE.md) for instructions on how to use it.
The easiest way to install Baritone is to install [Impact](https://impactclient.net/), which comes with Baritone. The second easiest way (for 1.12.2 only) is to install the v1.2.* `api-forge` jar from [releases](https://github.com/cabaletta/baritone/releases). **For 1.12.2 Forge, just click [here](https://github.com/cabaletta/baritone/releases/download/v1.2.14/baritone-api-forge-1.2.14.jar)**. Otherwise, see [Installation & setup](SETUP.md). Once Baritone is installed, look [here](USAGE.md) for instructions on how to use it.
For 1.15.2, [click here](https://www.youtube.com/watch?v=j1qKtCZFURM) and see description.
For 1.15.2, [click here](https://www.youtube.com/watch?v=j1qKtCZFURM) and see description. If you need Forge 1.15.2, look [here](https://github.com/cabaletta/baritone/releases/tag/v1.5.3), follow the instructions, and get the `api-forge` jar.
This project is an updated version of [MineBot](https://github.com/leijurv/MineBot/),
the original version of the bot for Minecraft 1.8.9, rebuilt for 1.12.2 through 1.15.2. Baritone focuses on reliability and particularly performance (it's over [30x faster](https://github.com/cabaletta/baritone/pull/180#issuecomment-423822928) than MineBot at calculating paths).
@ -88,6 +90,16 @@ That's what it's for, sure! (As long as usage is in compliance with the LGPL 3.0
Magic. (Hours of [leijurv](https://github.com/leijurv/) enduring excruciating pain)
### Additional Special Thanks To:
![YourKit-Logo](https://www.yourkit.com/images/yklogo.png)
YourKit supports open source projects with innovative and intelligent tools for monitoring and profiling Java and .NET applications.
YourKit is the creator of the [YourKit Java Profiler](https://www.yourkit.com/java/profiler/), [YourKit .NET Profiler](https://www.yourkit.com/.net/profiler/), and [YourKit YouMonitor](https://www.yourkit.com/youmonitor/).
We thank them for granting Baritone an OSS license so that we can make our software the best it can be.
## Why is it called Baritone?
It's named for FitMC's deep sultry voice.
It's named for FitMC's deep sultry voice.

View File

@ -52,7 +52,7 @@ Some common examples:
- `version` to get the version of Baritone you're running
- `damn` daniel
For the rest of the commands, you can take a look at the code [here](https://github.com/cabaletta/baritone/blob/master/src/api/java/baritone/api/utils/ExampleBaritoneControl.java).
For the rest of the commands, you can take a look at the code [here](https://baritone.leijurv.com/baritone/api/Settings.html).
All the settings and documentation are <a href="https://github.com/cabaletta/baritone/blob/master/src/api/java/baritone/api/Settings.java">here</a>. If you find HTML easier to read than Javadoc, you can look <a href="https://baritone.leijurv.com/baritone/api/Settings.html#field.detail">here</a>.

View File

@ -85,7 +85,7 @@ task sourceJar(type: Jar, dependsOn: classes) {
}
minecraft {
mappings channel: 'snapshot', version: '20200707-1.16.1'
mappings channel: 'snapshot', version: '20200723-1.16.1'
if (getProject().hasProperty("baritone.forge_build")) {
reobfMappings 'searge'

View File

@ -20,8 +20,21 @@ package baritone.gradle.task;
import baritone.gradle.util.Determinizer;
import org.apache.commons.io.IOUtils;
import org.gradle.api.plugins.JavaPluginConvention;
import org.gradle.api.JavaVersion;
import org.gradle.api.NamedDomainObjectContainer;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.artifacts.Dependency;
import org.gradle.api.internal.file.IdentityFileResolver;
import org.gradle.api.internal.plugins.DefaultConvention;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.TaskAction;
import org.gradle.api.tasks.TaskCollection;
import org.gradle.api.tasks.compile.ForkOptions;
import org.gradle.api.tasks.compile.JavaCompile;
import org.gradle.internal.Pair;
import org.gradle.internal.jvm.Jvm;
import org.gradle.internal.jvm.inspection.DefaultJvmVersionDetector;
import org.gradle.process.internal.DefaultExecActionFactory;
import java.io.*;
import java.net.URL;
@ -86,6 +99,101 @@ public class ProguardTask extends BaritoneGradleTask {
}
}
private String getJavaBinPathForProguard() throws Exception {
String path;
try {
path = findJavaPathByGradleConfig();
if (path != null) return path;
}
catch (Exception ex) {
System.err.println("Unable to find java by javaCompile options");
ex.printStackTrace();
}
try {
path = findJavaByJavaHome();
if (path != null) return path;
}
catch(Exception ex) {
System.err.println("Unable to find java by JAVA_HOME");
ex.printStackTrace();
}
path = findJavaByGradleCurrentRuntime();
if (path != null) return path;
throw new Exception("Unable to find java to determine ProGuard libraryjars. Please specify forkOptions.executable in javaCompile," +
" JAVA_HOME environment variable, or make sure to run Gradle with the correct JDK (a v1.8 only)");
}
private String findJavaByGradleCurrentRuntime() {
String path = Jvm.current().getJavaExecutable().getAbsolutePath();
if (this.validateJavaVersion(path)) {
System.out.println("Using Gradle's runtime Java for ProGuard");
return path;
}
return null;
}
private String findJavaByJavaHome() {
final String javaHomeEnv = System.getenv("JAVA_HOME");
if (javaHomeEnv != null) {
String path = Jvm.forHome(new File(javaHomeEnv)).getJavaExecutable().getAbsolutePath();
if (this.validateJavaVersion(path)) {
System.out.println("Detected Java path by JAVA_HOME");
return path;
}
}
return null;
}
private String findJavaPathByGradleConfig() {
final TaskCollection<JavaCompile> javaCompiles = super.getProject().getTasks().withType(JavaCompile.class);
final JavaCompile compileTask = javaCompiles.iterator().next();
final ForkOptions forkOptions = compileTask.getOptions().getForkOptions();
if (forkOptions != null) {
String javacPath = forkOptions.getExecutable();
if (javacPath != null) {
File javacFile = new File(javacPath);
if (javacFile.exists()) {
File[] maybeJava = javacFile.getParentFile().listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.equals("java");
}
});
if (maybeJava != null && maybeJava.length > 0) {
String path = maybeJava[0].getAbsolutePath();
if (this.validateJavaVersion(path)) {
System.out.println("Detected Java path by forkOptions");
return path;
}
}
}
}
}
return null;
}
private boolean validateJavaVersion(String java) {
final JavaVersion javaVersion = new DefaultJvmVersionDetector(new DefaultExecActionFactory(new IdentityFileResolver())).getJavaVersion(java);
if (!javaVersion.getMajorVersion().equals("8")) {
System.out.println("Failed to validate Java version " + javaVersion.toString() + " [" + java + "] for ProGuard libraryjars");
// throw new RuntimeException("Java version incorrect: " + javaVersion.getMajorVersion() + " for " + java);
return false;
}
System.out.println("Validated Java version " + javaVersion.toString() + " [" + java + "] for ProGuard libraryjars");
return true;
}
private void generateConfigs() throws Exception {
Files.copy(getRelativeFile(PROGUARD_CONFIG_TEMPLATE), getTemporaryFile(PROGUARD_CONFIG_DEST), REPLACE_EXISTING);
@ -95,7 +203,7 @@ public class ProguardTask extends BaritoneGradleTask {
template.add(1, "-outjars " + this.getTemporaryFile(PROGUARD_EXPORT_PATH));
// Acquire the RT jar using "java -verbose". This doesn't work on Java 9+
Process p = new ProcessBuilder("java", "-verbose").start();
Process p = new ProcessBuilder(this.getJavaBinPathForProguard(), "-verbose").start();
String out = IOUtils.toString(p.getInputStream(), "UTF-8").split("\n")[0].split("Opened ")[1].replace("]", "");
template.add(2, "-libraryjars '" + out + "'");

View File

@ -754,6 +754,12 @@ public final class Settings {
*/
public final Setting<Boolean> layerOrder = new Setting<>(false);
/**
* Start building the schematic at a specific layer.
* Can help on larger builds when schematic wants to break things its already built
*/
public final Setting<Integer> startAtLayer = new Setting<>(0);
/**
* How far to move before repeating the build. 0 to disable repeating on a certain axis, 0,0,0 to disable entirely
*/

View File

@ -77,7 +77,7 @@ public class Paginator<E> implements Helper {
boolean hasNextPage = commandPrefix != null && validPage(page + 1);
TextComponent prevPageComponent = new StringTextComponent("<<");
if (hasPrevPage) {
prevPageComponent.func_230530_a_(prevPageComponent.getStyle()
prevPageComponent.setStyle(prevPageComponent.getStyle()
.setClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,
String.format("%s %d", commandPrefix, page - 1)
@ -87,11 +87,11 @@ public class Paginator<E> implements Helper {
new StringTextComponent("Click to view previous page")
)));
} else {
prevPageComponent.func_230530_a_(prevPageComponent.getStyle().setFormatting(TextFormatting.DARK_GRAY));
prevPageComponent.setStyle(prevPageComponent.getStyle().setFormatting(TextFormatting.DARK_GRAY));
}
TextComponent nextPageComponent = new StringTextComponent(">>");
if (hasNextPage) {
nextPageComponent.func_230530_a_(nextPageComponent.getStyle()
nextPageComponent.setStyle(nextPageComponent.getStyle()
.setClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,
String.format("%s %d", commandPrefix, page + 1)
@ -101,14 +101,14 @@ public class Paginator<E> implements Helper {
new StringTextComponent("Click to view next page")
)));
} else {
nextPageComponent.func_230530_a_(nextPageComponent.getStyle().setFormatting(TextFormatting.DARK_GRAY));
nextPageComponent.setStyle(nextPageComponent.getStyle().setFormatting(TextFormatting.DARK_GRAY));
}
TextComponent pagerComponent = new StringTextComponent("");
pagerComponent.func_230530_a_(pagerComponent.getStyle().setFormatting(TextFormatting.GRAY));
pagerComponent.func_230529_a_(prevPageComponent); // appendSibling
pagerComponent.func_240702_b_(" | "); // appendText
pagerComponent.func_230529_a_(nextPageComponent);
pagerComponent.func_240702_b_(String.format(" %d/%d", page, getMaxPage()));
pagerComponent.setStyle(pagerComponent.getStyle().setFormatting(TextFormatting.GRAY));
pagerComponent.append(prevPageComponent);
pagerComponent.appendString(" | ");
pagerComponent.append(nextPageComponent);
pagerComponent.appendString(String.format(" %d/%d", page, getMaxPage()));
logDirect(pagerComponent);
}

View File

@ -52,14 +52,14 @@ public interface Helper {
final Calendar now = Calendar.getInstance();
final boolean xd = now.get(Calendar.MONTH) == Calendar.APRIL && now.get(Calendar.DAY_OF_MONTH) <= 3;
TextComponent baritone = new StringTextComponent(xd ? "Baritoe" : BaritoneAPI.getSettings().shortBaritonePrefix.value ? "B" : "Baritone");
baritone.func_230530_a_(baritone.getStyle().setFormatting(TextFormatting.LIGHT_PURPLE));
baritone.setStyle(baritone.getStyle().setFormatting(TextFormatting.LIGHT_PURPLE));
// Outer brackets
TextComponent prefix = new StringTextComponent("");
prefix.func_230530_a_(baritone.getStyle().setFormatting(TextFormatting.DARK_PURPLE));
prefix.func_240702_b_("[");
prefix.func_230529_a_(baritone);
prefix.func_240702_b_("]");
prefix.setStyle(baritone.getStyle().setFormatting(TextFormatting.DARK_PURPLE));
prefix.appendString("[");
prefix.append(baritone);
prefix.appendString("]");
return prefix;
}
@ -85,9 +85,9 @@ public interface Helper {
*/
default void logDirect(ITextComponent... components) {
TextComponent component = new StringTextComponent("");
component.func_230529_a_(getPrefix());
component.func_230529_a_(new StringTextComponent(" "));
Arrays.asList(components).forEach(component::func_230529_a_);
component.append(getPrefix());
component.append(new StringTextComponent(" "));
Arrays.asList(components).forEach(component::append);
mc.execute(() -> BaritoneAPI.getSettings().logger.value.accept(component));
}
@ -101,7 +101,7 @@ public interface Helper {
default void logDirect(String message, TextFormatting color) {
Stream.of(message.split("\n")).forEach(line -> {
TextComponent component = new StringTextComponent(line.replace("\t", " "));
component.func_230530_a_(component.getStyle().setFormatting(color));
component.setStyle(component.getStyle().setFormatting(color));
logDirect(component);
});
}

View File

@ -52,7 +52,7 @@ public class MixinCommandSuggestionHelper {
private List<String> field_228103_l_;
@Shadow
private CompletableFuture<Suggestions> field_228107_p_;
private CompletableFuture<Suggestions> suggestionsFuture;
@Inject(
method = "init",
@ -78,7 +78,7 @@ public class MixinCommandSuggestionHelper {
this.field_228103_l_.clear();
if (event.completions.length == 0) {
this.field_228107_p_ = Suggestions.empty();
this.suggestionsFuture = Suggestions.empty();
} else {
int offset = this.field_228095_d_.getText().endsWith(" ")
? this.field_228095_d_.getCursorPosition()
@ -92,8 +92,8 @@ public class MixinCommandSuggestionHelper {
StringRange.between(offset, offset + suggestionList.stream().mapToInt(s -> s.getText().length()).max().orElse(0)),
suggestionList);
this.field_228107_p_ = new CompletableFuture<>();
this.field_228107_p_.complete(suggestions);
this.suggestionsFuture = new CompletableFuture<>();
this.suggestionsFuture.complete(suggestions);
}
}
}

View File

@ -6,7 +6,7 @@
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
modLoader="javafml" #mandatory
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
loaderVersion="[31,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
loaderVersion="[32,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
# A URL to refer people to when problems occur with this mod
issueTrackerURL="https://github.com/cabaletta/baritone/issues" #optional
# A list of mods - how many allowed here is determined by the individual mod loader

View File

@ -22,7 +22,7 @@ import baritone.api.IBaritoneProvider;
import baritone.api.cache.IWorldScanner;
import baritone.api.command.ICommandSystem;
import baritone.api.schematic.ISchematicSystem;
import baritone.command.BaritoneChatControl;
import baritone.command.ExampleBaritoneControl;
import baritone.cache.WorldScanner;
import baritone.command.CommandSystem;
import baritone.utils.schematic.SchematicSystem;
@ -44,7 +44,7 @@ public final class BaritoneProvider implements IBaritoneProvider {
this.all = Collections.singletonList(this.primary);
// Setup chat control, just for the primary instance
new BaritoneChatControl(this.primary);
new ExampleBaritoneControl(this.primary);
}
@Override

View File

@ -380,7 +380,7 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
public BetterBlockPos pathStart() { // TODO move to a helper or util class
BetterBlockPos feet = ctx.playerFeet();
if (!MovementHelper.canWalkOn(ctx, feet.down())) {
if (ctx.player().func_233570_aj_()) {
if (ctx.player().isOnGround()) {
double playerX = ctx.player().getPositionVec().x;
double playerZ = ctx.player().getPositionVec().z;
ArrayList<BetterBlockPos> closest = new ArrayList<>();

View File

@ -49,12 +49,12 @@ import java.util.stream.Stream;
import static baritone.api.command.IBaritoneChatControl.FORCE_COMMAND_PREFIX;
public class BaritoneChatControl implements Helper, AbstractGameEventListener {
public class ExampleBaritoneControl implements Helper, AbstractGameEventListener {
private static final Settings settings = BaritoneAPI.getSettings();
private final ICommandManager manager;
public BaritoneChatControl(IBaritone baritone) {
public ExampleBaritoneControl(IBaritone baritone) {
this.manager = baritone.getCommandManager();
baritone.getGameEventHandler().registerEventListener(this);
}
@ -80,7 +80,7 @@ public class BaritoneChatControl implements Helper, AbstractGameEventListener {
String msg = command + rest;
String toDisplay = settings.censorRanCommands.value ? command + " ..." : msg;
TextComponent component = new StringTextComponent(String.format("> %s", toDisplay));
component.func_230530_a_(component.getStyle()
component.setStyle(component.getStyle()
.setFormatting(TextFormatting.WHITE)
.setHoverEvent(new HoverEvent(
HoverEvent.Action.SHOW_TEXT,

View File

@ -46,7 +46,7 @@ public class BuildCommand extends Command {
public void execute(String label, IArgConsumer args) throws CommandException {
File file = args.getDatatypePost(RelativeFile.INSTANCE, schematicsDir).getAbsoluteFile();
if (FilenameUtils.getExtension(file.getAbsolutePath()).isEmpty()) {
file = new File(file.getAbsolutePath() + "." + Baritone.settings().schematicFallbackExtension);
file = new File(file.getAbsolutePath() + "." + Baritone.settings().schematicFallbackExtension.value);
}
BetterBlockPos origin = ctx.playerFeet();
BetterBlockPos buildOrigin;

View File

@ -55,7 +55,7 @@ public class ChestsCommand extends Command {
logDirect(pos.toString());
for (ItemStack item : inv.getContents()) {
IFormattableTextComponent component = (IFormattableTextComponent) item.getTextComponent();
component.func_240702_b_(String.format(" x %d", item.getCount()));
component.appendString(String.format(" x %d", item.getCount()));
logDirect(component);
}
}

View File

@ -42,7 +42,7 @@ public class ComeCommand extends Command {
if (entity == null) {
throw new CommandInvalidStateException("render view entity is null");
}
baritone.getCustomGoalProcess().setGoalAndPath(new GoalBlock(entity.func_233580_cy_()));
baritone.getCustomGoalProcess().setGoalAndPath(new GoalBlock(entity.getPosition()));
logDirect("Coming");
}

View File

@ -59,19 +59,19 @@ public class HelpCommand extends Command {
String names = String.join("/", command.getNames());
String name = command.getNames().get(0);
TextComponent shortDescComponent = new StringTextComponent(" - " + command.getShortDesc());
shortDescComponent.func_230530_a_(shortDescComponent.getStyle().setFormatting(TextFormatting.DARK_GRAY));
shortDescComponent.setStyle(shortDescComponent.getStyle().setFormatting(TextFormatting.DARK_GRAY));
TextComponent namesComponent = new StringTextComponent(names);
namesComponent.func_230530_a_(namesComponent.getStyle().setFormatting(TextFormatting.WHITE));
namesComponent.setStyle(namesComponent.getStyle().setFormatting(TextFormatting.WHITE));
TextComponent hoverComponent = new StringTextComponent("");
hoverComponent.func_230530_a_(hoverComponent.getStyle().setFormatting(TextFormatting.GRAY));
hoverComponent.func_230529_a_(namesComponent);
hoverComponent.func_240702_b_("\n" + command.getShortDesc());
hoverComponent.func_240702_b_("\n\nClick to view full help");
hoverComponent.setStyle(hoverComponent.getStyle().setFormatting(TextFormatting.GRAY));
hoverComponent.append(namesComponent);
hoverComponent.appendString("\n" + command.getShortDesc());
hoverComponent.appendString("\n\nClick to view full help");
String clickCommand = FORCE_COMMAND_PREFIX + String.format("%s %s", label, command.getNames().get(0));
TextComponent component = new StringTextComponent(name);
component.func_230530_a_(component.getStyle().setFormatting(TextFormatting.GRAY));
component.func_230529_a_(shortDescComponent);
component.func_230530_a_(component.getStyle()
component.setStyle(component.getStyle().setFormatting(TextFormatting.GRAY));
component.append(shortDescComponent);
component.setStyle(component.getStyle()
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverComponent))
.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, clickCommand)));
return component;
@ -89,7 +89,7 @@ public class HelpCommand extends Command {
command.getLongDesc().forEach(this::logDirect);
logDirect("");
TextComponent returnComponent = new StringTextComponent("Click to return to the help menu");
returnComponent.func_230530_a_(returnComponent.getStyle().setClickEvent(new ClickEvent(
returnComponent.setStyle(returnComponent.getStyle().setClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,
FORCE_COMMAND_PREFIX + label
)));

View File

@ -83,7 +83,7 @@ public class SelCommand extends Command {
if (action == Action.POS2 && pos1 == null) {
throw new CommandInvalidStateException("Set pos1 first before using pos2");
}
BetterBlockPos playerPos = mc.getRenderViewEntity() != null ? BetterBlockPos.from(mc.getRenderViewEntity().func_233580_cy_()) : ctx.playerFeet();
BetterBlockPos playerPos = mc.getRenderViewEntity() != null ? BetterBlockPos.from(mc.getRenderViewEntity().getPosition()) : ctx.playerFeet();
BetterBlockPos pos = args.hasAny() ? args.getDatatypePost(RelativeBlockPos.INSTANCE, playerPos) : playerPos;
args.requireMax(0);
if (action == Action.POS1) {

View File

@ -82,17 +82,17 @@ public class SetCommand extends Command {
" (%s)",
settingTypeToString(setting)
));
typeComponent.func_230530_a_(typeComponent.getStyle().setFormatting(TextFormatting.DARK_GRAY));
typeComponent.setStyle(typeComponent.getStyle().setFormatting(TextFormatting.DARK_GRAY));
TextComponent hoverComponent = new StringTextComponent("");
hoverComponent.func_230530_a_(hoverComponent.getStyle().setFormatting(TextFormatting.GRAY));
hoverComponent.func_240702_b_(setting.getName());
hoverComponent.func_240702_b_(String.format("\nType: %s", settingTypeToString(setting)));
hoverComponent.func_240702_b_(String.format("\n\nValue:\n%s", settingValueToString(setting)));
hoverComponent.setStyle(hoverComponent.getStyle().setFormatting(TextFormatting.GRAY));
hoverComponent.appendString(setting.getName());
hoverComponent.appendString(String.format("\nType: %s", settingTypeToString(setting)));
hoverComponent.appendString(String.format("\n\nValue:\n%s", settingValueToString(setting)));
String commandSuggestion = Baritone.settings().prefix.value + String.format("set %s ", setting.getName());
TextComponent component = new StringTextComponent(setting.getName());
component.func_230530_a_(component.getStyle().setFormatting(TextFormatting.GRAY));
component.func_230529_a_(typeComponent);
component.func_230530_a_(component.getStyle()
component.setStyle(component.getStyle().setFormatting(TextFormatting.GRAY));
component.append(typeComponent);
component.setStyle(component.getStyle()
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverComponent))
.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, commandSuggestion)));
return component;
@ -164,7 +164,7 @@ public class SetCommand extends Command {
));
}
TextComponent oldValueComponent = new StringTextComponent(String.format("Old value: %s", oldValue));
oldValueComponent.func_230530_a_(oldValueComponent.getStyle()
oldValueComponent.setStyle(oldValueComponent.getStyle()
.setFormatting(TextFormatting.GRAY)
.setHoverEvent(new HoverEvent(
HoverEvent.Action.SHOW_TEXT,

View File

@ -61,16 +61,16 @@ public class WaypointsCommand extends Command {
BiFunction<IWaypoint, Action, ITextComponent> toComponent = (waypoint, _action) -> {
TextComponent component = new StringTextComponent("");
TextComponent tagComponent = new StringTextComponent(waypoint.getTag().name() + " ");
tagComponent.func_230530_a_(tagComponent.getStyle().setFormatting(TextFormatting.GRAY));
tagComponent.setStyle(tagComponent.getStyle().setFormatting(TextFormatting.GRAY));
String name = waypoint.getName();
TextComponent nameComponent = new StringTextComponent(!name.isEmpty() ? name : "<empty>");
nameComponent.func_230530_a_(nameComponent.getStyle().setFormatting(!name.isEmpty() ? TextFormatting.GRAY : TextFormatting.DARK_GRAY));
nameComponent.setStyle(nameComponent.getStyle().setFormatting(!name.isEmpty() ? TextFormatting.GRAY : TextFormatting.DARK_GRAY));
TextComponent timestamp = new StringTextComponent(" @ " + new Date(waypoint.getCreationTimestamp()));
timestamp.func_230530_a_(timestamp.getStyle().setFormatting(TextFormatting.DARK_GRAY));
component.func_230529_a_(tagComponent);
component.func_230529_a_(nameComponent);
component.func_230529_a_(timestamp);
component.func_230530_a_(component.getStyle()
timestamp.setStyle(timestamp.getStyle().setFormatting(TextFormatting.DARK_GRAY));
component.append(tagComponent);
component.append(nameComponent);
component.append(timestamp);
component.setStyle(component.getStyle()
.setHoverEvent(new HoverEvent(
HoverEvent.Action.SHOW_TEXT,
new StringTextComponent("Click to select")
@ -138,8 +138,8 @@ public class WaypointsCommand extends Command {
IWaypoint waypoint = new Waypoint(name, tag, pos);
ForWaypoints.waypoints(this.baritone).addWaypoint(waypoint);
TextComponent component = new StringTextComponent("Waypoint added: ");
component.func_230530_a_(component.getStyle().setFormatting(TextFormatting.GRAY));
component.func_230529_a_(toComponent.apply(waypoint, Action.INFO));
component.setStyle(component.getStyle().setFormatting(TextFormatting.GRAY));
component.append(toComponent.apply(waypoint, Action.INFO));
logDirect(component);
} else if (action == Action.CLEAR) {
args.requireMax(1);
@ -196,7 +196,7 @@ public class WaypointsCommand extends Command {
logDirect(transform.apply(waypoint));
logDirect(String.format("Position: %s", waypoint.getLocation()));
TextComponent deleteComponent = new StringTextComponent("Click to delete this waypoint");
deleteComponent.func_230530_a_(deleteComponent.getStyle().setClickEvent(new ClickEvent(
deleteComponent.setStyle(deleteComponent.getStyle().setClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,
String.format(
"%s%s delete %s @ %d",
@ -207,7 +207,7 @@ public class WaypointsCommand extends Command {
)
)));
TextComponent goalComponent = new StringTextComponent("Click to set goal to this waypoint");
goalComponent.func_230530_a_(goalComponent.getStyle().setClickEvent(new ClickEvent(
goalComponent.setStyle(goalComponent.getStyle().setClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,
String.format(
"%s%s goal %s @ %d",
@ -218,7 +218,7 @@ public class WaypointsCommand extends Command {
)
)));
TextComponent backComponent = new StringTextComponent("Click to return to the waypoints list");
backComponent.func_230530_a_(backComponent.getStyle().setClickEvent(new ClickEvent(
backComponent.setStyle(backComponent.getStyle().setClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,
String.format(
"%s%s list",

View File

@ -86,7 +86,7 @@ public class CalculationContext {
this.bsi = new BlockStateInterface(world, worldData, forUseOnAnotherThread);
this.toolSet = new ToolSet(player);
this.hasThrowaway = Baritone.settings().allowPlace.value && ((Baritone) baritone).getInventoryBehavior().hasGenericThrowaway();
this.hasWaterBucket = Baritone.settings().allowWaterBucketFall.value && PlayerInventory.isHotbar(player.inventory.getSlotFor(STACK_BUCKET_WATER)) && world.func_234922_V_() != DimensionType.field_236000_d_;
this.hasWaterBucket = Baritone.settings().allowWaterBucketFall.value && PlayerInventory.isHotbar(player.inventory.getSlotFor(STACK_BUCKET_WATER)) && world.func_234922_V_() != DimensionType.THE_NETHER;
this.canSprint = Baritone.settings().allowSprint.value && player.getFoodStats().getFoodLevel() > 6;
this.placeBlockCost = Baritone.settings().blockPlacementPenalty.value;
this.allowBreak = Baritone.settings().allowBreak.value;

View File

@ -97,11 +97,11 @@ public class MovementFall extends Movement {
Block destBlock = destState.getBlock();
boolean isWater = destState.getFluidState().getFluid() instanceof WaterFluid;
if (!isWater && willPlaceBucket() && !playerFeet.equals(dest)) {
if (!PlayerInventory.isHotbar(ctx.player().inventory.getSlotFor(STACK_BUCKET_WATER)) || ctx.world().func_234922_V_() == DimensionType.field_236000_d_) {
if (!PlayerInventory.isHotbar(ctx.player().inventory.getSlotFor(STACK_BUCKET_WATER)) || ctx.world().func_234922_V_() == DimensionType.THE_NETHER) {
return state.setStatus(MovementStatus.UNREACHABLE);
}
if (ctx.player().getPositionVec().y - dest.getY() < ctx.playerController().getBlockReachDistance() && !ctx.player().func_233570_aj_()) {
if (ctx.player().getPositionVec().y - dest.getY() < ctx.playerController().getBlockReachDistance() && !ctx.player().isOnGround()) {
ctx.player().inventory.currentItem = ctx.player().inventory.getSlotFor(STACK_BUCKET_WATER);
targetRotation = new Rotation(toDest.getYaw(), 90.0F);
@ -136,7 +136,7 @@ public class MovementFall extends Movement {
}
Vector3d destCenter = VecUtils.getBlockPosCenter(dest); // we are moving to the 0.5 center not the edge (like if we were falling on a ladder)
if (Math.abs(ctx.player().getPositionVec().x + ctx.player().getMotion().x - destCenter.x) > 0.1 || Math.abs(ctx.player().getPositionVec().z + ctx.player().getMotion().z - destCenter.z) > 0.1) {
if (!ctx.player().func_233570_aj_() && Math.abs(ctx.player().getMotion().y) > 0.4) {
if (!ctx.player().isOnGround() && Math.abs(ctx.player().getMotion().y) > 0.4) {
state.setInput(Input.SNEAK, true);
}
state.setInput(Input.MOVE_FORWARD, true);
@ -148,7 +148,7 @@ public class MovementFall extends Movement {
double dist = Math.abs(avoid.getX() * (destCenter.x - avoid.getX() / 2.0 - ctx.player().getPositionVec().x)) + Math.abs(avoid.getZ() * (destCenter.z - avoid.getZ() / 2.0 - ctx.player().getPositionVec().z));
if (dist < 0.6) {
state.setInput(Input.MOVE_FORWARD, true);
} else if (!ctx.player().func_233570_aj_()) {
} else if (!ctx.player().isOnGround()) {
state.setInput(Input.SNEAK, false);
}
}

View File

@ -251,7 +251,7 @@ public class MovementParkour extends Movement {
}
} else if (!ctx.playerFeet().equals(src)) {
if (ctx.playerFeet().equals(src.offset(direction)) || ctx.player().getPositionVec().y - src.y > 0.0001) {
if (!MovementHelper.canWalkOn(ctx, dest.down()) && !ctx.player().func_233570_aj_() && MovementHelper.attemptToPlaceABlock(state, baritone, dest.down(), true, false) == PlaceResult.READY_TO_PLACE) {
if (!MovementHelper.canWalkOn(ctx, dest.down()) && !ctx.player().isOnGround() && MovementHelper.attemptToPlaceABlock(state, baritone, dest.down(), true, false) == PlaceResult.READY_TO_PLACE) {
// go in the opposite order to check DOWN before all horizontals -- down is preferable because you don't have to look to the side while in midair, which could mess up the trajectory
state.setInput(Input.CLICK_RIGHT, true);
}

View File

@ -245,7 +245,7 @@ public class MovementTraverse extends Movement {
}
Block low = BlockStateInterface.get(ctx, src).getBlock();
Block high = BlockStateInterface.get(ctx, src.up()).getBlock();
if (ctx.player().getPositionVec().y > src.y + 0.1D && !ctx.player().func_233570_aj_() && (low == Blocks.VINE || low == Blocks.LADDER || high == Blocks.VINE || high == Blocks.LADDER)) {
if (ctx.player().getPositionVec().y > src.y + 0.1D && !ctx.player().isOnGround() && (low == Blocks.VINE || low == Blocks.LADDER || high == Blocks.VINE || high == Blocks.LADDER)) {
// hitting W could cause us to climb the ladder instead of going forward
// wait until we're on the ground
return state;

View File

@ -274,7 +274,7 @@ public class PathExecutor implements IPathExecutor, Helper {
if (!current.isPresent()) {
return false;
}
if (!ctx.player().func_233570_aj_()) {
if (!ctx.player().isOnGround()) {
return false;
}
if (!MovementHelper.canWalkOn(ctx, ctx.playerFeet().down())) {
@ -323,7 +323,7 @@ public class PathExecutor implements IPathExecutor, Helper {
* @return Whether or not it was possible to snap to the current player feet
*/
public boolean snipsnapifpossible() {
if (!ctx.player().func_233570_aj_() && ctx.world().getFluidState(ctx.playerFeet()).isEmpty()) {
if (!ctx.player().isOnGround() && ctx.world().getFluidState(ctx.playerFeet()).isEmpty()) {
// if we're falling in the air, and not in water, don't splice
return false;
} else {

View File

@ -103,7 +103,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
}
this.origin = new Vector3i(x, y, z);
this.paused = false;
this.layer = 0;
this.layer = Baritone.settings().startAtLayer.value;
this.numRepeats = 0;
this.observedCompleted = new LongOpenHashSet();
}
@ -438,7 +438,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
}
Optional<Tuple<BetterBlockPos, Rotation>> toBreak = toBreakNearPlayer(bcc);
if (toBreak.isPresent() && isSafeToCancel && ctx.player().func_233570_aj_()) {
if (toBreak.isPresent() && isSafeToCancel && ctx.player().isOnGround()) {
// we'd like to pause to break this block
// only change look direction if it's safe (don't want to fuck up an in progress parkour for example
Rotation rot = toBreak.get().getB();
@ -458,7 +458,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
}
List<BlockState> desirableOnHotbar = new ArrayList<>();
Optional<Placement> toPlace = searchForPlacables(bcc, desirableOnHotbar);
if (toPlace.isPresent() && isSafeToCancel && ctx.player().func_233570_aj_() && ticks <= 0) {
if (toPlace.isPresent() && isSafeToCancel && ctx.player().isOnGround() && ticks <= 0) {
Rotation rot = toPlace.get().rot;
baritone.getLookBehavior().updateTarget(rot, true);
ctx.player().inventory.currentItem = toPlace.get().hotbarSelection;
@ -523,7 +523,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
private void trim() {
HashSet<BetterBlockPos> copy = new HashSet<>(incorrectPositions);
copy.removeIf(pos -> pos.distanceSq(ctx.player().func_233580_cy_()) > 200);
copy.removeIf(pos -> pos.distanceSq(ctx.player().getPosition()) > 200);
if (!copy.isEmpty()) {
incorrectPositions = copy;
}
@ -761,7 +761,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
name = null;
schematic = null;
realSchematic = null;
layer = 0;
layer = Baritone.settings().startAtLayer.value;
numRepeats = 0;
paused = false;
observedCompleted = null;

View File

@ -278,7 +278,7 @@ public final class FarmProcess extends BaritoneProcessHelper implements IFarmPro
}
}
for (Entity entity : ctx.entities()) {
if (entity instanceof ItemEntity && entity.func_233570_aj_()) {
if (entity instanceof ItemEntity && entity.isOnGround()) {
ItemEntity ei = (ItemEntity) entity;
if (PICKUP_DROPPED.contains(ei.getItem().getItem())) {
// +0.1 because of farmland's 0.9375 dummy height lol

View File

@ -57,7 +57,7 @@ public final class FollowProcess extends BaritoneProcessHelper implements IFollo
private Goal towards(Entity following) {
BlockPos pos;
if (Baritone.settings().followOffsetDistance.value == 0) {
pos = following.func_233580_cy_();
pos = following.getPosition();
} else {
GoalXZ g = GoalXZ.fromDirection(following.getPositionVec(), Baritone.settings().followOffsetDirection.value, Baritone.settings().followOffsetDistance.value);
pos = new BlockPos(g.getX(), following.getPositionVec().y, g.getZ());

View File

@ -114,7 +114,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
.filter(pos -> !(BlockStateInterface.get(ctx, pos).getBlock() instanceof AirBlock)) // after breaking a block, it takes mineGoalUpdateInterval ticks for it to actually update this list =(
.min(Comparator.comparingDouble(ctx.playerFeet()::distanceSq));
baritone.getInputOverrideHandler().clearAllKeys();
if (shaft.isPresent() && ctx.player().func_233570_aj_()) {
if (shaft.isPresent() && ctx.player().isOnGround()) {
BlockPos pos = shaft.get();
BlockState state = baritone.bsi.get0(pos);
if (!MovementHelper.avoidBreaking(baritone.bsi, pos.getX(), pos.getY(), pos.getZ(), state)) {
@ -308,7 +308,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
if (entity instanceof ItemEntity) {
ItemEntity ei = (ItemEntity) entity;
if (filter.has(ei.getItem())) {
ret.add(entity.func_233580_cy_());
ret.add(entity.getPosition());
}
}
}
@ -399,7 +399,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
.filter(pos -> !blacklist.contains(pos))
.sorted(Comparator.comparingDouble(ctx.getBaritone().getPlayerContext().player().func_233580_cy_()::distanceSq))
.sorted(Comparator.comparingDouble(ctx.getBaritone().getPlayerContext().player().getPosition()::distanceSq))
.collect(Collectors.toList());
if (locs.size() > max) {

View File

@ -99,7 +99,7 @@ public class BaritoneAutoTest implements AbstractGameEventListener, Helper {
System.out.println("Beginning Baritone automatic test routine");
mc.displayGuiScreen(null);
WorldSettings worldsettings = new WorldSettings("BaritoneAutoTest", GameType.SURVIVAL, false, Difficulty.NORMAL, true, new GameRules(), DatapackCodec.field_234880_a_);
mc.func_238192_a_("BaritoneAutoTest", worldsettings, IDynamicRegistries.func_239770_b_(), DimensionGeneratorSettings.field_236202_b_.func_236220_a_(false, OptionalLong.of(TEST_SEED)));
mc.func_238192_a_("BaritoneAutoTest", worldsettings, IDynamicRegistries.func_239770_b_(), DimensionGeneratorSettings.field_236202_b_.create(false, OptionalLong.of(TEST_SEED)));
}
IntegratedServer server = mc.getIntegratedServer();

View File

@ -88,7 +88,7 @@ public class GuiClick extends Screen implements Helper {
BaritoneAPI.getProvider().getPrimaryBaritone().getSelectionManager().removeAllSelections();
BaritoneAPI.getProvider().getPrimaryBaritone().getSelectionManager().addSelection(BetterBlockPos.from(clickStart), BetterBlockPos.from(currentMouseOver));
TextComponent component = new StringTextComponent("Selection made! For usage: " + Baritone.settings().prefix.value + "help sel");
component.func_230530_a_(component.getStyle()
component.setStyle(component.getStyle()
.setFormatting(TextFormatting.WHITE)
.setClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,

View File

@ -29,7 +29,7 @@ public class PlayerMovementInput extends MovementInput {
}
@Override
public void func_225607_a_(boolean p_225607_1_) {
public void tickMovement(boolean p_225607_1_) {
this.moveStrafe = 0.0F;
this.moveForward = 0.0F;

View File

@ -77,7 +77,7 @@ public class Avoidance {
.filter(entity -> (!(entity instanceof SpiderEntity)) || ctx.player().getBrightness() < 0.5)
.filter(entity -> !(entity instanceof ZombifiedPiglinEntity) || ((ZombifiedPiglinEntity) entity).getRevengeTarget() != null)
.filter(entity -> !(entity instanceof EndermanEntity) || ((EndermanEntity) entity).isScreaming())
.forEach(entity -> res.add(new Avoidance(entity.func_233580_cy_(), mobCoeff, Baritone.settings().mobAvoidanceRadius.value)));
.forEach(entity -> res.add(new Avoidance(entity.getPosition(), mobCoeff, Baritone.settings().mobAvoidanceRadius.value)));
}
return res;
}