Merge branch 'master' into builder

This commit is contained in:
Leijurv
2019-02-19 22:33:19 -08:00
16 changed files with 50 additions and 24 deletions

View File

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

View File

@@ -14,6 +14,7 @@
# lwjgl is weird # lwjgl is weird
-dontwarn org.lwjgl.opengl.GL14 -dontwarn org.lwjgl.opengl.GL14
-dontwarn org.lwjgl.opengl.GL11
-keep class baritone.api.** { *; } # this is the keep api -keep class baritone.api.** { *; } # this is the keep api
@@ -21,9 +22,6 @@
-keep class baritone.BaritoneProvider -keep class baritone.BaritoneProvider
-keep class baritone.api.IBaritoneProvider -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 # setting names are reflected from field names, so keep field names
-keepclassmembers class baritone.api.Settings { -keepclassmembers class baritone.api.Settings {
public <fields>; public <fields>;

View File

@@ -79,4 +79,11 @@ public interface IBaritone {
IPlayerContext getPlayerContext(); IPlayerContext getPlayerContext();
IEventBus getGameEventHandler(); 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> * <p>
* SOLID is rendered as stone in the overworld, netherrack in the nether, and end stone in the end * 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 * 0.0f = not visible, fully transparent
* 1.0f = fully opaque * 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 * 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 * Whether or not to use the "#" command prefix

View File

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

View File

@@ -103,7 +103,7 @@ public final class LookBehavior extends Behavior implements ILookBehavior {
@Override @Override
public void onPlayerRotationMove(RotationMoveEvent event) { public void onPlayerRotationMove(RotationMoveEvent event) {
if (this.target != null && !this.force) { if (this.target != null) {
event.setYaw(this.target.getYaw()); 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) * 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. * A map of all of the cached regions.

View File

@@ -180,14 +180,21 @@ public class MovementAscend extends Movement {
return state; return state;
} }
if (headBonkClear()) {
return state.setInput(Input.JUMP, true);
}
int xAxis = Math.abs(src.getX() - dest.getX()); // either 0 or 1 int xAxis = Math.abs(src.getX() - dest.getX()); // either 0 or 1
int zAxis = Math.abs(src.getZ() - dest.getZ()); // 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 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 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); // System.out.println(flatDistToNext + " " + sideDist);
if (flatDistToNext > 1.2 || sideDist > 0.2) { if (flatDistToNext > 1.2 || sideDist > 0.2) {
return state; return state;

View File

@@ -179,7 +179,7 @@ public class MovementTraverse extends Movement {
float pitchToBreak = state.getTarget().getRotation().get().getPitch(); float pitchToBreak = state.getTarget().getRotation().get().getPitch();
state.setTarget(new MovementState.MovementTarget(new Rotation(yawToDest, pitchToBreak), true)); 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 //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) { if (dir.getY() < -3) {
return null; return null;
} }
if (!movement.toBreakCached.isEmpty()) {
return null; // it's breaking
}
Vec3i flatDir = new Vec3i(dir.getX(), 0, dir.getZ()); Vec3i flatDir = new Vec3i(dir.getX(), 0, dir.getZ());
int i; int i;
outer: outer:
@@ -538,6 +541,12 @@ public class PathExecutor implements IPathExecutor, Helper {
if (!MovementHelper.canWalkOn(ctx, current.getDest().down())) { if (!MovementHelper.canWalkOn(ctx, current.getDest().down())) {
return false; 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 x = 0; x < 2; x++) {
for (int y = 0; y < 3; y++) { for (int y = 0; y < 3; y++) {
BlockPos chk = current.getSrc().up(y); BlockPos chk = current.getSrc().up(y);

View File

@@ -78,7 +78,8 @@ public class ExampleBaritoneControl extends Behavior implements Helper {
"sethome - Sets \"home\"\n" + "sethome - Sets \"home\"\n" +
"home - Paths towards \"home\" \n" + "home - Paths towards \"home\" \n" +
"costs - (debug) all movement costs from current location\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 = "#"; private static final String COMMAND_PREFIX = "#";

View File

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

View File

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

View File

@@ -31,7 +31,7 @@ public class PlayerMovementInput extends MovementInput {
this.moveStrafe = 0.0F; this.moveStrafe = 0.0F;
this.moveForward = 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)) { if (this.forwardKeyDown = handler.isInputForcedDown(Input.MOVE_FORWARD)) {
this.moveForward++; this.moveForward++;