Un-scuff and add setting

This commit is contained in:
Brady 2023-06-14 16:32:56 -05:00
parent bde0c620ad
commit 91bf7d726b
No known key found for this signature in database
GPG Key ID: 73A788379A197567
4 changed files with 12 additions and 7 deletions

View File

@ -53,6 +53,7 @@ public final class Settings {
public final Setting<Double> elytraFireworkSpeed = new Setting<>(0.6);
public final Setting<Boolean> wasteFireworks = new Setting<>(false);
public final Setting<Boolean> renderRaytraces = new Setting<>(false);
public final Setting<Boolean> elytraFreeLook = new Setting<>(false);
/**
* Allow Baritone to break blocks

View File

@ -98,6 +98,8 @@ public class MixinMinecraft {
private void postUpdateEntities(CallbackInfo ci) {
IBaritone baritone = BaritoneAPI.getProvider().getBaritoneForPlayer(this.player);
if (baritone != null) {
// Intentionally call this after all entities have been updated. That way, any modification to rotations
// can be recognized by other entity code. (Fireworks and Pigs, for example)
baritone.getGameEventHandler().onPlayerUpdate(new PlayerUpdateEvent(EventState.POST));
}
}

View File

@ -48,7 +48,7 @@ public class Elytra extends Behavior implements Helper {
static {
try {
DataInputStream in = new DataInputStream(new FileInputStream(new File("/Users/leijurv/Dropbox/nether-pathfinder/build/test")));
DataInputStream in = new DataInputStream(new FileInputStream(new File("E:/Brady/Documents/Java/baritone/test")));
int count = in.readInt();
System.out.println("Count: " + count);
for (int i = 0; i < count; i++) {
@ -264,7 +264,6 @@ public class Elytra extends Behavior implements Helper {
}
if (requireClear ? isClear(start, dest) : clearView(start, dest)) {
Rotation rot = RotationUtils.calcRotationFromVec3d(start, dest, ctx.playerRotations());
// ctx.player().rotationYaw = rot.getYaw();
long a = System.currentTimeMillis();
Float pitch = solvePitch(dest.subtract(start), steps, relaxation == 2);
if (pitch == null) {
@ -272,7 +271,6 @@ public class Elytra extends Behavior implements Helper {
continue;
}
long b = System.currentTimeMillis();
// ctx.player().rotationPitch = pitch;
System.out.println("Solved pitch in " + (b - a) + " total time " + (b - t));
goingTo = i;
goal = path.get(i).add(0, dy, 0);

View File

@ -56,7 +56,7 @@ public final class LookBehavior extends Behavior implements ILookBehavior {
@Override
public void updateTarget(Rotation rotation, boolean blockInteract) {
this.target = new Target(rotation, blockInteract);
this.target = new Target(rotation, Target.Mode.resolve(ctx, blockInteract));
}
@Override
@ -186,9 +186,9 @@ public final class LookBehavior extends Behavior implements ILookBehavior {
public final Rotation rotation;
public final Mode mode;
public Target(Rotation rotation, boolean blockInteract) {
public Target(Rotation rotation, Mode mode) {
this.rotation = rotation;
this.mode = Mode.resolve(blockInteract);
this.mode = mode;
}
enum Mode {
@ -207,12 +207,16 @@ public final class LookBehavior extends Behavior implements ILookBehavior {
*/
NONE;
static Mode resolve(boolean blockInteract) {
static Mode resolve(IPlayerContext ctx, boolean blockInteract) {
final Settings settings = Baritone.settings();
final boolean antiCheat = settings.antiCheatCompatibility.value;
final boolean blockFreeLook = settings.blockFreeLook.value;
final boolean freeLook = settings.freeLook.value;
if (ctx.player().isElytraFlying()) {
return settings.elytraFreeLook.value ? SERVER : CLIENT;
}
if (!freeLook && !blockFreeLook) return CLIENT;
if (!blockFreeLook && blockInteract) return CLIENT;