break and place
This commit is contained in:
parent
71d4379316
commit
1f9dadce39
@ -1,10 +1,11 @@
|
||||
package baritone.bot.pathing.calc;
|
||||
|
||||
import baritone.bot.pathing.movement.Movement;
|
||||
import baritone.bot.pathing.goals.Goal;
|
||||
import baritone.bot.pathing.movement.Movement;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* A node based implementation of IPath
|
||||
@ -87,11 +88,11 @@ class Path implements IPath {
|
||||
|
||||
@Override
|
||||
public Collection<BlockPos> getBlocksToMine() {
|
||||
return null;
|
||||
return movements.stream().map(move -> move.positionsToBreak).flatMap(Arrays::stream).collect(Collectors.toCollection(HashSet::new));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<BlockPos> getBlocksToPlace() {
|
||||
return null;
|
||||
return movements.stream().map(move -> move.positionsToPlace).flatMap(Arrays::stream).collect(Collectors.toCollection(HashSet::new));
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,10 @@ public interface ActionCosts {
|
||||
double LADDER_DOWN_ONE_COST = 20 / 3;
|
||||
double SNEAK_ONE_BLOCK_COST = 20 / 1.3;
|
||||
double SPRINT_ONE_BLOCK_COST = 20 / 5.612;
|
||||
/**
|
||||
* To walk off an edge you need to walk 0.5 to the edge then 0.3 to start falling off
|
||||
*/
|
||||
double WALK_OFF_BLOCK_COST = WALK_ONE_BLOCK_COST * 0.8;
|
||||
|
||||
/**
|
||||
* Doesn't include walking forwards, just the falling
|
||||
|
@ -17,14 +17,25 @@ public abstract class Movement implements AbstractGameEventListener, Helper, Mov
|
||||
protected MovementState currentState;
|
||||
protected final BlockPos src;
|
||||
protected final BlockPos dest;
|
||||
/**
|
||||
* The positions that need to be broken before this movement can ensue
|
||||
*/
|
||||
public final BlockPos[] positionsToBreak;
|
||||
/**
|
||||
* The positions where we need to place a block before this movement can ensue
|
||||
*/
|
||||
public final BlockPos[] positionsToPlace;
|
||||
|
||||
protected Movement(BlockPos src, BlockPos dest) {
|
||||
|
||||
protected Movement(BlockPos src, BlockPos dest, BlockPos[] toBreak, BlockPos[] toPlace) {
|
||||
this.src = src;
|
||||
this.dest = dest;
|
||||
this.positionsToBreak = toBreak;
|
||||
this.positionsToPlace = toPlace;
|
||||
}
|
||||
|
||||
protected Movement(BlockPos src, BlockPos dest, Vec3d rotationTarget) {
|
||||
this(src, dest);
|
||||
protected Movement(BlockPos src, BlockPos dest, BlockPos[] toBreak, BlockPos[] toPlace, Vec3d rotationTarget) {
|
||||
this(src, dest, toBreak, toPlace);
|
||||
currentState = new MovementState()
|
||||
.setLookDirection(rotationTarget)
|
||||
.setStatus(MovementStatus.WAITING);
|
||||
|
@ -9,7 +9,7 @@ import net.minecraft.util.math.BlockPos;
|
||||
public class MovementAscend extends Movement {
|
||||
|
||||
public MovementAscend(BlockPos src, BlockPos dest) {
|
||||
super(src, dest);
|
||||
super(src, dest, new BlockPos[]{dest, src.up(2), dest.up()}, new BlockPos[]{dest.down()});
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -17,11 +17,6 @@ public class MovementAscend extends Movement {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
//my suggestion: public MovementAscend(BlockPos src, BlockPos dest){
|
||||
// super(src, dest, new BlockPos[]{dest, src.up(2), dest.up()}, new BlockPos[]{dest.down()});
|
||||
// This basically says that dest, src.up3 and dest.up need to be passable before this movement can start
|
||||
// and that dest.down needs to be stand-on-able
|
||||
|
||||
@Override
|
||||
public MovementState calcState() {
|
||||
MovementState latestState = currentState.setInput(InputOverrideHandler.Input.JUMP, true).setInput(InputOverrideHandler.Input.MOVE_FORWARD, true);
|
||||
|
@ -5,8 +5,6 @@ import baritone.movement.MovementManager;
|
||||
import baritone.ui.LookManager;
|
||||
import baritone.util.Out;
|
||||
import baritone.util.ToolSet;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLadder;
|
||||
import net.minecraft.block.BlockVine;
|
||||
@ -16,8 +14,10 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author leijurv
|
||||
*/
|
||||
public class ActionBridge extends ActionPlaceOrBreak {
|
||||
@ -76,6 +76,7 @@ public class ActionBridge extends ActionPlaceOrBreak {
|
||||
//Out.log("Can't walk on " + Baritone.get(positionsToPlace[0]).getBlock());
|
||||
}
|
||||
}
|
||||
|
||||
boolean wasTheBridgeBlockAlwaysThere = true;//did we have to place a bridge block or was it always there
|
||||
public Boolean oneInTen = null;//a one in ten chance
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user