Merge pull request #1346 from aUniqueUser/master
Make desktop notifications more useful
This commit is contained in:
commit
7992b63aae
@ -1080,10 +1080,35 @@ public final class Settings {
|
|||||||
public final Setting<Boolean> renderSelectionCorners = new Setting<>(true);
|
public final Setting<Boolean> renderSelectionCorners = new Setting<>(true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Desktop Notifications
|
* Desktop notifications
|
||||||
*/
|
*/
|
||||||
public final Setting<Boolean> desktopNotifications = new Setting<>(false);
|
public final Setting<Boolean> desktopNotifications = new Setting<>(false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Desktop notification on path complete
|
||||||
|
*/
|
||||||
|
public final Setting<Boolean> notificationOnPathComplete = new Setting<>(true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Desktop notification on farm fail
|
||||||
|
*/
|
||||||
|
public final Setting<Boolean> notificationOnFarmFail = new Setting<>(true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Desktop notification on build finished
|
||||||
|
*/
|
||||||
|
public final Setting<Boolean> notificationOnBuildFinished = new Setting<>(true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Desktop notification on explore finished
|
||||||
|
*/
|
||||||
|
public final Setting<Boolean> notificationOnExploreFinished = new Setting<>(true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Desktop notification on mine fail
|
||||||
|
*/
|
||||||
|
public final Setting<Boolean> notificationOnMineFail = new Setting<>(true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A map of lowercase setting field names to their respective setting
|
* A map of lowercase setting field names to their respective setting
|
||||||
*/
|
*/
|
||||||
|
@ -39,6 +39,7 @@ import baritone.pathing.movement.Movement;
|
|||||||
import baritone.pathing.movement.MovementHelper;
|
import baritone.pathing.movement.MovementHelper;
|
||||||
import baritone.utils.BaritoneProcessHelper;
|
import baritone.utils.BaritoneProcessHelper;
|
||||||
import baritone.utils.BlockStateInterface;
|
import baritone.utils.BlockStateInterface;
|
||||||
|
import baritone.utils.NotificationHelper;
|
||||||
import baritone.utils.PathingCommandContext;
|
import baritone.utils.PathingCommandContext;
|
||||||
import baritone.utils.schematic.MapArtSchematic;
|
import baritone.utils.schematic.MapArtSchematic;
|
||||||
import baritone.utils.schematic.SchematicSystem;
|
import baritone.utils.schematic.SchematicSystem;
|
||||||
@ -406,6 +407,9 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
|
|||||||
numRepeats++;
|
numRepeats++;
|
||||||
if (repeat.equals(new Vec3i(0, 0, 0)) || (max != -1 && numRepeats >= max)) {
|
if (repeat.equals(new Vec3i(0, 0, 0)) || (max != -1 && numRepeats >= max)) {
|
||||||
logDirect("Done building");
|
logDirect("Done building");
|
||||||
|
if (Baritone.settings().desktopNotifications.value && Baritone.settings().notificationOnBuildFinished.value) {
|
||||||
|
NotificationHelper.notify("Done building", false);
|
||||||
|
}
|
||||||
onLostControl();
|
onLostControl();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ import baritone.api.process.ICustomGoalProcess;
|
|||||||
import baritone.api.process.PathingCommand;
|
import baritone.api.process.PathingCommand;
|
||||||
import baritone.api.process.PathingCommandType;
|
import baritone.api.process.PathingCommandType;
|
||||||
import baritone.utils.BaritoneProcessHelper;
|
import baritone.utils.BaritoneProcessHelper;
|
||||||
|
import baritone.utils.NotificationHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* As set by ExampleBaritoneControl or something idk
|
* As set by ExampleBaritoneControl or something idk
|
||||||
@ -93,6 +94,9 @@ public final class CustomGoalProcess extends BaritoneProcessHelper implements IC
|
|||||||
if (Baritone.settings().disconnectOnArrival.value) {
|
if (Baritone.settings().disconnectOnArrival.value) {
|
||||||
ctx.world().sendQuittingDisconnectingPacket();
|
ctx.world().sendQuittingDisconnectingPacket();
|
||||||
}
|
}
|
||||||
|
if (Baritone.settings().desktopNotifications.value && Baritone.settings().notificationOnPathComplete.value) {
|
||||||
|
NotificationHelper.notify("Pathing complete", false);
|
||||||
|
}
|
||||||
return new PathingCommand(this.goal, PathingCommandType.CANCEL_AND_SET_GOAL);
|
return new PathingCommand(this.goal, PathingCommandType.CANCEL_AND_SET_GOAL);
|
||||||
}
|
}
|
||||||
return new PathingCommand(this.goal, PathingCommandType.SET_GOAL_AND_PATH);
|
return new PathingCommand(this.goal, PathingCommandType.SET_GOAL_AND_PATH);
|
||||||
|
@ -29,6 +29,7 @@ import baritone.api.process.PathingCommandType;
|
|||||||
import baritone.api.utils.MyChunkPos;
|
import baritone.api.utils.MyChunkPos;
|
||||||
import baritone.cache.CachedWorld;
|
import baritone.cache.CachedWorld;
|
||||||
import baritone.utils.BaritoneProcessHelper;
|
import baritone.utils.BaritoneProcessHelper;
|
||||||
|
import baritone.utils.NotificationHelper;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
|
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
|
||||||
@ -83,12 +84,18 @@ public final class ExploreProcess extends BaritoneProcessHelper implements IExpl
|
|||||||
public PathingCommand onTick(boolean calcFailed, boolean isSafeToCancel) {
|
public PathingCommand onTick(boolean calcFailed, boolean isSafeToCancel) {
|
||||||
if (calcFailed) {
|
if (calcFailed) {
|
||||||
logDirect("Failed");
|
logDirect("Failed");
|
||||||
|
if (Baritone.settings().desktopNotifications.value && Baritone.settings().notificationOnExploreFinished.value) {
|
||||||
|
NotificationHelper.notify("Exploration failed", true);
|
||||||
|
}
|
||||||
onLostControl();
|
onLostControl();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
IChunkFilter filter = calcFilter();
|
IChunkFilter filter = calcFilter();
|
||||||
if (!Baritone.settings().disableCompletionCheck.value && filter.countRemain() == 0) {
|
if (!Baritone.settings().disableCompletionCheck.value && filter.countRemain() == 0) {
|
||||||
logDirect("Explored all chunks");
|
logDirect("Explored all chunks");
|
||||||
|
if (Baritone.settings().desktopNotifications.value && Baritone.settings().notificationOnExploreFinished.value) {
|
||||||
|
NotificationHelper.notify("Explored all chunks", false);
|
||||||
|
}
|
||||||
onLostControl();
|
onLostControl();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ import baritone.api.utils.input.Input;
|
|||||||
import baritone.cache.WorldScanner;
|
import baritone.cache.WorldScanner;
|
||||||
import baritone.pathing.movement.MovementHelper;
|
import baritone.pathing.movement.MovementHelper;
|
||||||
import baritone.utils.BaritoneProcessHelper;
|
import baritone.utils.BaritoneProcessHelper;
|
||||||
|
import baritone.utils.NotificationHelper;
|
||||||
import net.minecraft.block.*;
|
import net.minecraft.block.*;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
@ -257,6 +258,9 @@ public final class FarmProcess extends BaritoneProcessHelper implements IFarmPro
|
|||||||
|
|
||||||
if (calcFailed) {
|
if (calcFailed) {
|
||||||
logDirect("Farm failed");
|
logDirect("Farm failed");
|
||||||
|
if (Baritone.settings().desktopNotifications.value && Baritone.settings().notificationOnFarmFail.value) {
|
||||||
|
NotificationHelper.notify("Farm failed", true);
|
||||||
|
}
|
||||||
onLostControl();
|
onLostControl();
|
||||||
return new PathingCommand(null, PathingCommandType.REQUEST_PAUSE);
|
return new PathingCommand(null, PathingCommandType.REQUEST_PAUSE);
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ import baritone.pathing.movement.CalculationContext;
|
|||||||
import baritone.pathing.movement.MovementHelper;
|
import baritone.pathing.movement.MovementHelper;
|
||||||
import baritone.utils.BaritoneProcessHelper;
|
import baritone.utils.BaritoneProcessHelper;
|
||||||
import baritone.utils.BlockStateInterface;
|
import baritone.utils.BlockStateInterface;
|
||||||
|
import baritone.utils.NotificationHelper;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockAir;
|
import net.minecraft.block.BlockAir;
|
||||||
import net.minecraft.block.BlockFalling;
|
import net.minecraft.block.BlockFalling;
|
||||||
@ -88,10 +89,16 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
|
|||||||
if (calcFailed) {
|
if (calcFailed) {
|
||||||
if (!knownOreLocations.isEmpty() && Baritone.settings().blacklistClosestOnFailure.value) {
|
if (!knownOreLocations.isEmpty() && Baritone.settings().blacklistClosestOnFailure.value) {
|
||||||
logDirect("Unable to find any path to " + filter + ", blacklisting presumably unreachable closest instance...");
|
logDirect("Unable to find any path to " + filter + ", blacklisting presumably unreachable closest instance...");
|
||||||
|
if (Baritone.settings().desktopNotifications.value && Baritone.settings().notificationOnMineFail.value) {
|
||||||
|
NotificationHelper.notify("Unable to find any path to " + filter + ", blacklisting presumably unreachable closest instance...", true);
|
||||||
|
}
|
||||||
knownOreLocations.stream().min(Comparator.comparingDouble(ctx.player()::getDistanceSq)).ifPresent(blacklist::add);
|
knownOreLocations.stream().min(Comparator.comparingDouble(ctx.player()::getDistanceSq)).ifPresent(blacklist::add);
|
||||||
knownOreLocations.removeIf(blacklist::contains);
|
knownOreLocations.removeIf(blacklist::contains);
|
||||||
} else {
|
} else {
|
||||||
logDirect("Unable to find any path to " + filter + ", canceling mine");
|
logDirect("Unable to find any path to " + filter + ", canceling mine");
|
||||||
|
if (Baritone.settings().desktopNotifications.value && Baritone.settings().notificationOnMineFail.value) {
|
||||||
|
NotificationHelper.notify("Unable to find any path to " + filter + ", canceling mine", true);
|
||||||
|
}
|
||||||
cancel();
|
cancel();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -221,6 +228,9 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
|
|||||||
locs.addAll(dropped);
|
locs.addAll(dropped);
|
||||||
if (locs.isEmpty()) {
|
if (locs.isEmpty()) {
|
||||||
logDirect("No locations for " + filter + " known, cancelling");
|
logDirect("No locations for " + filter + " known, cancelling");
|
||||||
|
if (Baritone.settings().desktopNotifications.value && Baritone.settings().notificationOnMineFail.value) {
|
||||||
|
NotificationHelper.notify("No locations for " + filter + " known, cancelling", true);
|
||||||
|
}
|
||||||
cancel();
|
cancel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user