Compare commits

...

2 Commits

8 changed files with 18 additions and 9 deletions

View File

@ -707,7 +707,7 @@ public final class Settings {
/** /**
* Move without having to force the client-sided rotations * Move without having to force the client-sided rotations
*/ */
public final Setting<Boolean> freeLook = new Setting<>(true); public final Setting<Boolean> freeLook = new Setting<>(false);
/** /**
* Will cause some minor behavioral differences to ensure that Baritone works on anticheats. * Will cause some minor behavioral differences to ensure that Baritone works on anticheats.

View File

@ -159,7 +159,7 @@ public class SettingsUtil {
public static String maybeCensor(int coord) { public static String maybeCensor(int coord) {
if (BaritoneAPI.getSettings().censorCoordinates.value) { if (BaritoneAPI.getSettings().censorCoordinates.value) {
return "<censored>"; return "####";
} }
return Integer.toString(coord); return Integer.toString(coord);

View File

@ -57,6 +57,7 @@ public final class LookBehavior extends Behavior implements ILookBehavior {
this.force = force || !Baritone.settings().freeLook.value; this.force = force || !Baritone.settings().freeLook.value;
} }
// TODO: for some reason with freecam on this breaks
@Override @Override
public void onPlayerUpdate(PlayerUpdateEvent event) { public void onPlayerUpdate(PlayerUpdateEvent event) {
if (this.target == null) { if (this.target == null) {
@ -78,10 +79,13 @@ public final class LookBehavior extends Behavior implements ILookBehavior {
this.target = null; this.target = null;
} }
if (silent) { if (silent) {
this.lastYaw = ctx.player().rotationYaw; this.lastYaw = ctx.player().rotationYaw;
ctx.player().rotationPitch = this.target.getPitch();
ctx.player().rotationYaw = this.target.getYaw(); ctx.player().rotationYaw = this.target.getYaw();
} }
break; break;
} }
case POST: { case POST: {
@ -116,6 +120,11 @@ public final class LookBehavior extends Behavior implements ILookBehavior {
} }
} }
/**
* Smoothly pans to desired rotation
* @param desiredYaw
* @param desiredPitch
*/
private void lookTo(float desiredYaw, float desiredPitch) { private void lookTo(float desiredYaw, float desiredPitch) {
if (desiredPitch == ctx.player().rotationPitch) { if (desiredPitch == ctx.player().rotationPitch) {
desiredPitch = 0; desiredPitch = 0;

View File

@ -46,7 +46,7 @@ public class WorldData implements IWorldData {
public void onClose() { public void onClose() {
Baritone.getExecutor().execute(() -> { Baritone.getExecutor().execute(() -> {
System.out.println("Started saving the world in a new thread"); System.out.println("Baritone: Started saving the world in a new thread");
cache.save(); cache.save();
}); });
} }

View File

@ -100,7 +100,7 @@ public class WorldProvider implements IWorldProvider, Helper {
// lol wtf is this baritone folder in my minecraft save? // lol wtf is this baritone folder in my minecraft save?
try (FileOutputStream out = new FileOutputStream(new File(readme, "readme.txt"))) { try (FileOutputStream out = new FileOutputStream(new File(readme, "readme.txt"))) {
// good thing we have a readme // good thing we have a readme
out.write("https://github.com/cabaletta/baritone\n".getBytes()); out.write("This folder is used for chunk caching and waypoints\n\nhttps://git.psf.lt/0xf8/baritone\n".getBytes());
} catch (IOException ignored) {} } catch (IOException ignored) {}
// We will actually store the world data in a subfolder: "DIM<id>" // We will actually store the world data in a subfolder: "DIM<id>"

View File

@ -44,7 +44,7 @@ public class LitematicaCommand extends Command {
try { try {
baritone.getBuilderProcess().buildOpenLitematic(schematic); baritone.getBuilderProcess().buildOpenLitematic(schematic);
} catch (IndexOutOfBoundsException e) { } catch (IndexOutOfBoundsException e) {
logDirect("Pleas provide a valid index."); logDirect("Please provide a valid index.");
} }
} }

View File

@ -26,9 +26,7 @@ import baritone.api.command.Command;
import baritone.api.command.argument.IArgConsumer; import baritone.api.command.argument.IArgConsumer;
import baritone.api.command.datatypes.ForWaypoints; import baritone.api.command.datatypes.ForWaypoints;
import baritone.api.command.datatypes.RelativeBlockPos; import baritone.api.command.datatypes.RelativeBlockPos;
import baritone.api.command.exception.CommandException; import baritone.api.command.exception.*;
import baritone.api.command.exception.CommandInvalidStateException;
import baritone.api.command.exception.CommandInvalidTypeException;
import baritone.api.command.helpers.Paginator; import baritone.api.command.helpers.Paginator;
import baritone.api.command.helpers.TabCompleteHelper; import baritone.api.command.helpers.TabCompleteHelper;
import baritone.api.pathing.goals.Goal; import baritone.api.pathing.goals.Goal;
@ -151,9 +149,11 @@ public class WaypointsCommand extends Command {
args.requireMax(1); args.requireMax(1);
IWaypoint.Tag tag = IWaypoint.Tag.getByName(args.getString()); IWaypoint.Tag tag = IWaypoint.Tag.getByName(args.getString());
IWaypoint[] waypoints = ForWaypoints.getWaypointsByTag(this.baritone, tag); IWaypoint[] waypoints = ForWaypoints.getWaypointsByTag(this.baritone, tag);
for (IWaypoint waypoint : waypoints) { for (IWaypoint waypoint : waypoints) {
ForWaypoints.waypoints(this.baritone).removeWaypoint(waypoint); ForWaypoints.waypoints(this.baritone).removeWaypoint(waypoint);
} }
deletedWaypoints.computeIfAbsent(baritone.getWorldProvider().getCurrentWorld(), k -> new ArrayList<>()).addAll(Arrays.<IWaypoint>asList(waypoints)); deletedWaypoints.computeIfAbsent(baritone.getWorldProvider().getCurrentWorld(), k -> new ArrayList<>()).addAll(Arrays.<IWaypoint>asList(waypoints));
ITextComponent textComponent = new TextComponentString(String.format("Cleared %d waypoints, click to restore them", waypoints.length)); ITextComponent textComponent = new TextComponentString(String.format("Cleared %d waypoints, click to restore them", waypoints.length));
textComponent.getStyle().setClickEvent(new ClickEvent( textComponent.getStyle().setClickEvent(new ClickEvent(

View File

@ -290,7 +290,7 @@ public class MovementTraverse extends Movement {
} }
double dist1 = Math.max(Math.abs(ctx.player().posX - (dest.getX() + 0.5D)), Math.abs(ctx.player().posZ - (dest.getZ() + 0.5D))); double dist1 = Math.max(Math.abs(ctx.player().posX - (dest.getX() + 0.5D)), Math.abs(ctx.player().posZ - (dest.getZ() + 0.5D)));
PlaceResult p = MovementHelper.attemptToPlaceABlock(state, baritone, dest.down(), false, true); PlaceResult p = MovementHelper.attemptToPlaceABlock(state, baritone, dest.down(), false, true);
if ((p == PlaceResult.READY_TO_PLACE || dist1 < 0.6) && !Baritone.settings().assumeSafeWalk.value) { if ((p == PlaceResult.READY_TO_PLACE || dist1 < 0.45) && !Baritone.settings().assumeSafeWalk.value) {
state.setInput(Input.SNEAK, true); state.setInput(Input.SNEAK, true);
} }
switch (p) { switch (p) {