add option to manually blacklist closest
This commit is contained in:
parent
a1a9b4e6b9
commit
c136182e17
@ -117,7 +117,7 @@ public class GetToBlockProcess extends BaritoneProcessHelper implements IGetToBl
|
|||||||
}
|
}
|
||||||
|
|
||||||
// blacklist the closest block and its adjacent blocks
|
// blacklist the closest block and its adjacent blocks
|
||||||
public synchronized void blacklistClosest() {
|
public synchronized boolean blacklistClosest() {
|
||||||
List<BlockPos> newBlacklist = new ArrayList<>();
|
List<BlockPos> newBlacklist = new ArrayList<>();
|
||||||
knownLocations.stream().min(Comparator.comparingDouble(ctx.player()::getDistanceSq)).ifPresent(newBlacklist::add);
|
knownLocations.stream().min(Comparator.comparingDouble(ctx.player()::getDistanceSq)).ifPresent(newBlacklist::add);
|
||||||
outer:
|
outer:
|
||||||
@ -140,6 +140,7 @@ public class GetToBlockProcess extends BaritoneProcessHelper implements IGetToBl
|
|||||||
}
|
}
|
||||||
logDebug("Blacklisting unreachable locations " + newBlacklist);
|
logDebug("Blacklisting unreachable locations " + newBlacklist);
|
||||||
blacklist.addAll(newBlacklist);
|
blacklist.addAll(newBlacklist);
|
||||||
|
return !newBlacklist.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
// safer than direct double comparison from distanceSq
|
// safer than direct double comparison from distanceSq
|
||||||
|
@ -35,6 +35,7 @@ import baritone.pathing.movement.CalculationContext;
|
|||||||
import baritone.pathing.movement.Movement;
|
import baritone.pathing.movement.Movement;
|
||||||
import baritone.pathing.movement.Moves;
|
import baritone.pathing.movement.Moves;
|
||||||
import baritone.process.CustomGoalProcess;
|
import baritone.process.CustomGoalProcess;
|
||||||
|
import baritone.process.GetToBlockProcess;
|
||||||
import baritone.utils.pathing.SegmentedCalculator;
|
import baritone.utils.pathing.SegmentedCalculator;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
@ -466,6 +467,19 @@ public class ExampleBaritoneControl extends Behavior implements Helper {
|
|||||||
logDirect("Exploring from " + centerX + "," + centerZ);
|
logDirect("Exploring from " + centerX + "," + centerZ);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (msg.equals("blacklist")) {
|
||||||
|
GetToBlockProcess proc = baritone.getGetToBlockProcess();
|
||||||
|
if (!proc.isActive()) {
|
||||||
|
logDirect("GetToBlockProcess is not currently active");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (proc.blacklistClosest()) {
|
||||||
|
logDirect("Blacklisted closest instances");
|
||||||
|
} else {
|
||||||
|
logDirect("No known locations, unable to blacklist");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (msg.startsWith("find")) {
|
if (msg.startsWith("find")) {
|
||||||
String blockType = msg.substring(4).trim();
|
String blockType = msg.substring(4).trim();
|
||||||
ArrayList<BlockPos> locs = baritone.getWorldProvider().getCurrentWorld().getCachedWorld().getLocationsOf(blockType, 1, ctx.playerFeet().getX(), ctx.playerFeet().getZ(), 4);
|
ArrayList<BlockPos> locs = baritone.getWorldProvider().getCurrentWorld().getCachedWorld().getLocationsOf(blockType, 1, ctx.playerFeet().getX(), ctx.playerFeet().getZ(), 4);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user