Reformatting, appeasing leijurv, and fixing stupid mistake.
This commit is contained in:
@@ -385,7 +385,7 @@ public interface MovementHelper extends ActionCosts, Helper {
|
||||
static boolean avoidWalkingInto(BlockState state) {
|
||||
Block block = state.getBlock();
|
||||
return !state.getFluidState().isEmpty()
|
||||
|| block == Blocks.MAGMA_BLOCK
|
||||
|| (block == Blocks.MAGMA_BLOCK && !Baritone.settings().allowWalkOnMagmaBlocks.value)
|
||||
|| block == Blocks.CACTUS
|
||||
|| block == Blocks.SWEET_BERRY_BUSH
|
||||
|| block instanceof BaseFireBlock
|
||||
@@ -421,7 +421,7 @@ public interface MovementHelper extends ActionCosts, Helper {
|
||||
|
||||
static Ternary canWalkOnBlockState(BlockState state) {
|
||||
Block block = state.getBlock();
|
||||
if (isBlockNormalCube(state) && (Baritone.settings().allowWalkOnMagmaBlocks.value || block != Blocks.MAGMA_BLOCK) && block != Blocks.BUBBLE_COLUMN && block != Blocks.HONEY_BLOCK) {
|
||||
if (isBlockNormalCube(state) && (block != Blocks.MAGMA_BLOCK || Baritone.settings().allowWalkOnMagmaBlocks.value) && block != Blocks.BUBBLE_COLUMN && block != Blocks.HONEY_BLOCK) {
|
||||
return YES;
|
||||
}
|
||||
if (block instanceof AzaleaBlock) {
|
||||
|
||||
@@ -131,9 +131,9 @@ public class MovementAscend extends Movement {
|
||||
}
|
||||
} else {
|
||||
// jumpingFromBottomSlab must be false
|
||||
if (toPlace.getBlock() == Blocks.SOUL_SAND) {
|
||||
if (toPlace.is(Blocks.SOUL_SAND)) {
|
||||
walk = WALK_ONE_OVER_SOUL_SAND_COST;
|
||||
} else if (toPlace.getBlock() == Blocks.MAGMA_BLOCK) {
|
||||
} else if (toPlace.is(Blocks.MAGMA_BLOCK)) {
|
||||
walk = SNEAK_ONE_BLOCK_COST;
|
||||
} else {
|
||||
walk = Math.max(JUMP_ONE_BLOCK_COST, WALK_ONE_BLOCK_COST);
|
||||
@@ -191,7 +191,7 @@ public class MovementAscend extends Movement {
|
||||
}
|
||||
MovementHelper.moveTowards(ctx, state, dest);
|
||||
|
||||
state.setInput(Input.SNEAK, Baritone.settings().allowWalkOnMagmaBlocks.value && jumpingOnto.getBlock().equals(Blocks.MAGMA_BLOCK));
|
||||
state.setInput(Input.SNEAK, Baritone.settings().allowWalkOnMagmaBlocks.value && jumpingOnto.is(Blocks.MAGMA_BLOCK));
|
||||
|
||||
if (MovementHelper.isBottomSlab(jumpingOnto) && !MovementHelper.isBottomSlab(BlockStateInterface.get(ctx, src.below()))) {
|
||||
return state; // don't jump while walking from a non double slab into a bottom slab
|
||||
|
||||
@@ -257,7 +257,7 @@ public class MovementDescend extends Movement {
|
||||
double z = ctx.player().position().z - (src.getZ() + 0.5);
|
||||
double fromStart = Math.sqrt(x * x + z * z);
|
||||
|
||||
state.setInput(Input.SNEAK, Baritone.settings().allowWalkOnMagmaBlocks.value && BlockStateInterface.get(ctx, ctx.player().blockPosition().below()).getBlock().equals(Blocks.MAGMA_BLOCK));
|
||||
state.setInput(Input.SNEAK, Baritone.settings().allowWalkOnMagmaBlocks.value && ctx.world().getBlockState(ctx.player().blockPosition().below()).is(Blocks.MAGMA_BLOCK));
|
||||
|
||||
if (!playerFeet.equals(dest) || ab > 0.25) {
|
||||
if (numTicks++ < 20 && fromStart < 1.25) {
|
||||
|
||||
@@ -141,9 +141,9 @@ public class MovementDiagonal extends Movement {
|
||||
}
|
||||
double multiplier = WALK_ONE_BLOCK_COST;
|
||||
// For either possible soul sand, that affects half of our walking
|
||||
if (destWalkOn.getBlock() == Blocks.SOUL_SAND) {
|
||||
if (destWalkOn.is(Blocks.SOUL_SAND)) {
|
||||
multiplier += (WALK_ONE_OVER_SOUL_SAND_COST - WALK_ONE_BLOCK_COST) / 2;
|
||||
} else if (context.allowWalkOnMagmaBlocks && destWalkOn.getBlock().equals(Blocks.MAGMA_BLOCK)) {
|
||||
} else if (context.allowWalkOnMagmaBlocks && destWalkOn.is(Blocks.MAGMA_BLOCK)) {
|
||||
multiplier += (SNEAK_ONE_BLOCK_COST - WALK_ONE_BLOCK_COST) / 2;
|
||||
sneaking = true;
|
||||
}
|
||||
@@ -164,11 +164,11 @@ public class MovementDiagonal extends Movement {
|
||||
sneaking = true;
|
||||
}
|
||||
BlockState cuttingOver1 = context.get(x, y - 1, destZ);
|
||||
if ((context.allowWalkOnMagmaBlocks && cuttingOver1.getBlock().equals(Blocks.MAGMA_BLOCK)) || MovementHelper.isLava(cuttingOver1)) {
|
||||
if ((!context.allowWalkOnMagmaBlocks && cuttingOver1.is(Blocks.MAGMA_BLOCK)) || MovementHelper.isLava(cuttingOver1)) {
|
||||
return;
|
||||
}
|
||||
BlockState cuttingOver2 = context.get(destX, y - 1, z);
|
||||
if ((context.allowWalkOnMagmaBlocks && cuttingOver1.getBlock().equals(Blocks.MAGMA_BLOCK)) || MovementHelper.isLava(cuttingOver2)) {
|
||||
if ((!context.allowWalkOnMagmaBlocks && cuttingOver1.is(Blocks.MAGMA_BLOCK)) || MovementHelper.isLava(cuttingOver2)) {
|
||||
return;
|
||||
}
|
||||
boolean water = false;
|
||||
@@ -279,7 +279,7 @@ public class MovementDiagonal extends Movement {
|
||||
if (sprint()) {
|
||||
state.setInput(Input.SPRINT, true);
|
||||
}
|
||||
state.setInput(Input.SNEAK, Baritone.settings().allowWalkOnMagmaBlocks.value && MovementHelper.steppingOnBlocks(ctx).stream().anyMatch(block -> BlockStateInterface.get(ctx, block).getBlock().equals(Blocks.MAGMA_BLOCK)));
|
||||
state.setInput(Input.SNEAK, Baritone.settings().allowWalkOnMagmaBlocks.value && MovementHelper.steppingOnBlocks(ctx).stream().anyMatch(block -> ctx.world().getBlockState(block).is(Blocks.MAGMA_BLOCK)));
|
||||
MovementHelper.moveTowards(ctx, state, dest);
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ import baritone.pathing.movement.Movement;
|
||||
import baritone.pathing.movement.MovementHelper;
|
||||
import baritone.pathing.movement.MovementState;
|
||||
import baritone.pathing.movement.MovementState.MovementTarget;
|
||||
import baritone.utils.BlockStateInterface;
|
||||
import baritone.utils.pathing.MutableMoveResult;
|
||||
import java.util.HashSet;
|
||||
import java.util.Optional;
|
||||
@@ -41,7 +40,6 @@ import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.AirBlock;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.LadderBlock;
|
||||
@@ -97,7 +95,7 @@ public class MovementFall extends Movement {
|
||||
BlockState destState = ctx.world().getBlockState(dest);
|
||||
Block destBlock = destState.getBlock();
|
||||
|
||||
if (BlockStateInterface.get(ctx, dest.below()).getBlock().equals(Blocks.MAGMA_BLOCK) && MovementHelper.steppingOnBlocks(ctx).stream().allMatch(block -> BlockStateInterface.get(ctx, block).getBlock() instanceof AirBlock)) {
|
||||
if (ctx.world().getBlockState(dest.below()).is(Blocks.MAGMA_BLOCK) && MovementHelper.steppingOnBlocks(ctx).stream().allMatch(block -> MovementHelper.canWalkThrough(ctx, block))) {
|
||||
state.setInput(Input.SNEAK, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -102,16 +102,19 @@ public class MovementParkour extends Movement {
|
||||
return; // can't jump out of water
|
||||
}
|
||||
int maxJump;
|
||||
if (context.allowWalkOnMagmaBlocks && standingOn.getBlock() == Blocks.MAGMA_BLOCK) {
|
||||
if (context.allowWalkOnMagmaBlocks && standingOn.is(Blocks.MAGMA_BLOCK)) {
|
||||
maxJump = 2;
|
||||
}
|
||||
else if (standingOn.getBlock() == Blocks.SOUL_SAND) {
|
||||
maxJump = 2; // 1 block gap
|
||||
} else if (context.canSprint) {
|
||||
maxJump = 4;
|
||||
}
|
||||
else {
|
||||
maxJump = 3;
|
||||
if (context.canSprint) {
|
||||
maxJump = 4;
|
||||
}
|
||||
else {
|
||||
maxJump = 3;
|
||||
}
|
||||
}
|
||||
|
||||
// check parkour jumps from smallest to largest for obstacles/walls and landing positions
|
||||
@@ -264,8 +267,7 @@ public class MovementParkour extends Movement {
|
||||
if (dist >= 4 || ascend) {
|
||||
state.setInput(Input.SPRINT, true);
|
||||
}
|
||||
|
||||
if (Baritone.settings().allowWalkOnMagmaBlocks.value && BlockStateInterface.get(ctx, ctx.playerFeet().below()).getBlock().equals(Blocks.MAGMA_BLOCK)) {
|
||||
if (Baritone.settings().allowWalkOnMagmaBlocks.value && ctx.world().getBlockState(ctx.playerFeet().below()).is(Blocks.MAGMA_BLOCK)) {
|
||||
state.setInput(Input.SNEAK, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -229,11 +229,7 @@ public class MovementPillar extends Movement {
|
||||
return state.setStatus(MovementStatus.UNREACHABLE);
|
||||
}
|
||||
|
||||
|
||||
state.setInput(Input.SNEAK, true);
|
||||
// if (ctx.player().position().y > dest.getY() || ctx.player().position().y < src.getY() + 0.2D) {
|
||||
// state.setInput(Input.SNEAK, true); // delay placement by 1 tick for ncp compatibility
|
||||
// }
|
||||
// since (lower down) we only right click once player.isSneaking, and that happens the tick after we request to sneak
|
||||
|
||||
double diffX = ctx.player().position().x - (dest.getX() + 0.5);
|
||||
|
||||
@@ -221,7 +221,7 @@ public class MovementTraverse extends Movement {
|
||||
boolean ladder = fd == Blocks.LADDER || fd == Blocks.VINE;
|
||||
|
||||
//sneak may have been set to true in the PREPPING state while mining an adjacent block, but we still want it to be true if the player is about to go on magma
|
||||
state.setInput(Input.SNEAK, Baritone.settings().allowWalkOnMagmaBlocks.value && MovementHelper.steppingOnBlocks(ctx).stream().anyMatch(block -> BlockStateInterface.get(ctx, block).getBlock().equals(Blocks.MAGMA_BLOCK)));
|
||||
state.setInput(Input.SNEAK, Baritone.settings().allowWalkOnMagmaBlocks.value && MovementHelper.steppingOnBlocks(ctx).stream().anyMatch(block -> ctx.world().getBlockState(block).is(Blocks.MAGMA_BLOCK)));
|
||||
|
||||
if (pb0.getBlock() instanceof DoorBlock || pb1.getBlock() instanceof DoorBlock) {
|
||||
boolean notPassable = pb0.getBlock() instanceof DoorBlock && !MovementHelper.isDoorPassable(ctx, src, dest) || pb1.getBlock() instanceof DoorBlock && !MovementHelper.isDoorPassable(ctx, dest, src);
|
||||
|
||||
Reference in New Issue
Block a user