break and place
This commit is contained in:
parent
71d4379316
commit
1f9dadce39
@ -1,10 +1,11 @@
|
|||||||
package baritone.bot.pathing.calc;
|
package baritone.bot.pathing.calc;
|
||||||
|
|
||||||
import baritone.bot.pathing.movement.Movement;
|
|
||||||
import baritone.bot.pathing.goals.Goal;
|
import baritone.bot.pathing.goals.Goal;
|
||||||
|
import baritone.bot.pathing.movement.Movement;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A node based implementation of IPath
|
* A node based implementation of IPath
|
||||||
@ -87,11 +88,11 @@ class Path implements IPath {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<BlockPos> getBlocksToMine() {
|
public Collection<BlockPos> getBlocksToMine() {
|
||||||
return null;
|
return movements.stream().map(move -> move.positionsToBreak).flatMap(Arrays::stream).collect(Collectors.toCollection(HashSet::new));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<BlockPos> getBlocksToPlace() {
|
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 LADDER_DOWN_ONE_COST = 20 / 3;
|
||||||
double SNEAK_ONE_BLOCK_COST = 20 / 1.3;
|
double SNEAK_ONE_BLOCK_COST = 20 / 1.3;
|
||||||
double SPRINT_ONE_BLOCK_COST = 20 / 5.612;
|
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
|
* Doesn't include walking forwards, just the falling
|
||||||
|
@ -17,14 +17,25 @@ public abstract class Movement implements AbstractGameEventListener, Helper, Mov
|
|||||||
protected MovementState currentState;
|
protected MovementState currentState;
|
||||||
protected final BlockPos src;
|
protected final BlockPos src;
|
||||||
protected final BlockPos dest;
|
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.src = src;
|
||||||
this.dest = dest;
|
this.dest = dest;
|
||||||
|
this.positionsToBreak = toBreak;
|
||||||
|
this.positionsToPlace = toPlace;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Movement(BlockPos src, BlockPos dest, Vec3d rotationTarget) {
|
protected Movement(BlockPos src, BlockPos dest, BlockPos[] toBreak, BlockPos[] toPlace, Vec3d rotationTarget) {
|
||||||
this(src, dest);
|
this(src, dest, toBreak, toPlace);
|
||||||
currentState = new MovementState()
|
currentState = new MovementState()
|
||||||
.setLookDirection(rotationTarget)
|
.setLookDirection(rotationTarget)
|
||||||
.setStatus(MovementStatus.WAITING);
|
.setStatus(MovementStatus.WAITING);
|
||||||
|
@ -9,7 +9,7 @@ import net.minecraft.util.math.BlockPos;
|
|||||||
public class MovementAscend extends Movement {
|
public class MovementAscend extends Movement {
|
||||||
|
|
||||||
public MovementAscend(BlockPos src, BlockPos dest) {
|
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
|
@Override
|
||||||
@ -17,11 +17,6 @@ public class MovementAscend extends Movement {
|
|||||||
throw new UnsupportedOperationException();
|
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
|
@Override
|
||||||
public MovementState calcState() {
|
public MovementState calcState() {
|
||||||
MovementState latestState = currentState.setInput(InputOverrideHandler.Input.JUMP, true).setInput(InputOverrideHandler.Input.MOVE_FORWARD, true);
|
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.ui.LookManager;
|
||||||
import baritone.util.Out;
|
import baritone.util.Out;
|
||||||
import baritone.util.ToolSet;
|
import baritone.util.ToolSet;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Random;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockLadder;
|
import net.minecraft.block.BlockLadder;
|
||||||
import net.minecraft.block.BlockVine;
|
import net.minecraft.block.BlockVine;
|
||||||
@ -16,8 +14,10 @@ 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;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author leijurv
|
* @author leijurv
|
||||||
*/
|
*/
|
||||||
public class ActionBridge extends ActionPlaceOrBreak {
|
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());
|
//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
|
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
|
public Boolean oneInTen = null;//a one in ten chance
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user