This commit is contained in:
Sam Corbett 2020-09-08 17:48:45 +01:00
commit 80e4852f90
5 changed files with 32 additions and 23 deletions

View File

@ -43,7 +43,7 @@ For 1.15.2, [click here](https://www.youtube.com/watch?v=j1qKtCZFURM) and see de
This project is an updated version of [MineBot](https://github.com/leijurv/MineBot/), 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). 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).
Have committed at least once a day from Aug 1 2018 to Aug 1 2019. Have committed at least once a day from Aug 1, 2018, to Aug 1, 2019.
1Leijurv3DWTrGAfmmiTphjhXLvQiHg7K2 1Leijurv3DWTrGAfmmiTphjhXLvQiHg7K2
@ -71,7 +71,7 @@ The API is heavily documented, you can find the Javadocs for the latest release
Please note that usage of anything located outside of the ``baritone.api`` package is not supported by the API release Please note that usage of anything located outside of the ``baritone.api`` package is not supported by the API release
jar. jar.
Below is an example of basic usage for changing some settings, and then pathing to a X/Z goal. Below is an example of basic usage for changing some settings, and then pathing to an X/Z goal.
``` ```
BaritoneAPI.getSettings().allowSprint.value = true; BaritoneAPI.getSettings().allowSprint.value = true;
@ -84,7 +84,7 @@ BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAnd
## Can I use Baritone as a library in my custom utility client? ## Can I use Baritone as a library in my custom utility client?
That's what it's for, sure! (As long as usage is in compliance with the LGPL 3.0 License) That's what it's for, sure! (As long as usage complies with the LGPL 3.0 License)
## How is it so fast? ## How is it so fast?

View File

@ -64,7 +64,7 @@ public final class Settings {
/** /**
* Disable baritone's auto-tool at runtime, but still assume that another mod will provide auto tool functionality * Disable baritone's auto-tool at runtime, but still assume that another mod will provide auto tool functionality
* <p> * <p>
* Specifically, path calculation will still assume that an auto tool wil run at execution time, even though * Specifically, path calculation will still assume that an auto tool will run at execution time, even though
* Baritone itself will not do that. * Baritone itself will not do that.
*/ */
public final Setting<Boolean> assumeExternalAutoTool = new Setting<>(false); public final Setting<Boolean> assumeExternalAutoTool = new Setting<>(false);

View File

@ -75,7 +75,7 @@ public interface IBaritoneProcess {
* to start eating this tick. {@code PauseForAutoEatProcess} should only actually right click once onTick is called with * to start eating this tick. {@code PauseForAutoEatProcess} should only actually right click once onTick is called with
* {@code isSafeToCancel} true though. * {@code isSafeToCancel} true though.
* *
* @return Whethor or not if this control is temporary * @return Whether or not if this control is temporary
*/ */
boolean isTemporary(); boolean isTemporary();

View File

@ -97,17 +97,4 @@ public interface IPlayerContext {
default boolean isLookingAt(BlockPos pos) { default boolean isLookingAt(BlockPos pos) {
return getSelectedBlock().equals(Optional.of(pos)); return getSelectedBlock().equals(Optional.of(pos));
} }
/**
* Returns the entity that the crosshair is currently placed over. Updated once per tick.
*
* @return The entity
*/
default Optional<Entity> getSelectedEntity() {
RayTraceResult result = objectMouseOver();
if (result != null && result.typeOfHit == RayTraceResult.Type.ENTITY) {
return Optional.of(result.entityHit);
}
return Optional.empty();
}
} }

View File

@ -31,6 +31,7 @@ import baritone.utils.pathing.MutableMoveResult;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@ -58,11 +59,32 @@ public class MovementDiagonal extends Movement {
@Override @Override
protected boolean safeToCancel(MovementState state) { protected boolean safeToCancel(MovementState state) {
return ctx.playerFeet().equals(src) || (( //too simple. backfill does not work after cornering with this
MovementHelper.canWalkOn(ctx, new BlockPos(src.x, src.y - 1, dest.z)) //return MovementHelper.canWalkOn(ctx, ctx.playerFeet().down());
) && EntityPlayerSP player = ctx.player();
MovementHelper.canWalkOn(ctx, new BlockPos(dest.x, src.y - 1, src.z))); double offset = 0.25;
} double x = player.posX;
double y = player.posY - 1;
double z = player.posZ;
//standard
if (ctx.playerFeet().equals(src)){
return true;
}
//both corners are walkable
if (MovementHelper.canWalkOn(ctx, new BlockPos(src.x, src.y - 1, dest.z))
&& MovementHelper.canWalkOn(ctx, new BlockPos(dest.x, src.y - 1, src.z))){
return true;
}
//we are in a likely unwalkable corner, check for a supporting block
if (ctx.playerFeet().equals(new BetterBlockPos(src.x, src.y, dest.z))
|| ctx.playerFeet().equals(new BetterBlockPos(dest.x, src.y, src.z))){
return (MovementHelper.canWalkOn(ctx, new BetterBlockPos(x + offset, y, z + offset))
|| MovementHelper.canWalkOn(ctx, new BetterBlockPos(x + offset, y, z - offset))
|| MovementHelper.canWalkOn(ctx, new BetterBlockPos(x - offset, y, z + offset))
|| MovementHelper.canWalkOn(ctx, new BetterBlockPos(x - offset, y, z - offset)));
}
return true;
}
@Override @Override
public double calculateCost(CalculationContext context) { public double calculateCost(CalculationContext context) {