diff --git a/src/main/java/baritone/command/defaults/DefaultCommands.java b/src/main/java/baritone/command/defaults/DefaultCommands.java
index a08ff0ff..41c58b00 100644
--- a/src/main/java/baritone/command/defaults/DefaultCommands.java
+++ b/src/main/java/baritone/command/defaults/DefaultCommands.java
@@ -60,6 +60,7 @@ public final class DefaultCommands {
new FindCommand(baritone),
new MineCommand(baritone),
new ClickCommand(baritone),
+ new SurfaceCommand(baritone),
new ThisWayCommand(baritone),
new WaypointsCommand(baritone),
new CommandAlias(baritone, "sethome", "Sets your home waypoint", "waypoints save home"),
diff --git a/src/main/java/baritone/command/defaults/SurfaceCommand.java b/src/main/java/baritone/command/defaults/SurfaceCommand.java
new file mode 100644
index 00000000..842b8050
--- /dev/null
+++ b/src/main/java/baritone/command/defaults/SurfaceCommand.java
@@ -0,0 +1,89 @@
+/*
+ * This file is part of Baritone.
+ *
+ * Baritone is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Baritone is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Baritone. If not, see .
+ */
+
+package baritone.command.defaults;
+
+import baritone.api.IBaritone;
+import baritone.api.command.Command;
+import baritone.api.command.argument.IArgConsumer;
+import baritone.api.command.exception.CommandException;
+import baritone.api.pathing.goals.Goal;
+import baritone.api.pathing.goals.GoalBlock;
+import baritone.api.utils.BetterBlockPos;
+import net.minecraft.block.BlockAir;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Stream;
+
+public class SurfaceCommand extends Command {
+
+ protected SurfaceCommand(IBaritone baritone) {
+ super(baritone, "surface", "top");
+ }
+
+ @Override
+ public void execute(String label, IArgConsumer args) throws CommandException {
+ final BetterBlockPos playerPos = baritone.getPlayerContext().playerFeet();
+ final int surfaceLevel = baritone.getPlayerContext().world().getSeaLevel();
+ final int worldHeight = baritone.getPlayerContext().world().getActualHeight();
+
+ // Ensure this command will not run if you are above the surface level and the block above you is air
+ // As this would imply that your are already on the open surface
+ if (playerPos.getY() > surfaceLevel && mc.world.getBlockState(playerPos.up()).getBlock() instanceof BlockAir) {
+ logDirect("Already at surface");
+ return;
+ }
+
+ final int startingYPos = Math.max(playerPos.getY(), surfaceLevel);
+
+ for (int currentIteratedY = startingYPos; currentIteratedY < worldHeight; currentIteratedY++) {
+ final BetterBlockPos newPos = new BetterBlockPos(playerPos.getX(), currentIteratedY, playerPos.getZ());
+
+ if (!(mc.world.getBlockState(newPos).getBlock() instanceof BlockAir) && newPos.getY() > playerPos.getY()) {
+ Goal goal = new GoalBlock(newPos.up());
+ logDirect(String.format("Going to: %s", goal.toString()));
+ baritone.getCustomGoalProcess().setGoalAndPath(goal);
+ return;
+ }
+ }
+ logDirect("No higher location found");
+ }
+
+ @Override
+ public Stream tabComplete(String label, IArgConsumer args) {
+ return Stream.empty();
+ }
+
+ @Override
+ public String getShortDesc() {
+ return "Used to get out of caves, mines, ...";
+ }
+
+ @Override
+ public List getLongDesc() {
+ return Arrays.asList(
+ "The surface/top command tells Baritone to head towards the closest surface-like area.",
+ "",
+ "This can be the surface or the highest available air space, depending on circumstances.",
+ "",
+ "Usage:",
+ "> surface - Used to get out of caves, mines, ...",
+ "> top - Used to get out of caves, mines, ..."
+ );
+ }
+}