movementhelper overhaul
This commit is contained in:
parent
2533cbc2c1
commit
387e27e8de
@ -73,7 +73,7 @@ public interface MovementHelper extends ActionCosts, Helper {
|
|||||||
if (block == Blocks.AIR) {
|
if (block == Blocks.AIR) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (block instanceof BlockFire || block instanceof BlockTripWire || block instanceof BlockWeb || block instanceof BlockEndPortal) {
|
if (block == Blocks.FIRE || block == Blocks.TRIPWIRE || block == Blocks.WEB || block == Blocks.END_PORTAL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (block instanceof BlockDoor || block instanceof BlockFenceGate) {
|
if (block instanceof BlockDoor || block instanceof BlockFenceGate) {
|
||||||
@ -206,10 +206,11 @@ public interface MovementHelper extends ActionCosts, Helper {
|
|||||||
|
|
||||||
static boolean avoidWalkingInto(Block block) {
|
static boolean avoidWalkingInto(Block block) {
|
||||||
return BlockStateInterface.isLava(block)
|
return BlockStateInterface.isLava(block)
|
||||||
|| block instanceof BlockCactus
|
|| block == Blocks.MAGMA
|
||||||
|| block instanceof BlockFire
|
|| block == Blocks.CACTUS
|
||||||
|| block instanceof BlockEndPortal
|
|| block == Blocks.FIRE
|
||||||
|| block instanceof BlockWeb;
|
|| block == Blocks.END_PORTAL
|
||||||
|
|| block == Blocks.WEB;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -221,31 +222,22 @@ public interface MovementHelper extends ActionCosts, Helper {
|
|||||||
*/
|
*/
|
||||||
static boolean canWalkOn(BlockPos pos, IBlockState state) {
|
static boolean canWalkOn(BlockPos pos, IBlockState state) {
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
if (block == Blocks.AIR) {
|
if (block == Blocks.AIR || block == Blocks.MAGMA) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (block instanceof BlockLadder || (Baritone.settings().allowVines.get() && block instanceof BlockVine)) { // TODO reconsider this
|
if (state.isBlockNormalCube()) {
|
||||||
return true;
|
if (BlockStateInterface.isLava(block) || BlockStateInterface.isWater(block)) {
|
||||||
}
|
throw new IllegalStateException();
|
||||||
if (block instanceof BlockGlass || block instanceof BlockStainedGlass) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (Blocks.FARMLAND.equals(block) || Blocks.GRASS_PATH.equals(block)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (Blocks.ENDER_CHEST.equals(block) || Blocks.CHEST.equals(block)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (block instanceof BlockSlab) {
|
|
||||||
if (!Baritone.settings().allowWalkOnBottomSlab.get()) {
|
|
||||||
if (((BlockSlab) block).isDouble()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return state.getValue(BlockSlab.HALF) != BlockSlab.EnumBlockHalf.BOTTOM;
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (block instanceof BlockStairs) {
|
if (block == Blocks.LADDER || (block == Blocks.VINE && Baritone.settings().allowVines.get())) { // TODO reconsider this
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (block == Blocks.FARMLAND || block == Blocks.GRASS_PATH) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (block == Blocks.ENDER_CHEST || block == Blocks.CHEST) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (BlockStateInterface.isWater(block)) {
|
if (BlockStateInterface.isWater(block)) {
|
||||||
@ -261,20 +253,28 @@ public interface MovementHelper extends ActionCosts, Helper {
|
|||||||
// if assumeWalkOnWater is off, we can only walk on water if there is water above it
|
// if assumeWalkOnWater is off, we can only walk on water if there is water above it
|
||||||
return BlockStateInterface.isWater(up) ^ Baritone.settings().assumeWalkOnWater.get();
|
return BlockStateInterface.isWater(up) ^ Baritone.settings().assumeWalkOnWater.get();
|
||||||
}
|
}
|
||||||
if (Blocks.MAGMA.equals(block)) {
|
if (block instanceof BlockGlass || block instanceof BlockStainedGlass) {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
return state.isBlockNormalCube() && !BlockStateInterface.isLava(block);
|
if (block instanceof BlockSlab) {
|
||||||
|
if (!Baritone.settings().allowWalkOnBottomSlab.get()) {
|
||||||
|
if (((BlockSlab) block).isDouble()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return state.getValue(BlockSlab.HALF) != BlockSlab.EnumBlockHalf.BOTTOM;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (block instanceof BlockStairs) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean canWalkOn(BlockPos pos) {
|
static boolean canWalkOn(BlockPos pos) {
|
||||||
return canWalkOn(pos, BlockStateInterface.get(pos));
|
return canWalkOn(pos, BlockStateInterface.get(pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean canFall(BlockPos pos) {
|
|
||||||
return BlockStateInterface.get(pos).getBlock() instanceof BlockFalling;
|
|
||||||
}
|
|
||||||
|
|
||||||
static boolean canPlaceAgainst(BlockPos pos) {
|
static boolean canPlaceAgainst(BlockPos pos) {
|
||||||
IBlockState state = BlockStateInterface.get(pos);
|
IBlockState state = BlockStateInterface.get(pos);
|
||||||
// TODO isBlockNormalCube isn't the best check for whether or not we can place a block against it. e.g. glass isn't normalCube but we can place against it
|
// TODO isBlockNormalCube isn't the best check for whether or not we can place a block against it. e.g. glass isn't normalCube but we can place against it
|
||||||
@ -288,7 +288,7 @@ public interface MovementHelper extends ActionCosts, Helper {
|
|||||||
|
|
||||||
static double getMiningDurationTicks(CalculationContext context, BlockPos position, IBlockState state, boolean includeFalling) {
|
static double getMiningDurationTicks(CalculationContext context, BlockPos position, IBlockState state, boolean includeFalling) {
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
if (!block.equals(Blocks.AIR) && !canWalkThrough(position, state)) { // TODO is the air check really necessary? Isn't air canWalkThrough?
|
if (!canWalkThrough(position, state)) {
|
||||||
if (!context.allowBreak()) {
|
if (!context.allowBreak()) {
|
||||||
return COST_INF;
|
return COST_INF;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user