relative goals

This commit is contained in:
Leijurv 2019-05-16 11:50:48 -07:00
parent 0dd4834e18
commit 6861bfd4e6
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A

View File

@ -688,18 +688,20 @@ public class ExampleBaritoneControl implements Helper, AbstractGameEventListener
private Goal parseGoal(String[] params) { private Goal parseGoal(String[] params) {
Goal goal; Goal goal;
try { try {
BetterBlockPos playerFeet = ctx.playerFeet();
switch (params.length) { switch (params.length) {
case 0: case 0:
goal = new GoalBlock(ctx.playerFeet()); goal = new GoalBlock(playerFeet);
break; break;
case 1: case 1:
goal = new GoalYLevel(Integer.parseInt(params[0]));
goal = new GoalYLevel(parseOrDefault(params[0], playerFeet.y));
break; break;
case 2: case 2:
goal = new GoalXZ(Integer.parseInt(params[0]), Integer.parseInt(params[1])); goal = new GoalXZ(parseOrDefault(params[0], playerFeet.x), parseOrDefault(params[1], playerFeet.z));
break; break;
case 3: case 3:
goal = new GoalBlock(new BlockPos(Integer.parseInt(params[0]), Integer.parseInt(params[1]), Integer.parseInt(params[2]))); goal = new GoalBlock(new BlockPos(parseOrDefault(params[0], playerFeet.x), parseOrDefault(params[1], playerFeet.y), parseOrDefault(params[2], playerFeet.z)));
break; break;
default: default:
logDirect("unable to understand lol"); logDirect("unable to understand lol");