Fix enough to compile

This commit is contained in:
Howard Stark 2018-08-04 18:17:53 -04:00
parent d061f759b5
commit 1bc2e6fe7a
No known key found for this signature in database
GPG Key ID: 9FA4E350B33067F3
3 changed files with 29 additions and 19 deletions

View File

@ -2,5 +2,5 @@ package baritone.bot.behavior.impl;
import baritone.bot.behavior.Behavior;
public class MovementBehavior extends Behavior {
public class LookBehavior extends Behavior {
}

View File

@ -2,6 +2,7 @@ package baritone.bot.pathing.movement;
import baritone.bot.Baritone;
import baritone.bot.pathing.movement.MovementState.MovementStatus;
import baritone.bot.utils.BlockStateInterface;
import baritone.bot.utils.Helper;
import baritone.bot.utils.ToolSet;
import baritone.bot.utils.Utils;
@ -13,7 +14,7 @@ import java.util.Optional;
public abstract class Movement implements IMovement, Helper, MovementHelper {
protected MovementState currentState = new MovementState().setStatus(MovementStatus.PREPPING);
private MovementState currentState = new MovementState().setStatus(MovementStatus.PREPPING);
protected final BlockPos src;
protected final BlockPos dest;
@ -45,17 +46,17 @@ public abstract class Movement implements IMovement, Helper, MovementHelper {
public abstract double calculateCost(ToolSet ts); // TODO pass in information like whether it's allowed to place throwaway blocks
public MovementStatus update() {
if(isPrepared(state)) {
if (!currentState.isPresent()) {
currentState = Optional.of(new MovementState()
.setStatus(MovementStatus.WAITING)
.setGoal());
}
}
// if(isPrepared(state)) {
// if (!currentState.isPresent()) {
// currentState = Optional.of(new MovementState()
// .setStatus(MovementStatus.WAITING)
// .setGoal());
// }
// }
if(isFinished()) {
}
MovementState latestState = updateState();
MovementState latestState = updateState(currentState);
Tuple<Float, Float> rotation = Utils.calcRotationFromVec3d(mc.player.getPositionEyes(1.0F),
latestState.getGoal().rotation);
mc.player.setPositionAndRotation(mc.player.posX, mc.player.posY, mc.player.posZ,
@ -68,15 +69,22 @@ public abstract class Movement implements IMovement, Helper, MovementHelper {
if (isFinished())
onFinish();
return;
return currentState.getStatus();
}
private boolean prepare(MovementState state) {
if(state.getStatus() == MovementStatus.WAITING) {
return true;
}
Optional<BlockPos> cruftPos;
for(BlockPos blockPos : positionsToBreak) {
world().getBlockState(blockPos).getBlock()(world())
if(MovementHelper.canWalkThrough(blockPos, BlockStateInterface.get(blockPos))) {
}
}
return true;
}
public boolean isFinished() {
return (currentState.getStatus() != MovementStatus.RUNNING

View File

@ -73,6 +73,7 @@ public interface MovementHelper extends ActionCosts, Helper {
Block b = BlockStateInterface.get(pos).getBlock();
Block below = BlockStateInterface.get(new BlockPos(pos.getX(), pos.getY() - 1, pos.getZ())).getBlock();
return Blocks.ICE.equals(b) // ice becomes water, and water can mess up the path
|| b instanceof BlockSilverfish
|| isLiquid(new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ()))//don't break anything touching liquid on any side
|| isLiquid(new BlockPos(pos.getX() + 1, pos.getY(), pos.getZ()))
|| isLiquid(new BlockPos(pos.getX() - 1, pos.getY(), pos.getZ()))
@ -89,22 +90,23 @@ public interface MovementHelper extends ActionCosts, Helper {
*/
static boolean canWalkThrough(BlockPos pos, IBlockState state) {
Block block = state.getBlock();
if (block instanceof BlockLilyPad || block instanceof BlockFire) {//you can't actually walk through a lilypad from the side, and you shouldn't walk through fire
if (block instanceof BlockLilyPad
|| block instanceof BlockFire
|| block instanceof BlockTripWire) {//you can't actually walk through a lilypad from the side, and you shouldn't walk through fire
return false;
}
if (isFlowing(state)) {
if (isFlowing(state) || isLiquid(pos.up())) {
return false; // Don't walk through flowing liquids
}
if (isLiquid(pos.up())) {
return false; // You could drown
}
return block.isPassable(Minecraft.getMinecraft().world, pos);
}
static boolean avoidWalkingInto(Block block) {
return isLava(block)
|| block instanceof BlockCactus
|| block instanceof BlockFire;
|| block instanceof BlockFire
|| block instanceof BlockEndPortal
|| block instanceof BlockWeb;
}
/**
@ -122,7 +124,7 @@ public interface MovementHelper extends ActionCosts, Helper {
return true;
}
if (isWater(block)) {
return isWater(pos.up());//you can only walk on water if there is water above it
return isWater(pos.up()); // You can only walk on water if there is water above it
}
return state.isBlockNormalCube() && !isLava(block);
}