Merge pull request #1 from CDAGaming/CDAGaming-patch-1

[Change] Adjustments
This commit is contained in:
aUniqueUser 2020-02-26 11:14:45 -05:00 committed by GitHub
commit 10bb935a42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 9 deletions

View File

@ -41,21 +41,21 @@ public class TunnelCommand extends Command {
args.requireMax(3); args.requireMax(3);
if (args.hasExactly(3)) { if (args.hasExactly(3)) {
boolean cont = true; boolean cont = true;
int depth = Integer.parseInt(args.peekString(0)); int depth = Integer.parseInt(args.getArgs().get(0).getValue());
int height = Integer.parseInt(args.peekString(1))-1; int height = Integer.parseInt(args.getArgs().get(1).getValue());
int width = Integer.parseInt(args.peekString(2))-1; int width = Integer.parseInt(args.getArgs().get(2).getValue());
if (width < 1 || height < 2) { if (width < 1 || height < 2 || depth < 1) {
logDirect("Width must at least be 1 block, Height must at least be 2 blocks"); logDirect("Width and depth must at least be 1 block; Height must at least be 2 blocks");
cont = false; cont = false;
} }
if (cont) { if (cont) {
BlockPos corner1; BlockPos corner1;
BlockPos corner2; BlockPos corner2;
EnumFacing enumfacing = ctx.player().getHorizontalFacing(); EnumFacing enumFacing = ctx.player().getHorizontalFacing();
int addition = ((width % 2 == 0) ? 0 : 1); int addition = ((width % 2 == 0) ? 0 : 1);
switch (enumfacing) { switch (enumFacing) {
case EAST: case EAST:
corner1 = new BlockPos(ctx.playerFeet().x, ctx.playerFeet().y, ctx.playerFeet().z - width / 2); corner1 = new BlockPos(ctx.playerFeet().x, ctx.playerFeet().y, ctx.playerFeet().z - width / 2);
corner2 = new BlockPos(ctx.playerFeet().x + depth, ctx.playerFeet().y + height, ctx.playerFeet().z + width / 2 + addition); corner2 = new BlockPos(ctx.playerFeet().x + depth, ctx.playerFeet().y + height, ctx.playerFeet().z + width / 2 + addition);
@ -73,8 +73,9 @@ public class TunnelCommand extends Command {
corner2 = new BlockPos(ctx.playerFeet().x - width / 2, ctx.playerFeet().y + height, ctx.playerFeet().z + depth); corner2 = new BlockPos(ctx.playerFeet().x - width / 2, ctx.playerFeet().y + height, ctx.playerFeet().z + depth);
break; break;
default: default:
throw new IllegalStateException("Unexpected value: " + enumfacing); throw new IllegalStateException("Unexpected value: " + enumFacing);
} }
logDirect(String.format("Creating a tunnel %s block(s) deep, %s block(s) wide, and %s block(s) high", depth, width, height));
baritone.getBuilderProcess().clearArea(corner1, corner2); baritone.getBuilderProcess().clearArea(corner1, corner2);
} }
} else { } else {
@ -107,4 +108,4 @@ public class TunnelCommand extends Command {
"> tunnel depth/height/width - Tunnels in a user defined depth, height and width." "> tunnel depth/height/width - Tunnels in a user defined depth, height and width."
); );
} }
} }