Merge branch 'master' into builder

This commit is contained in:
Leijurv 2019-02-19 22:33:19 -08:00
commit 3e94d92fbd
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
16 changed files with 50 additions and 24 deletions

View File

@ -16,7 +16,7 @@
*/
group 'baritone'
version '1.1.5'
version '1.1.6'
buildscript {
repositories {

View File

@ -14,6 +14,7 @@
# lwjgl is weird
-dontwarn org.lwjgl.opengl.GL14
-dontwarn org.lwjgl.opengl.GL11
-keep class baritone.api.** { *; } # this is the keep api
@ -21,9 +22,6 @@
-keep class baritone.BaritoneProvider
-keep class baritone.api.IBaritoneProvider
# hack
-keep class baritone.utils.ExampleBaritoneControl { *; } # have to include this string to remove this keep in the standalone build: # this is the keep api
# setting names are reflected from field names, so keep field names
-keepclassmembers class baritone.api.Settings {
public <fields>;

View File

@ -79,4 +79,11 @@ public interface IBaritone {
IPlayerContext getPlayerContext();
IEventBus getGameEventHandler();
/**
* Call as soon as Minecraft is ready.
* <p>
* Or whenever your overeager utility client wants.
*/
void init();
}

View File

@ -500,18 +500,18 @@ public final class Settings {
* <p>
* SOLID is rendered as stone in the overworld, netherrack in the nether, and end stone in the end
*/
public Setting<Boolean> renderCachedChunks = new Setting<>(false);
public final Setting<Boolean> renderCachedChunks = new Setting<>(false);
/**
* 0.0f = not visible, fully transparent
* 1.0f = fully opaque
*/
public Setting<Float> cachedChunksOpacity = new Setting<>(0.5f);
public final Setting<Float> cachedChunksOpacity = new Setting<>(0.5f);
/**
* If true, Baritone will not allow you to left or right click while pathing
*/
public Setting<Boolean> suppressClicks = new Setting<>(false);
public final Setting<Boolean> suppressClicks = new Setting<>(false);
/**
* Whether or not to use the "#" command prefix

View File

@ -91,6 +91,7 @@ public class Baritone implements IBaritone {
this.gameEventHandler = new GameEventHandler(this);
}
@Override
public synchronized void init() {
if (initialized) {
return;

View File

@ -103,7 +103,7 @@ public final class LookBehavior extends Behavior implements ILookBehavior {
@Override
public void onPlayerRotationMove(RotationMoveEvent event) {
if (this.target != null && !this.force) {
if (this.target != null) {
event.setYaw(this.target.getYaw());

View File

@ -45,7 +45,7 @@ public final class CachedWorld implements ICachedWorld, Helper {
/**
* The maximum number of regions in any direction from (0,0)
*/
private static final int REGION_MAX = 58594;
private static final int REGION_MAX = 30_000_000 / 512 + 1;
/**
* A map of all of the cached regions.

View File

@ -180,14 +180,21 @@ public class MovementAscend extends Movement {
return state;
}
if (headBonkClear()) {
return state.setInput(Input.JUMP, true);
}
int xAxis = Math.abs(src.getX() - dest.getX()); // either 0 or 1
int zAxis = Math.abs(src.getZ() - dest.getZ()); // either 0 or 1
double flatDistToNext = xAxis * Math.abs((dest.getX() + 0.5D) - ctx.player().posX) + zAxis * Math.abs((dest.getZ() + 0.5D) - ctx.player().posZ);
double sideDist = zAxis * Math.abs((dest.getX() + 0.5D) - ctx.player().posX) + xAxis * Math.abs((dest.getZ() + 0.5D) - ctx.player().posZ);
double lateralMotion = xAxis * ctx.player().motionZ + zAxis * ctx.player().motionX;
if (Math.abs(lateralMotion) > 0.1) {
return state;
}
if (headBonkClear()) {
return state.setInput(Input.JUMP, true);
}
// System.out.println(flatDistToNext + " " + sideDist);
if (flatDistToNext > 1.2 || sideDist > 0.2) {
return state;

View File

@ -78,7 +78,7 @@ public class MovementFall extends Movement {
}
BlockPos playerFeet = ctx.playerFeet();
Rotation toDest = RotationUtils.calcRotationFromVec3d(ctx.playerHead(), VecUtils.getBlockPosCenter(dest),ctx.playerRotations());
Rotation toDest = RotationUtils.calcRotationFromVec3d(ctx.playerHead(), VecUtils.getBlockPosCenter(dest), ctx.playerRotations());
Rotation targetRotation = null;
Block destBlock = ctx.world().getBlockState(dest).getBlock();
boolean isWater = destBlock == Blocks.WATER || destBlock == Blocks.FLOWING_WATER;
@ -141,7 +141,7 @@ public class MovementFall extends Movement {
}
if (targetRotation == null) {
Vec3d destCenterOffset = new Vec3d(destCenter.x + 0.125 * avoid.getX(), destCenter.y, destCenter.z + 0.125 * avoid.getZ());
state.setTarget(new MovementTarget(RotationUtils.calcRotationFromVec3d(ctx.playerHead(), destCenterOffset,ctx.playerRotations()), false));
state.setTarget(new MovementTarget(RotationUtils.calcRotationFromVec3d(ctx.playerHead(), destCenterOffset, ctx.playerRotations()), false));
}
return state;
}

View File

@ -160,7 +160,7 @@ public class MovementPillar extends Movement {
IBlockState fromDown = BlockStateInterface.get(ctx, src);
if (MovementHelper.isWater(fromDown.getBlock()) && MovementHelper.isWater(ctx, dest)) {
// stay centered while swimming up a water column
state.setTarget(new MovementState.MovementTarget(RotationUtils.calcRotationFromVec3d(ctx.playerHead(), VecUtils.getBlockPosCenter(dest),ctx.playerRotations()), false));
state.setTarget(new MovementState.MovementTarget(RotationUtils.calcRotationFromVec3d(ctx.playerHead(), VecUtils.getBlockPosCenter(dest), ctx.playerRotations()), false));
Vec3d destCenter = VecUtils.getBlockPosCenter(dest);
if (Math.abs(ctx.player().posX - destCenter.x) > 0.2 || Math.abs(ctx.player().posZ - destCenter.z) > 0.2) {
state.setInput(Input.MOVE_FORWARD, true);

View File

@ -179,7 +179,7 @@ public class MovementTraverse extends Movement {
float pitchToBreak = state.getTarget().getRotation().get().getPitch();
state.setTarget(new MovementState.MovementTarget(new Rotation(yawToDest, pitchToBreak), true));
return state.setInput(Input.MOVE_FORWARD, true);
return state.setInput(Input.MOVE_FORWARD, true).setInput(Input.SPRINT, true);
}
//sneak may have been set to true in the PREPPING state while mining an adjacent block

View File

@ -479,6 +479,9 @@ public class PathExecutor implements IPathExecutor, Helper {
if (dir.getY() < -3) {
return null;
}
if (!movement.toBreakCached.isEmpty()) {
return null; // it's breaking
}
Vec3i flatDir = new Vec3i(dir.getX(), 0, dir.getZ());
int i;
outer:
@ -538,6 +541,12 @@ public class PathExecutor implements IPathExecutor, Helper {
if (!MovementHelper.canWalkOn(ctx, current.getDest().down())) {
return false;
}
if (!MovementHelper.canWalkOn(ctx, next.getDest().down())) {
return false;
}
if (!next.toBreakCached.isEmpty()) {
return false; // it's breaking
}
for (int x = 0; x < 2; x++) {
for (int y = 0; y < 3; y++) {
BlockPos chk = current.getSrc().up(y);

View File

@ -78,7 +78,8 @@ public class ExampleBaritoneControl extends Behavior implements Helper {
"sethome - Sets \"home\"\n" +
"home - Paths towards \"home\" \n" +
"costs - (debug) all movement costs from current location\n" +
"damn - Daniel ";
"damn - Daniel\n" +
"Go to https://github.com/cabaletta/baritone/blob/master/USAGE.md for more information";
private static final String COMMAND_PREFIX = "#";

View File

@ -57,8 +57,6 @@ public final class PathRenderer implements Helper {
private PathRenderer() {}
public static void render(RenderEvent event, PathingBehavior behavior) {
// System.out.println("Render passing");
// System.out.println(event.getPartialTicks());
float partialTicks = event.getPartialTicks();
Goal goal = behavior.getGoal();
@ -80,7 +78,7 @@ public final class PathRenderer implements Helper {
}
if (goal != null && Baritone.settings().renderGoal.value) {
drawLitDankGoalBox(renderView, goal, partialTicks, Baritone.settings().colorGoalBox.get());
drawDankLitGoalBox(renderView, goal, partialTicks, Baritone.settings().colorGoalBox.get());
}
if (!Baritone.settings().renderPath.get()) {
return;
@ -261,7 +259,7 @@ public final class PathRenderer implements Helper {
GlStateManager.disableBlend();
}
public static void drawLitDankGoalBox(Entity player, Goal goal, float partialTicks, Color color) {
public static void drawDankLitGoalBox(Entity player, Goal goal, float partialTicks, Color color) {
double renderPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) partialTicks;
double renderPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) partialTicks;
double renderPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) partialTicks;
@ -297,6 +295,8 @@ public final class PathRenderer implements Helper {
GoalXZ goalPos = (GoalXZ) goal;
if (Baritone.settings().renderGoalXZBeacon.get()) {
glPushAttrib(GL_LIGHTING_BIT);
mc.getTextureManager().bindTexture(TileEntityBeaconRenderer.TEXTURE_BEACON_BEAM);
if (Baritone.settings().renderGoalIgnoreDepth.get()) {
@ -318,6 +318,8 @@ public final class PathRenderer implements Helper {
if (Baritone.settings().renderGoalIgnoreDepth.get()) {
GlStateManager.enableDepth();
}
glPopAttrib();
return;
}
@ -332,7 +334,7 @@ public final class PathRenderer implements Helper {
maxY = 256 - renderPosY;
} else if (goal instanceof GoalComposite) {
for (Goal g : ((GoalComposite) goal).goals()) {
drawLitDankGoalBox(player, g, partialTicks, color);
drawDankLitGoalBox(player, g, partialTicks, color);
}
return;
} else {

View File

@ -82,6 +82,7 @@ public class PathingControlManager implements IPathingControlManager {
public void preTick() {
inControlLastTick = inControlThisTick;
inControlThisTick = null;
PathingBehavior p = baritone.getPathingBehavior();
command = executeProcesses();
if (command == null) {

View File

@ -31,7 +31,7 @@ public class PlayerMovementInput extends MovementInput {
this.moveStrafe = 0.0F;
this.moveForward = 0.0F;
jump = handler.isInputForcedDown(Input.JUMP); // oppa
jump = handler.isInputForcedDown(Input.JUMP); // oppa gangnam
if (this.forwardKeyDown = handler.isInputForcedDown(Input.MOVE_FORWARD)) {
this.moveForward++;