followRadius = new Setting<>(3);
+ /**
+ * true = exploration uses pythagorean distance to choose closest uncached chunk
+ *
+ * false = exploration uses manhattan / taxicab distance to choose
+ */
+ public final Setting exploreUsePythagorean = new Setting<>(false);
+
/**
* Cached chunks (regardless of if they're in RAM or saved to disk) expire and are deleted after this number of seconds
* -1 to disable
@@ -716,9 +733,14 @@ public final class Settings {
this.klass = (Class) value.getClass();
}
- @SuppressWarnings("unchecked")
- public final K get() {
- return (K) value;
+ /**
+ * Deprecated! Please use .value directly instead
+ *
+ * @return the current setting value
+ */
+ @Deprecated
+ public final T get() {
+ return value;
}
public final String getName() {
@@ -734,6 +756,9 @@ public final class Settings {
return SettingsUtil.settingToString(this);
}
+ /**
+ * Reset this setting to its default value
+ */
public void reset() {
value = defaultValue;
}
diff --git a/src/api/java/baritone/api/cache/ICachedWorld.java b/src/api/java/baritone/api/cache/ICachedWorld.java
index a435ebe02..e681ce51c 100644
--- a/src/api/java/baritone/api/cache/ICachedWorld.java
+++ b/src/api/java/baritone/api/cache/ICachedWorld.java
@@ -20,7 +20,7 @@ package baritone.api.cache;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.chunk.Chunk;
-import java.util.LinkedList;
+import java.util.ArrayList;
/**
* @author Brady
@@ -68,7 +68,7 @@ public interface ICachedWorld {
* @param maxRegionDistanceSq The maximum region distance, squared
* @return The locations found that match the special block
*/
- LinkedList getLocationsOf(String block, int maximum, int centerX, int centerZ, int maxRegionDistanceSq);
+ ArrayList getLocationsOf(String block, int maximum, int centerX, int centerZ, int maxRegionDistanceSq);
/**
* Reloads all of the cached regions in this world from disk. Anything that is not saved
diff --git a/src/api/java/baritone/api/pathing/goals/GoalAxis.java b/src/api/java/baritone/api/pathing/goals/GoalAxis.java
index d8811cf9e..7c9b26705 100644
--- a/src/api/java/baritone/api/pathing/goals/GoalAxis.java
+++ b/src/api/java/baritone/api/pathing/goals/GoalAxis.java
@@ -25,7 +25,7 @@ public class GoalAxis implements Goal {
@Override
public boolean isInGoal(int x, int y, int z) {
- return y == BaritoneAPI.getSettings().axisHeight.get() && (x == 0 || z == 0 || Math.abs(x) == Math.abs(z));
+ return y == BaritoneAPI.getSettings().axisHeight.value && (x == 0 || z == 0 || Math.abs(x) == Math.abs(z));
}
@Override
@@ -39,7 +39,7 @@ public class GoalAxis implements Goal {
double flatAxisDistance = Math.min(x, Math.min(z, diff * SQRT_2_OVER_2));
- return flatAxisDistance * BaritoneAPI.getSettings().costHeuristic.get() + GoalYLevel.calculate(BaritoneAPI.getSettings().axisHeight.get(), y);
+ return flatAxisDistance * BaritoneAPI.getSettings().costHeuristic.value + GoalYLevel.calculate(BaritoneAPI.getSettings().axisHeight.value, y);
}
@Override
diff --git a/src/api/java/baritone/api/pathing/goals/GoalXZ.java b/src/api/java/baritone/api/pathing/goals/GoalXZ.java
index 636c649f5..7f8d16abe 100644
--- a/src/api/java/baritone/api/pathing/goals/GoalXZ.java
+++ b/src/api/java/baritone/api/pathing/goals/GoalXZ.java
@@ -80,7 +80,7 @@ public class GoalXZ implements Goal {
diagonal = z;
}
diagonal *= SQRT_2;
- return (diagonal + straight) * BaritoneAPI.getSettings().costHeuristic.get(); // big TODO tune
+ return (diagonal + straight) * BaritoneAPI.getSettings().costHeuristic.value; // big TODO tune
}
public static GoalXZ fromDirection(Vec3d origin, float yaw, double distance) {
diff --git a/src/api/java/baritone/api/utils/SettingsUtil.java b/src/api/java/baritone/api/utils/SettingsUtil.java
index 73517c405..85ee57b88 100644
--- a/src/api/java/baritone/api/utils/SettingsUtil.java
+++ b/src/api/java/baritone/api/utils/SettingsUtil.java
@@ -99,7 +99,7 @@ public class SettingsUtil {
public static List modifiedSettings(Settings settings) {
List modified = new ArrayList<>();
for (Settings.Setting setting : settings.allSettings) {
- if (setting.get() == null) {
+ if (setting.value == null) {
System.out.println("NULL SETTING?" + setting.getName());
continue;
}
@@ -122,7 +122,7 @@ public class SettingsUtil {
if (io == null) {
throw new IllegalStateException("Missing " + setting.getValueClass() + " " + setting.getName());
}
- return setting.getName() + " " + io.toString.apply(setting.get());
+ return setting.getName() + " " + io.toString.apply(setting.value);
}
public static void parseAndApply(Settings settings, String settingName, String settingValue) throws IllegalStateException, NumberFormatException {
diff --git a/src/launch/java/baritone/launch/mixins/MixinChunkRenderContainer.java b/src/launch/java/baritone/launch/mixins/MixinChunkRenderContainer.java
index 1548057d8..1c10cf87f 100644
--- a/src/launch/java/baritone/launch/mixins/MixinChunkRenderContainer.java
+++ b/src/launch/java/baritone/launch/mixins/MixinChunkRenderContainer.java
@@ -42,7 +42,7 @@ public class MixinChunkRenderContainer {
)
)
private BlockPos getPosition(RenderChunk renderChunkIn) {
- if (Baritone.settings().renderCachedChunks.get() && Minecraft.getInstance().getIntegratedServer() == null && Minecraft.getInstance().world.getChunk(renderChunkIn.getPosition()).isEmpty()) {
+ if (Baritone.settings().renderCachedChunks.value && Minecraft.getInstance().getIntegratedServer() == null && Minecraft.getInstance().world.getChunk(renderChunkIn.getPosition()).isEmpty()) {
GlStateManager.enableAlphaTest();
GlStateManager.enableBlend();
GL14.glBlendColor(0, 0, 0, Baritone.settings().cachedChunksOpacity.get());
diff --git a/src/launch/java/baritone/launch/mixins/MixinChunkRenderWorker.java b/src/launch/java/baritone/launch/mixins/MixinChunkRenderWorker.java
index 4b87260db..de934e555 100644
--- a/src/launch/java/baritone/launch/mixins/MixinChunkRenderWorker.java
+++ b/src/launch/java/baritone/launch/mixins/MixinChunkRenderWorker.java
@@ -43,7 +43,7 @@ public abstract class MixinChunkRenderWorker {
)
)
private boolean isChunkExisting(ChunkRenderWorker worker, BlockPos pos, World world) {
- if (Baritone.settings().renderCachedChunks.get() && Minecraft.getInstance().getIntegratedServer() == null) {
+ if (Baritone.settings().renderCachedChunks.value && Minecraft.getInstance().getIntegratedServer() == null) {
Baritone baritone = (Baritone) BaritoneAPI.getProvider().getPrimaryBaritone();
IPlayerContext ctx = baritone.getPlayerContext();
if (ctx.player() != null && ctx.world() != null && baritone.bsi != null) {
diff --git a/src/launch/java/baritone/launch/mixins/MixinRenderChunk.java b/src/launch/java/baritone/launch/mixins/MixinRenderChunk.java
index 792b7a8fd..e37821f06 100644
--- a/src/launch/java/baritone/launch/mixins/MixinRenderChunk.java
+++ b/src/launch/java/baritone/launch/mixins/MixinRenderChunk.java
@@ -50,7 +50,7 @@ public class MixinRenderChunk {
if (!chunkCache.isEmpty()) {
return false;
}
- if (Baritone.settings().renderCachedChunks.get() && Minecraft.getInstance().getIntegratedServer() == null) {
+ if (Baritone.settings().renderCachedChunks.value && Minecraft.getInstance().getIntegratedServer() == null) {
Baritone baritone = (Baritone) BaritoneAPI.getProvider().getPrimaryBaritone();
IPlayerContext ctx = baritone.getPlayerContext();
if (ctx.player() != null && ctx.world() != null && baritone.bsi != null) {
@@ -80,7 +80,7 @@ public class MixinRenderChunk {
)
)
private IBlockState getBlockState(RenderChunkCache chunkCache, BlockPos pos) {
- if (Baritone.settings().renderCachedChunks.get() && Minecraft.getInstance().getIntegratedServer() == null) {
+ if (Baritone.settings().renderCachedChunks.value && Minecraft.getInstance().getIntegratedServer() == null) {
Baritone baritone = (Baritone) BaritoneAPI.getProvider().getPrimaryBaritone();
IPlayerContext ctx = baritone.getPlayerContext();
if (ctx.player() != null && ctx.world() != null && baritone.bsi != null) {
diff --git a/src/launch/java/baritone/launch/mixins/MixinRenderList.java b/src/launch/java/baritone/launch/mixins/MixinRenderList.java
index 651760ec1..a96a438c7 100644
--- a/src/launch/java/baritone/launch/mixins/MixinRenderList.java
+++ b/src/launch/java/baritone/launch/mixins/MixinRenderList.java
@@ -38,7 +38,7 @@ public class MixinRenderList {
)
)
private void popMatrix() {
- if (Baritone.settings().renderCachedChunks.get() && Minecraft.getInstance().getIntegratedServer() == null) {
+ if (Baritone.settings().renderCachedChunks.value && Minecraft.getInstance().getIntegratedServer() == null) {
// reset the blend func to normal (not dependent on constant alpha)
GlStateManager.blendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
}
diff --git a/src/launch/java/baritone/launch/mixins/MixinVboRenderList.java b/src/launch/java/baritone/launch/mixins/MixinVboRenderList.java
index 6ea02a0a1..e7c992850 100644
--- a/src/launch/java/baritone/launch/mixins/MixinVboRenderList.java
+++ b/src/launch/java/baritone/launch/mixins/MixinVboRenderList.java
@@ -38,7 +38,7 @@ public class MixinVboRenderList {
)
)
private void popMatrix() {
- if (Baritone.settings().renderCachedChunks.get() && Minecraft.getInstance().getIntegratedServer() == null) {
+ if (Baritone.settings().renderCachedChunks.value && Minecraft.getInstance().getIntegratedServer() == null) {
// reset the blend func to normal (not dependent on constant alpha)
GlStateManager.blendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
}
diff --git a/src/main/java/baritone/Baritone.java b/src/main/java/baritone/Baritone.java
index d9a9b2f64..0a51e13ed 100755
--- a/src/main/java/baritone/Baritone.java
+++ b/src/main/java/baritone/Baritone.java
@@ -25,10 +25,7 @@ import baritone.api.utils.IPlayerContext;
import baritone.behavior.*;
import baritone.cache.WorldProvider;
import baritone.event.GameEventHandler;
-import baritone.process.CustomGoalProcess;
-import baritone.process.FollowProcess;
-import baritone.process.GetToBlockProcess;
-import baritone.process.MineProcess;
+import baritone.process.*;
import baritone.utils.*;
import baritone.utils.player.PrimaryPlayerContext;
import net.minecraft.client.Minecraft;
@@ -80,6 +77,7 @@ public class Baritone implements IBaritone {
private MineProcess mineProcess;
private GetToBlockProcess getToBlockProcess;
private CustomGoalProcess customGoalProcess;
+ private ExploreProcess exploreProcess;
private PathingControlManager pathingControlManager;
@@ -118,6 +116,7 @@ public class Baritone implements IBaritone {
mineProcess = new MineProcess(this);
customGoalProcess = new CustomGoalProcess(this); // very high iq
getToBlockProcess = new GetToBlockProcess(this);
+ exploreProcess = new ExploreProcess(this);
}
this.worldProvider = new WorldProvider();
@@ -177,6 +176,10 @@ public class Baritone implements IBaritone {
return this.lookBehavior;
}
+ public ExploreProcess getExploreProcess() {
+ return this.exploreProcess;
+ }
+
@Override
public MineProcess getMineProcess() {
return this.mineProcess;
diff --git a/src/main/java/baritone/behavior/InventoryBehavior.java b/src/main/java/baritone/behavior/InventoryBehavior.java
index 8a1ea943c..cb5eb612e 100644
--- a/src/main/java/baritone/behavior/InventoryBehavior.java
+++ b/src/main/java/baritone/behavior/InventoryBehavior.java
@@ -35,7 +35,7 @@ public class InventoryBehavior extends Behavior {
@Override
public void onTick(TickEvent event) {
- if (!Baritone.settings().allowInventory.get()) {
+ if (!Baritone.settings().allowInventory.value) {
return;
}
if (event.getType() == TickEvent.Type.OUT) {
@@ -61,7 +61,7 @@ public class InventoryBehavior extends Behavior {
private int firstValidThrowaway() { // TODO offhand idk
NonNullList invy = ctx.player().inventory.mainInventory;
for (int i = 0; i < invy.size(); i++) {
- if (Baritone.settings().acceptableThrowawayItems.get().contains(invy.get(i).getItem())) {
+ if (Baritone.settings().acceptableThrowawayItems.value.contains(invy.get(i).getItem())) {
return i;
}
}
diff --git a/src/main/java/baritone/behavior/LookBehavior.java b/src/main/java/baritone/behavior/LookBehavior.java
index 345416d37..adce0643d 100644
--- a/src/main/java/baritone/behavior/LookBehavior.java
+++ b/src/main/java/baritone/behavior/LookBehavior.java
@@ -50,7 +50,7 @@ public final class LookBehavior extends Behavior implements ILookBehavior {
@Override
public void updateTarget(Rotation target, boolean force) {
this.target = target;
- this.force = force || !Baritone.settings().freeLook.get();
+ this.force = force || !Baritone.settings().freeLook.value;
}
@Override
@@ -60,7 +60,7 @@ public final class LookBehavior extends Behavior implements ILookBehavior {
}
// Whether or not we're going to silently set our angles
- boolean silent = Baritone.settings().antiCheatCompatibility.get() && !this.force;
+ boolean silent = Baritone.settings().antiCheatCompatibility.value && !this.force;
switch (event.getState()) {
case PRE: {
@@ -106,7 +106,7 @@ public final class LookBehavior extends Behavior implements ILookBehavior {
// If we have antiCheatCompatibility on, we're going to use the target value later in onPlayerUpdate()
// Also the type has to be MOTION_UPDATE because that is called after JUMP
- if (!Baritone.settings().antiCheatCompatibility.get() && event.getType() == RotationMoveEvent.Type.MOTION_UPDATE && !this.force) {
+ if (!Baritone.settings().antiCheatCompatibility.value && event.getType() == RotationMoveEvent.Type.MOTION_UPDATE && !this.force) {
this.target = null;
}
}
diff --git a/src/main/java/baritone/behavior/MemoryBehavior.java b/src/main/java/baritone/behavior/MemoryBehavior.java
index 390ac8592..8d3a0a8c3 100644
--- a/src/main/java/baritone/behavior/MemoryBehavior.java
+++ b/src/main/java/baritone/behavior/MemoryBehavior.java
@@ -65,7 +65,7 @@ public final class MemoryBehavior extends Behavior {
@Override
public synchronized void onTick(TickEvent event) {
- if (!Baritone.settings().containerMemory.get()) {
+ if (!Baritone.settings().containerMemory.value) {
return;
}
if (event.getType() == TickEvent.Type.OUT) {
@@ -83,7 +83,7 @@ public final class MemoryBehavior extends Behavior {
@Override
public synchronized void onSendPacket(PacketEvent event) {
- if (!Baritone.settings().containerMemory.get()) {
+ if (!Baritone.settings().containerMemory.value) {
return;
}
Packet p = event.getPacket();
@@ -122,7 +122,7 @@ public final class MemoryBehavior extends Behavior {
@Override
public synchronized void onReceivePacket(PacketEvent event) {
- if (!Baritone.settings().containerMemory.get()) {
+ if (!Baritone.settings().containerMemory.value) {
return;
}
Packet p = event.getPacket();
@@ -171,7 +171,7 @@ public final class MemoryBehavior extends Behavior {
private void updateInventory() {
- if (!Baritone.settings().containerMemory.get()) {
+ if (!Baritone.settings().containerMemory.value) {
return;
}
int windowId = ctx.player().openContainer.windowId;
diff --git a/src/main/java/baritone/behavior/PathingBehavior.java b/src/main/java/baritone/behavior/PathingBehavior.java
index e9e4d4805..915e50663 100644
--- a/src/main/java/baritone/behavior/PathingBehavior.java
+++ b/src/main/java/baritone/behavior/PathingBehavior.java
@@ -141,6 +141,9 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
logDebug("All done. At " + goal);
queuePathEvent(PathEvent.AT_GOAL);
next = null;
+ if (Baritone.settings().disconnectOnArrival.value) {
+ ctx.world().sendQuittingDisconnectingPacket();
+ }
return;
}
if (next != null && !next.getPath().positions().contains(ctx.playerFeet()) && !next.getPath().positions().contains(expectedSegmentStart)) { // can contain either one
@@ -201,7 +204,7 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
// and this path doesn't get us all the way there
return;
}
- if (ticksRemainingInSegment(false).get() < Baritone.settings().planningTickLookahead.get()) {
+ if (ticksRemainingInSegment(false).get() < Baritone.settings().planningTickLookahead.value) {
// and this path has 7.5 seconds or less left
// don't include the current movement so a very long last movement (e.g. descend) doesn't trip it up
// if we actually included current, it wouldn't start planning ahead until the last movement was done, if the last movement took more than 7.5 seconds on its own
@@ -426,11 +429,11 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
long primaryTimeout;
long failureTimeout;
if (current == null) {
- primaryTimeout = Baritone.settings().primaryTimeoutMS.get();
- failureTimeout = Baritone.settings().failureTimeoutMS.get();
+ primaryTimeout = Baritone.settings().primaryTimeoutMS.value;
+ failureTimeout = Baritone.settings().failureTimeoutMS.value;
} else {
- primaryTimeout = Baritone.settings().planAheadPrimaryTimeoutMS.get();
- failureTimeout = Baritone.settings().planAheadFailureTimeoutMS.get();
+ primaryTimeout = Baritone.settings().planAheadPrimaryTimeoutMS.value;
+ failureTimeout = Baritone.settings().planAheadFailureTimeoutMS.value;
}
CalculationContext context = new CalculationContext(baritone, true); // not safe to create on the other thread, it looks up a lot of stuff in minecraft
AbstractNodeCostSearch pathfinder = createPathfinder(start, goal, current == null ? null : current.getPath(), context);
@@ -494,7 +497,7 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
public static AbstractNodeCostSearch createPathfinder(BlockPos start, Goal goal, IPath previous, CalculationContext context) {
Goal transformed = goal;
- if (Baritone.settings().simplifyUnloadedYCoord.get() && goal instanceof IGoalRenderPos) {
+ if (Baritone.settings().simplifyUnloadedYCoord.value && goal instanceof IGoalRenderPos) {
BlockPos pos = ((IGoalRenderPos) goal).getGoalPos();
if (!context.bsi.worldContainsLoadedChunk(pos.getX(), pos.getZ())) {
transformed = new GoalXZ(pos.getX(), pos.getZ());
diff --git a/src/main/java/baritone/cache/CachedChunk.java b/src/main/java/baritone/cache/CachedChunk.java
index 1a34b2aef..9d3d2b83b 100644
--- a/src/main/java/baritone/cache/CachedChunk.java
+++ b/src/main/java/baritone/cache/CachedChunk.java
@@ -18,6 +18,7 @@
package baritone.cache;
import baritone.utils.pathing.PathingBlockType;
+import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
@@ -119,6 +120,7 @@ public final class CachedChunk {
temp.add(Blocks.COBWEB);
temp.add(Blocks.NETHER_WART);
temp.add(Blocks.LADDER);
+ temp.add(Blocks.VINE);
BLOCKS_TO_KEEP_TRACK_OF = Collections.unmodifiableSet(temp);
// TODO: Lit Furnaces
@@ -153,6 +155,8 @@ public final class CachedChunk {
*/
private final BitSet data;
+ private final Int2ObjectOpenHashMap special;
+
/**
* The block names of each surface level block for generating an overview
*/
@@ -174,12 +178,30 @@ public final class CachedChunk {
this.heightMap = new int[256];
this.specialBlockLocations = specialBlockLocations;
this.cacheTimestamp = cacheTimestamp;
+ if (specialBlockLocations.isEmpty()) {
+ this.special = null;
+ } else {
+ this.special = new Int2ObjectOpenHashMap<>();
+ setSpecial();
+ }
calculateHeightMap();
}
+ private final void setSpecial() {
+ for (Map.Entry> entry : specialBlockLocations.entrySet()) {
+ for (BlockPos pos : entry.getValue()) {
+ special.put(getPositionIndex(pos.getX(), pos.getY(), pos.getZ()), entry.getKey());
+ }
+ }
+ }
+
public final IBlockState getBlock(int x, int y, int z, int dimension) {
+ int index = getPositionIndex(x, y, z);
+ PathingBlockType type = getType(index);
int internalPos = z << 4 | x;
- if (heightMap[internalPos] == y) {
+ if (heightMap[internalPos] == y && type != PathingBlockType.AVOID) {
+ // if the top block in a column is water, we cache it as AVOID but we don't want to just return default state water (which is not flowing) beacuse then it would try to path through it
+
// we have this exact block, it's a surface block
/*System.out.println("Saying that " + x + "," + y + "," + z + " is " + state);
if (!Minecraft.getInstance().world.getBlockState(new BlockPos(x + this.x * 16, y, z + this.z * 16)).getBlock().equals(state.getBlock())) {
@@ -187,15 +209,20 @@ public final class CachedChunk {
}*/
return overview[internalPos];
}
- PathingBlockType type = getType(x, y, z);
+ if (special != null) {
+ String str = special.get(index);
+ if (str != null) {
+ return ChunkPacker.stringToBlock(str).getDefaultState();
+ }
+ }
+
if (type == PathingBlockType.SOLID && y == 127 && dimension == -1) {
return Blocks.BEDROCK.getDefaultState();
}
return ChunkPacker.pathingTypeToBlock(type, dimension);
}
- private PathingBlockType getType(int x, int y, int z) {
- int index = getPositionIndex(x, y, z);
+ private PathingBlockType getType(int index) {
return PathingBlockType.fromBits(data.get(index), data.get(index + 1));
}
@@ -223,11 +250,11 @@ public final class CachedChunk {
return specialBlockLocations;
}
- public final LinkedList getAbsoluteBlocks(String blockType) {
+ public final ArrayList getAbsoluteBlocks(String blockType) {
if (specialBlockLocations.get(blockType) == null) {
return null;
}
- LinkedList res = new LinkedList<>();
+ ArrayList res = new ArrayList<>();
for (BlockPos pos : specialBlockLocations.get(blockType)) {
res.add(new BlockPos(pos.getX() + x * 16, pos.getY(), pos.getZ() + z * 16));
}
diff --git a/src/main/java/baritone/cache/CachedRegion.java b/src/main/java/baritone/cache/CachedRegion.java
index d8426197a..e3a85dfc4 100644
--- a/src/main/java/baritone/cache/CachedRegion.java
+++ b/src/main/java/baritone/cache/CachedRegion.java
@@ -87,19 +87,16 @@ public final class CachedRegion implements ICachedRegion {
return chunks[x >> 4][z >> 4] != null;
}
- public final LinkedList getLocationsOf(String block) {
- LinkedList res = new LinkedList<>();
+ public final ArrayList getLocationsOf(String block) {
+ ArrayList res = new ArrayList<>();
for (int chunkX = 0; chunkX < 32; chunkX++) {
for (int chunkZ = 0; chunkZ < 32; chunkZ++) {
if (chunks[chunkX][chunkZ] == null) {
continue;
}
- List locs = chunks[chunkX][chunkZ].getAbsoluteBlocks(block);
- if (locs == null) {
- continue;
- }
- for (BlockPos pos : locs) {
- res.add(pos);
+ ArrayList locs = chunks[chunkX][chunkZ].getAbsoluteBlocks(block);
+ if (locs != null) {
+ res.addAll(locs);
}
}
}
@@ -306,7 +303,7 @@ public final class CachedRegion implements ICachedRegion {
}
public synchronized final void removeExpired() {
- long expiry = Baritone.settings().cachedChunksExpirySeconds.get();
+ long expiry = Baritone.settings().cachedChunksExpirySeconds.value;
if (expiry < 0) {
return;
}
diff --git a/src/main/java/baritone/cache/CachedWorld.java b/src/main/java/baritone/cache/CachedWorld.java
index db85339de..7e34fa081 100644
--- a/src/main/java/baritone/cache/CachedWorld.java
+++ b/src/main/java/baritone/cache/CachedWorld.java
@@ -32,7 +32,6 @@ import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
-import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.LinkedBlockingQueue;
@@ -108,9 +107,13 @@ public final class CachedWorld implements ICachedWorld, Helper {
return region.isCached(blockX & 511, blockZ & 511);
}
+ public final boolean regionLoaded(int blockX, int blockZ) {
+ return getRegion(blockX >> 9, blockZ >> 9) != null;
+ }
+
@Override
- public final LinkedList getLocationsOf(String block, int maximum, int centerX, int centerZ, int maxRegionDistanceSq) {
- LinkedList res = new LinkedList<>();
+ public final ArrayList getLocationsOf(String block, int maximum, int centerX, int centerZ, int maxRegionDistanceSq) {
+ ArrayList res = new ArrayList<>();
int centerRegionX = centerX >> 9;
int centerRegionZ = centerZ >> 9;
@@ -127,7 +130,7 @@ public final class CachedWorld implements ICachedWorld, Helper {
CachedRegion region = getOrCreateRegion(regionX, regionZ);
if (region != null) {
// TODO: 100% verify if this or addAll is faster.
- region.getLocationsOf(block).forEach(res::add);
+ res.addAll(region.getLocationsOf(block));
}
}
}
@@ -146,7 +149,7 @@ public final class CachedWorld implements ICachedWorld, Helper {
@Override
public final void save() {
- if (!Baritone.settings().chunkCaching.get()) {
+ if (!Baritone.settings().chunkCaching.value) {
System.out.println("Not saving to disk; chunk caching is disabled.");
allRegions().forEach(region -> {
if (region != null) {
@@ -171,7 +174,7 @@ public final class CachedWorld implements ICachedWorld, Helper {
* Delete regions that are too far from the player
*/
private synchronized void prune() {
- if (!Baritone.settings().pruneRegionsFromRAM.get()) {
+ if (!Baritone.settings().pruneRegionsFromRAM.value) {
return;
}
BlockPos pruneCenter = guessPosition();
diff --git a/src/main/java/baritone/cache/ChunkPacker.java b/src/main/java/baritone/cache/ChunkPacker.java
index 90aec3f4a..117b88cd8 100644
--- a/src/main/java/baritone/cache/ChunkPacker.java
+++ b/src/main/java/baritone/cache/ChunkPacker.java
@@ -126,11 +126,17 @@ public final class ChunkPacker {
if (MovementHelper.isWater(state)) {
// only water source blocks are plausibly usable, flowing water should be avoid
// FLOWING_WATER is a waterfall, it doesn't really matter and caching it as AVOID just makes it look wrong
- if (!MovementHelper.possiblyFlowing(state)) {
- return PathingBlockType.WATER;
+ if (MovementHelper.possiblyFlowing(state)) {
+ return PathingBlockType.AVOID;
}
- Vec3d flow = state.getFluidState().getFlow(chunk.getWorld(), new BlockPos(x + chunk.x << 4, y, z + chunk.z << 4));
- if (flow.x != 0.0 || flow.z != 0.0) {
+ if (x == 0 || x == 15 || z == 0 || z == 15) {
+ Vec3d flow = state.getFluidState().getFlow(chunk.getWorld(), new BlockPos(x + chunk.x << 4, y, z + chunk.z << 4));
+ if (flow.x != 0.0 || flow.z != 0.0) {
+ return PathingBlockType.WATER;
+ }
+ return PathingBlockType.AVOID;
+ }
+ if (MovementHelper.possiblyFlowing(chunk.getBlockState(x + 1, y, z)) || MovementHelper.possiblyFlowing(chunk.getBlockState(x - 1, y, z)) || MovementHelper.possiblyFlowing(chunk.getBlockState(x, y, z + 1)) || MovementHelper.possiblyFlowing(chunk.getBlockState(x, y, z - 1))) {
return PathingBlockType.AVOID;
}
return PathingBlockType.WATER;
diff --git a/src/main/java/baritone/cache/ContainerMemory.java b/src/main/java/baritone/cache/ContainerMemory.java
index 466bf710f..c1cb7b34d 100644
--- a/src/main/java/baritone/cache/ContainerMemory.java
+++ b/src/main/java/baritone/cache/ContainerMemory.java
@@ -70,7 +70,7 @@ public class ContainerMemory implements IContainerMemory {
}
public synchronized void save() throws IOException {
- if (!Baritone.settings().containerMemory.get()) {
+ if (!Baritone.settings().containerMemory.value) {
return;
}
ByteBuf buf = Unpooled.buffer(0, Integer.MAX_VALUE);
diff --git a/src/main/java/baritone/pathing/calc/AStarPathFinder.java b/src/main/java/baritone/pathing/calc/AStarPathFinder.java
index fda41cfdc..57e9200de 100644
--- a/src/main/java/baritone/pathing/calc/AStarPathFinder.java
+++ b/src/main/java/baritone/pathing/calc/AStarPathFinder.java
@@ -62,20 +62,20 @@ public final class AStarPathFinder extends AbstractNodeCostSearch {
MutableMoveResult res = new MutableMoveResult();
BetterWorldBorder worldBorder = new BetterWorldBorder(calcContext.world.getWorldBorder());
long startTime = System.currentTimeMillis();
- boolean slowPath = Baritone.settings().slowPath.get();
+ boolean slowPath = Baritone.settings().slowPath.value;
if (slowPath) {
- logDebug("slowPath is on, path timeout will be " + Baritone.settings().slowPathTimeoutMS.get() + "ms instead of " + primaryTimeout + "ms");
+ logDebug("slowPath is on, path timeout will be " + Baritone.settings().slowPathTimeoutMS.value + "ms instead of " + primaryTimeout + "ms");
}
- long primaryTimeoutTime = startTime + (slowPath ? Baritone.settings().slowPathTimeoutMS.get() : primaryTimeout);
- long failureTimeoutTime = startTime + (slowPath ? Baritone.settings().slowPathTimeoutMS.get() : failureTimeout);
+ long primaryTimeoutTime = startTime + (slowPath ? Baritone.settings().slowPathTimeoutMS.value : primaryTimeout);
+ long failureTimeoutTime = startTime + (slowPath ? Baritone.settings().slowPathTimeoutMS.value : failureTimeout);
boolean failing = true;
int numNodes = 0;
int numMovementsConsidered = 0;
int numEmptyChunk = 0;
boolean isFavoring = !favoring.isEmpty();
int timeCheckInterval = 1 << 6;
- int pathingMaxChunkBorderFetch = Baritone.settings().pathingMaxChunkBorderFetch.get(); // grab all settings beforehand so that changing settings during pathing doesn't cause a crash or unpredictable behavior
- double minimumImprovement = Baritone.settings().minimumImprovementRepropagation.get() ? MIN_IMPROVEMENT : 0;
+ int pathingMaxChunkBorderFetch = Baritone.settings().pathingMaxChunkBorderFetch.value; // grab all settings beforehand so that changing settings during pathing doesn't cause a crash or unpredictable behavior
+ double minimumImprovement = Baritone.settings().minimumImprovementRepropagation.value ? MIN_IMPROVEMENT : 0;
while (!openSet.isEmpty() && numEmptyChunk < pathingMaxChunkBorderFetch && !cancelRequested) {
if ((numNodes & (timeCheckInterval - 1)) == 0) { // only call this once every 64 nodes (about half a millisecond)
long now = System.currentTimeMillis(); // since nanoTime is slow on windows (takes many microseconds)
@@ -85,7 +85,7 @@ public final class AStarPathFinder extends AbstractNodeCostSearch {
}
if (slowPath) {
try {
- Thread.sleep(Baritone.settings().slowPathTimeDelayMS.get());
+ Thread.sleep(Baritone.settings().slowPathTimeDelayMS.value);
} catch (InterruptedException ex) {
}
}
diff --git a/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java b/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java
index a9974e8df..a7d104cf1 100644
--- a/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java
+++ b/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java
@@ -87,7 +87,7 @@ public abstract class AbstractNodeCostSearch implements IPathFinder, Helper {
this.startZ = startZ;
this.goal = goal;
this.context = context;
- this.map = new Long2ObjectOpenHashMap<>(Baritone.settings().pathingMapDefaultSize.value, Baritone.settings().pathingMapLoadFactor.get());
+ this.map = new Long2ObjectOpenHashMap<>(Baritone.settings().pathingMapDefaultSize.value, Baritone.settings().pathingMapLoadFactor.value);
}
public void cancel() {
diff --git a/src/main/java/baritone/pathing/movement/CalculationContext.java b/src/main/java/baritone/pathing/movement/CalculationContext.java
index 23d9d8e1c..2cf7eb6a4 100644
--- a/src/main/java/baritone/pathing/movement/CalculationContext.java
+++ b/src/main/java/baritone/pathing/movement/CalculationContext.java
@@ -76,27 +76,27 @@ public class CalculationContext {
this.worldData = (WorldData) baritone.getWorldProvider().getCurrentWorld();
this.bsi = new BlockStateInterface(world, worldData, forUseOnAnotherThread); // TODO TODO TODO
this.toolSet = new ToolSet(player);
- this.hasThrowaway = Baritone.settings().allowPlace.get() && MovementHelper.throwaway(baritone.getPlayerContext(), false);
- this.hasWaterBucket = Baritone.settings().allowWaterBucketFall.get() && InventoryPlayer.isHotbar(player.inventory.getSlotFor(STACK_BUCKET_WATER)) && !world.getDimension().isNether();
- this.canSprint = Baritone.settings().allowSprint.get() && player.getFoodStats().getFoodLevel() > 6;
- this.placeBlockCost = Baritone.settings().blockPlacementPenalty.get();
- this.allowBreak = Baritone.settings().allowBreak.get();
- this.allowParkour = Baritone.settings().allowParkour.get();
- this.allowParkourPlace = Baritone.settings().allowParkourPlace.get();
- this.allowJumpAt256 = Baritone.settings().allowJumpAt256.get();
- this.assumeWalkOnWater = Baritone.settings().assumeWalkOnWater.get();
- this.allowDiagonalDescend = Baritone.settings().allowDiagonalDescend.get();
- this.maxFallHeightNoWater = Baritone.settings().maxFallHeightNoWater.get();
- this.maxFallHeightBucket = Baritone.settings().maxFallHeightBucket.get();
+ this.hasThrowaway = Baritone.settings().allowPlace.value && MovementHelper.throwaway(baritone.getPlayerContext(), false);
+ this.hasWaterBucket = Baritone.settings().allowWaterBucketFall.value && InventoryPlayer.isHotbar(player.inventory.getSlotFor(STACK_BUCKET_WATER)) && !world.getDimension().isNether();
+ this.canSprint = Baritone.settings().allowSprint.value && player.getFoodStats().getFoodLevel() > 6;
+ this.placeBlockCost = Baritone.settings().blockPlacementPenalty.value;
+ this.allowBreak = Baritone.settings().allowBreak.value;
+ this.allowParkour = Baritone.settings().allowParkour.value;
+ this.allowParkourPlace = Baritone.settings().allowParkourPlace.value;
+ this.allowJumpAt256 = Baritone.settings().allowJumpAt256.value;
+ this.assumeWalkOnWater = Baritone.settings().assumeWalkOnWater.value;
+ this.allowDiagonalDescend = Baritone.settings().allowDiagonalDescend.value;
+ this.maxFallHeightNoWater = Baritone.settings().maxFallHeightNoWater.value;
+ this.maxFallHeightBucket = Baritone.settings().maxFallHeightBucket.value;
int depth = EnchantmentHelper.getDepthStriderModifier(player);
if (depth > 3) {
depth = 3;
}
float mult = depth / 3.0F;
this.waterWalkSpeed = ActionCosts.WALK_ONE_IN_WATER_COST * (1 - mult) + ActionCosts.WALK_ONE_BLOCK_COST * mult;
- this.breakBlockAdditionalCost = Baritone.settings().blockBreakAdditionalPenalty.get();
- this.jumpPenalty = Baritone.settings().jumpPenalty.get();
- this.walkOnWaterOnePenalty = Baritone.settings().walkOnWaterOnePenalty.get();
+ this.breakBlockAdditionalCost = Baritone.settings().blockBreakAdditionalPenalty.value;
+ this.jumpPenalty = Baritone.settings().jumpPenalty.value;
+ this.walkOnWaterOnePenalty = Baritone.settings().walkOnWaterOnePenalty.value;
// why cache these things here, why not let the movements just get directly from settings?
// because if some movements are calculated one way and others are calculated another way,
// then you get a wildly inconsistent path that isn't optimal for either scenario.
diff --git a/src/main/java/baritone/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java
index 5782ee253..c45d5ecda 100644
--- a/src/main/java/baritone/pathing/movement/MovementHelper.java
+++ b/src/main/java/baritone/pathing/movement/MovementHelper.java
@@ -122,7 +122,7 @@ public interface MovementHelper extends ActionCosts, Helper {
}
IFluidState fluidState = state.getFluidState();
if (fluidState.getFluid() instanceof WaterFluid) {
- if (Baritone.settings().assumeWalkOnWater.get()) {
+ if (Baritone.settings().assumeWalkOnWater.value) {
return false;
}
IBlockState up = bsi.get0(x, y + 1, z);
@@ -283,7 +283,7 @@ public interface MovementHelper extends ActionCosts, Helper {
if (state.isBlockNormalCube()) {
return true;
}
- if (block == Blocks.LADDER || (block == Blocks.VINE && Baritone.settings().allowVines.get())) { // TODO reconsider this
+ if (block == Blocks.LADDER || (block == Blocks.VINE && Baritone.settings().allowVines.value)) { // TODO reconsider this
return true;
}
if (block == Blocks.FARMLAND || block == Blocks.GRASS_PATH) {
@@ -302,17 +302,17 @@ public interface MovementHelper extends ActionCosts, Helper {
}
if (isFlowing(x, y, z, state, bsi) || upState.getFluidState().getFluid() == Fluids.FLOWING_WATER) {
// the only scenario in which we can walk on flowing water is if it's under still water with jesus off
- return isWater(upState) && !Baritone.settings().assumeWalkOnWater.get();
+ return isWater(upState) && !Baritone.settings().assumeWalkOnWater.value;
}
// if assumeWalkOnWater is on, we can only walk on water if there isn't water above it
// if assumeWalkOnWater is off, we can only walk on water if there is water above it
- return isWater(upState) ^ Baritone.settings().assumeWalkOnWater.get();
+ return isWater(upState) ^ Baritone.settings().assumeWalkOnWater.value;
}
if (block == Blocks.GLASS || block instanceof BlockStainedGlass) {
return true;
}
if (block instanceof BlockSlab) {
- if (!Baritone.settings().allowWalkOnBottomSlab.get()) {
+ if (!Baritone.settings().allowWalkOnBottomSlab.value) {
return state.isTopSolid();
}
return true;
@@ -420,14 +420,14 @@ public interface MovementHelper extends ActionCosts, Helper {
// and then it's called during execution
// since this function is never called during cost calculation, we don't need to migrate
// acceptableThrowawayItems to the CalculationContext
- if (Baritone.settings().acceptableThrowawayItems.get().contains(item.getItem())) {
+ if (Baritone.settings().acceptableThrowawayItems.value.contains(item.getItem())) {
if (select) {
p.inventory.currentItem = i;
}
return true;
}
}
- if (Baritone.settings().acceptableThrowawayItems.get().contains(p.inventory.offHandInventory.get(0).getItem())) {
+ if (Baritone.settings().acceptableThrowawayItems.value.contains(p.inventory.offHandInventory.get(0).getItem())) {
// main hand takes precedence over off hand
// that means that if we have block A selected in main hand and block B in off hand, right clicking places block B
// we've already checked above ^ and the main hand can't possible have an acceptablethrowawayitem
diff --git a/src/main/java/baritone/pathing/movement/movements/MovementAscend.java b/src/main/java/baritone/pathing/movement/movements/MovementAscend.java
index 5bb6281fe..3dc65990f 100644
--- a/src/main/java/baritone/pathing/movement/movements/MovementAscend.java
+++ b/src/main/java/baritone/pathing/movement/movements/MovementAscend.java
@@ -176,7 +176,7 @@ public class MovementAscend extends Movement {
return state; // don't jump while walking from a non double slab into a bottom slab
}
- if (Baritone.settings().assumeStep.get() || ctx.playerFeet().equals(src.up())) {
+ if (Baritone.settings().assumeStep.value || ctx.playerFeet().equals(src.up())) {
// no need to hit space if we're already jumping
return state;
}
diff --git a/src/main/java/baritone/pathing/movement/movements/MovementDescend.java b/src/main/java/baritone/pathing/movement/movements/MovementDescend.java
index 84a89bcb7..1ef098d8f 100644
--- a/src/main/java/baritone/pathing/movement/movements/MovementDescend.java
+++ b/src/main/java/baritone/pathing/movement/movements/MovementDescend.java
@@ -202,7 +202,8 @@ public class MovementDescend extends Movement {
}
BlockPos playerFeet = ctx.playerFeet();
- if (playerFeet.equals(dest) && (MovementHelper.isLiquid(ctx, dest) || ctx.player().posY - playerFeet.getY() < 0.094)) { // lilypads
+ BlockPos fakeDest = new BlockPos(dest.getX() * 2 - src.getX(), dest.getY(), dest.getZ() * 2 - src.getZ());
+ if ((playerFeet.equals(dest) || playerFeet.equals(fakeDest)) && (MovementHelper.isLiquid(ctx, dest) || ctx.player().posY - dest.getY() < 0.5)) { // lilypads
// Wait until we're actually on the ground before saying we're done because sometimes we continue to fall if the next action starts immediately
return state.setStatus(MovementStatus.SUCCESS);
/* else {
@@ -228,12 +229,8 @@ public class MovementDescend extends Movement {
double z = ctx.player().posZ - (src.getZ() + 0.5);
double fromStart = Math.sqrt(x * x + z * z);
if (!playerFeet.equals(dest) || ab > 0.25) {
- BlockPos fakeDest = new BlockPos(dest.getX() * 2 - src.getX(), dest.getY(), dest.getZ() * 2 - src.getZ());
- if (numTicks++ < 20) {
+ if (numTicks++ < 20 && fromStart < 1.25) {
MovementHelper.moveTowards(ctx, state, fakeDest);
- if (fromStart > 1.25) {
- state.getTarget().rotation = new Rotation(state.getTarget().rotation.getYaw() + 180F, state.getTarget().rotation.getPitch());
- }
} else {
MovementHelper.moveTowards(ctx, state, dest);
}
diff --git a/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java b/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java
index a360ba450..be8d92746 100644
--- a/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java
+++ b/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java
@@ -183,7 +183,7 @@ public class MovementDiagonal extends Movement {
}
public boolean sprint() {
- if (MovementHelper.isLiquid(ctx, ctx.playerFeet()) && !Baritone.settings().sprintInWater.get()) {
+ if (MovementHelper.isLiquid(ctx, ctx.playerFeet()) && !Baritone.settings().sprintInWater.value) {
return false;
}
for (int i = 0; i < 4; i++) {
diff --git a/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java b/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java
index 3203b0880..87d764634 100644
--- a/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java
+++ b/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java
@@ -155,7 +155,7 @@ public class MovementTraverse extends Movement {
super.updateState(state);
if (state.getStatus() != MovementStatus.RUNNING) {
// if the setting is enabled
- if (!Baritone.settings().walkWhileBreaking.get()) {
+ if (!Baritone.settings().walkWhileBreaking.value) {
return state;
}
// and if we're prepping (aka mining the block in front)
@@ -234,10 +234,17 @@ public class MovementTraverse extends Movement {
if (ctx.playerFeet().equals(dest)) {
return state.setStatus(MovementStatus.SUCCESS);
}
+ Block low = BlockStateInterface.get(ctx, src).getBlock();
+ Block high = BlockStateInterface.get(ctx, src.up()).getBlock();
+ if (!ctx.player().onGround && (low == Blocks.VINE || low == Blocks.LADDER || high == Blocks.VINE || high == Blocks.LADDER)) {
+ // hitting W could cause us to climb the ladder instead of going forward
+ // wait until we're on the ground
+ return state;
+ }
BlockPos into = dest.subtract(src).add(dest);
IBlockState intoBelow = BlockStateInterface.get(ctx, into);
IBlockState intoAbove = BlockStateInterface.get(ctx, into.up());
- if (wasTheBridgeBlockAlwaysThere && (!MovementHelper.isLiquid(ctx, ctx.playerFeet()) || Baritone.settings().sprintInWater.get()) && (!MovementHelper.avoidWalkingInto(intoBelow) || MovementHelper.isWater(intoBelow)) && !MovementHelper.avoidWalkingInto(intoAbove)) {
+ if (wasTheBridgeBlockAlwaysThere && (!MovementHelper.isLiquid(ctx, ctx.playerFeet()) || Baritone.settings().sprintInWater.value) && (!MovementHelper.avoidWalkingInto(intoBelow) || MovementHelper.isWater(intoBelow)) && !MovementHelper.avoidWalkingInto(intoAbove)) {
state.setInput(Input.SPRINT, true);
}
Block destDown = BlockStateInterface.get(ctx, dest.down()).getBlock();
@@ -260,12 +267,12 @@ public class MovementTraverse extends Movement {
}
double dist1 = Math.max(Math.abs(ctx.player().posX - (dest.getX() + 0.5D)), Math.abs(ctx.player().posZ - (dest.getZ() + 0.5D)));
PlaceResult p = MovementHelper.attemptToPlaceABlock(state, baritone, dest.down(), false);
- if ((p == PlaceResult.READY_TO_PLACE || dist1 < 0.6) && !Baritone.settings().assumeSafeWalk.get()) {
+ if ((p == PlaceResult.READY_TO_PLACE || dist1 < 0.6) && !Baritone.settings().assumeSafeWalk.value) {
state.setInput(Input.SNEAK, true);
}
switch (p) {
case READY_TO_PLACE: {
- if (ctx.player().isSneaking() || Baritone.settings().assumeSafeWalk.get()) {
+ if (ctx.player().isSneaking() || Baritone.settings().assumeSafeWalk.value) {
state.setInput(Input.CLICK_RIGHT, true);
}
return state;
@@ -339,4 +346,4 @@ public class MovementTraverse extends Movement {
}
return super.prepared(state);
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/baritone/pathing/path/PathExecutor.java b/src/main/java/baritone/pathing/path/PathExecutor.java
index 1d4baa86a..e34f74edb 100644
--- a/src/main/java/baritone/pathing/path/PathExecutor.java
+++ b/src/main/java/baritone/pathing/path/PathExecutor.java
@@ -229,7 +229,7 @@ public class PathExecutor implements IPathExecutor, Helper {
costEstimateIndex = pathPosition;
// do this only once, when the movement starts, and deliberately get the cost as cached when this path was calculated, not the cost as it is right now
currentMovementOriginalCostEstimate = movement.getCost();
- for (int i = 1; i < Baritone.settings().costVerificationLookahead.get() && pathPosition + i < path.length() - 1; i++) {
+ for (int i = 1; i < Baritone.settings().costVerificationLookahead.value && pathPosition + i < path.length() - 1; i++) {
if (path.movements().get(pathPosition + i).calculateCostWithoutCaching() >= ActionCosts.COST_INF && canCancel) {
logDebug("Something has changed in the world and a future movement has become impossible. Cancelling.");
cancel();
@@ -243,7 +243,7 @@ public class PathExecutor implements IPathExecutor, Helper {
cancel();
return true;
}
- if (!movement.calculatedWhileLoaded() && currentCost - currentMovementOriginalCostEstimate > Baritone.settings().maxCostIncrease.get() && canCancel) {
+ if (!movement.calculatedWhileLoaded() && currentCost - currentMovementOriginalCostEstimate > Baritone.settings().maxCostIncrease.value && canCancel) {
// don't do this if the movement was calculated while loaded
// that means that this isn't a cache error, it's just part of the path interfering with a later part
logDebug("Original cost " + currentMovementOriginalCostEstimate + " current cost " + currentCost + ". Cancelling.");
@@ -273,7 +273,7 @@ public class PathExecutor implements IPathExecutor, Helper {
ctx.player().setSprinting(false); // letting go of control doesn't make you stop sprinting actually
}
ticksOnCurrent++;
- if (ticksOnCurrent > currentMovementOriginalCostEstimate + Baritone.settings().movementTimeoutTicks.get()) {
+ if (ticksOnCurrent > currentMovementOriginalCostEstimate + Baritone.settings().movementTimeoutTicks.value) {
// only cancel if the total time has exceeded the initial estimate
// as you break the blocks required, the remaining cost goes down, to the point where
// ticksOnCurrent is greater than recalculateCost + 100
@@ -527,7 +527,7 @@ public class PathExecutor implements IPathExecutor, Helper {
}
private static boolean sprintableAscend(IPlayerContext ctx, MovementTraverse current, MovementAscend next, IMovement nextnext) {
- if (!Baritone.settings().sprintAscends.get()) {
+ if (!Baritone.settings().sprintAscends.value) {
return false;
}
if (!current.getDirection().equals(next.getDirection().down())) {
@@ -569,7 +569,7 @@ public class PathExecutor implements IPathExecutor, Helper {
if (next instanceof MovementTraverse && next.getDirection().down().equals(current.getDirection()) && MovementHelper.canWalkOn(ctx, next.getDest().down())) {
return true;
}
- return next instanceof MovementDiagonal && Baritone.settings().allowOvershootDiagonalDescend.get();
+ return next instanceof MovementDiagonal && Baritone.settings().allowOvershootDiagonalDescend.value;
}
private void onChangeInPathPosition() {
@@ -612,8 +612,8 @@ public class PathExecutor implements IPathExecutor, Helper {
}
private PathExecutor cutIfTooLong() {
- if (pathPosition > Baritone.settings().maxPathHistoryLength.get()) {
- int cutoffAmt = Baritone.settings().pathHistoryCutoffAmount.get();
+ if (pathPosition > Baritone.settings().maxPathHistoryLength.value) {
+ int cutoffAmt = Baritone.settings().pathHistoryCutoffAmount.value;
CutoffPath newPath = new CutoffPath(path, cutoffAmt, path.length() - 1);
if (!newPath.getDest().equals(path.getDest())) {
throw new IllegalStateException();
diff --git a/src/main/java/baritone/process/CustomGoalProcess.java b/src/main/java/baritone/process/CustomGoalProcess.java
index 00d3c8025..a62342273 100644
--- a/src/main/java/baritone/process/CustomGoalProcess.java
+++ b/src/main/java/baritone/process/CustomGoalProcess.java
@@ -55,6 +55,9 @@ public class CustomGoalProcess extends BaritoneProcessHelper implements ICustomG
if (this.state == State.NONE) {
this.state = State.GOAL_SET;
}
+ if (this.state == State.EXECUTING) {
+ this.state = State.PATH_REQUESTED;
+ }
}
@Override
diff --git a/src/main/java/baritone/process/ExploreProcess.java b/src/main/java/baritone/process/ExploreProcess.java
new file mode 100644
index 000000000..3f8d0f825
--- /dev/null
+++ b/src/main/java/baritone/process/ExploreProcess.java
@@ -0,0 +1,100 @@
+/*
+ * 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.process;
+
+import baritone.Baritone;
+import baritone.api.cache.ICachedWorld;
+import baritone.api.pathing.goals.GoalXZ;
+import baritone.api.process.PathingCommand;
+import baritone.api.process.PathingCommandType;
+import baritone.cache.CachedWorld;
+import baritone.utils.BaritoneProcessHelper;
+import net.minecraft.util.math.BlockPos;
+
+public class ExploreProcess extends BaritoneProcessHelper {
+
+ private BlockPos explorationOrigin;
+
+ public ExploreProcess(Baritone baritone) {
+ super(baritone, 0);
+ }
+
+ @Override
+ public boolean isActive() {
+ return explorationOrigin != null;
+ }
+
+ public void explore(int centerX, int centerZ) {
+ explorationOrigin = new BlockPos(centerX, 0, centerZ);
+ }
+
+ @Override
+ public PathingCommand onTick(boolean calcFailed, boolean isSafeToCancel) {
+ if (calcFailed) {
+ logDirect("Failed");
+ onLostControl();
+ return null;
+ }
+ BlockPos closestUncached = closestUncachedChunk(explorationOrigin);
+ if (closestUncached == null) {
+ logDebug("awaiting region load from disk");
+ return new PathingCommand(null, PathingCommandType.REQUEST_PAUSE);
+ }
+ System.out.println("Closest uncached: " + closestUncached);
+ return new PathingCommand(new GoalXZ(closestUncached.getX(), closestUncached.getZ()), PathingCommandType.FORCE_REVALIDATE_GOAL_AND_PATH);
+ }
+
+ private BlockPos closestUncachedChunk(BlockPos pos) {
+ int chunkX = pos.getX() >> 4;
+ int chunkZ = pos.getZ() >> 4;
+ ICachedWorld cache = baritone.getWorldProvider().getCurrentWorld().getCachedWorld();
+ for (int dist = 0; ; dist++) {
+ for (int dx = -dist; dx <= dist; dx++) {
+ for (int dz = -dist; dz <= dist; dz++) {
+ int trueDist = Baritone.settings().exploreUsePythagorean.value ? dx * dx + dz + dz : Math.abs(dx) + Math.abs(dz);
+ if (trueDist != dist) {
+ continue; // not considering this one just yet in our expanding search
+ }
+ int centerX = (chunkX + dx) * 16 + 8;
+ int centerZ = (chunkZ + dz) * 18 + 8;
+
+ if (cache.isCached(centerX, centerZ)) {
+ continue;
+ }
+ if (!((CachedWorld) cache).regionLoaded(centerX, centerZ)) {
+ Baritone.getExecutor().execute(() -> {
+ ((CachedWorld) cache).tryLoadFromDisk(centerX >> 9, centerZ >> 9);
+ });
+ return null; // we still need to load regions from disk in order to decide properly
+ }
+ return new BlockPos(centerX, 0, centerZ);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void onLostControl() {
+ explorationOrigin = null;
+ }
+
+ @Override
+ public String displayName() {
+ return "Exploring around " + explorationOrigin + ", currently going to " + closestUncachedChunk(explorationOrigin);
+ }
+}
diff --git a/src/main/java/baritone/process/FollowProcess.java b/src/main/java/baritone/process/FollowProcess.java
index 013f1ffa9..07ba35b5c 100644
--- a/src/main/java/baritone/process/FollowProcess.java
+++ b/src/main/java/baritone/process/FollowProcess.java
@@ -58,13 +58,13 @@ public final class FollowProcess extends BaritoneProcessHelper implements IFollo
private Goal towards(Entity following) {
BlockPos pos;
- if (Baritone.settings().followOffsetDistance.get() == 0) {
+ if (Baritone.settings().followOffsetDistance.value == 0) {
pos = new BlockPos(following);
} else {
- GoalXZ g = GoalXZ.fromDirection(following.getPositionVector(), Baritone.settings().followOffsetDirection.get(), Baritone.settings().followOffsetDistance.get());
+ GoalXZ g = GoalXZ.fromDirection(following.getPositionVector(), Baritone.settings().followOffsetDirection.value, Baritone.settings().followOffsetDistance.value);
pos = new BlockPos(g.getX(), following.posY, g.getZ());
}
- return new GoalNear(pos, Baritone.settings().followRadius.get());
+ return new GoalNear(pos, Baritone.settings().followRadius.value);
}
diff --git a/src/main/java/baritone/process/GetToBlockProcess.java b/src/main/java/baritone/process/GetToBlockProcess.java
index db3769c68..3f1ab075f 100644
--- a/src/main/java/baritone/process/GetToBlockProcess.java
+++ b/src/main/java/baritone/process/GetToBlockProcess.java
@@ -67,7 +67,7 @@ public class GetToBlockProcess extends BaritoneProcessHelper implements IGetToBl
rescan(new ArrayList<>(), new CalculationContext(baritone));
}
if (knownLocations.isEmpty()) {
- if (Baritone.settings().exploreForBlocks.get() && !calcFailed) {
+ if (Baritone.settings().exploreForBlocks.value && !calcFailed) {
return new PathingCommand(new GoalRunAway(1, start) {
@Override
public boolean isInGoal(int x, int y, int z) {
@@ -83,7 +83,7 @@ public class GetToBlockProcess extends BaritoneProcessHelper implements IGetToBl
}
Goal goal = new GoalComposite(knownLocations.stream().map(this::createGoal).toArray(Goal[]::new));
if (calcFailed) {
- if (Baritone.settings().blacklistOnGetToBlockFailure.get()) {
+ if (Baritone.settings().blacklistOnGetToBlockFailure.value) {
logDirect("Unable to find any path to " + gettingTo + ", blacklisting presumably unreachable closest instances");
blacklistClosest();
return onTick(false, isSafeToCancel); // gamer moment
@@ -95,7 +95,7 @@ public class GetToBlockProcess extends BaritoneProcessHelper implements IGetToBl
return new PathingCommand(goal, PathingCommandType.CANCEL_AND_SET_GOAL);
}
}
- int mineGoalUpdateInterval = Baritone.settings().mineGoalUpdateInterval.get();
+ int mineGoalUpdateInterval = Baritone.settings().mineGoalUpdateInterval.value;
if (mineGoalUpdateInterval != 0 && tickCount++ % mineGoalUpdateInterval == 0) { // big brain
List current = new ArrayList<>(knownLocations);
CalculationContext context = new CalculationContext(baritone, true);
@@ -200,14 +200,14 @@ public class GetToBlockProcess extends BaritoneProcessHelper implements IGetToBl
}
private boolean walkIntoInsteadOfAdjacent(Block block) {
- if (!Baritone.settings().enterPortal.get()) {
+ if (!Baritone.settings().enterPortal.value) {
return false;
}
return block == Blocks.NETHER_PORTAL;
}
private boolean rightClickOnArrival(Block block) {
- if (!Baritone.settings().rightClickContainerOnArrival.get()) {
+ if (!Baritone.settings().rightClickContainerOnArrival.value) {
return false;
}
return block == Blocks.CRAFTING_TABLE || block == Blocks.FURNACE || block == Blocks.ENDER_CHEST || block == Blocks.CHEST || block == Blocks.TRAPPED_CHEST;
diff --git a/src/main/java/baritone/process/MineProcess.java b/src/main/java/baritone/process/MineProcess.java
index 2347424cd..60c316660 100644
--- a/src/main/java/baritone/process/MineProcess.java
+++ b/src/main/java/baritone/process/MineProcess.java
@@ -86,13 +86,13 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
cancel();
return null;
}
- int mineGoalUpdateInterval = Baritone.settings().mineGoalUpdateInterval.get();
+ int mineGoalUpdateInterval = Baritone.settings().mineGoalUpdateInterval.value;
if (mineGoalUpdateInterval != 0 && tickCount++ % mineGoalUpdateInterval == 0) { // big brain
List curr = new ArrayList<>(knownOreLocations);
CalculationContext context = new CalculationContext(baritone, true);
Baritone.getExecutor().execute(() -> rescan(curr, context));
}
- if (Baritone.settings().legitMine.get()) {
+ if (Baritone.settings().legitMine.value) {
addNearby();
}
PathingCommand command = updateGoal();
@@ -116,7 +116,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
}
private PathingCommand updateGoal() {
- boolean legit = Baritone.settings().legitMine.get();
+ boolean legit = Baritone.settings().legitMine.value;
List locs = knownOreLocations;
if (!locs.isEmpty()) {
List locs2 = prune(new CalculationContext(baritone), new ArrayList<>(locs), mining, ORE_LOCATIONS_COUNT);
@@ -130,7 +130,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
return null;
}
// only in non-Xray mode (aka legit mode) do we do this
- int y = Baritone.settings().legitMineYLevel.get();
+ int y = Baritone.settings().legitMineYLevel.value;
if (branchPoint == null) {
/*if (!baritone.getPathingBehavior().isPathing() && playerFeet().y == y) {
// cool, path is over and we are at desired y
@@ -158,7 +158,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
if (mining == null) {
return;
}
- if (Baritone.settings().legitMine.get()) {
+ if (Baritone.settings().legitMine.value) {
return;
}
List locs = searchWorld(context, mining, ORE_LOCATIONS_COUNT, already);
@@ -172,18 +172,18 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
}
private static Goal coalesce(IPlayerContext ctx, BlockPos loc, List locs) {
- if (!Baritone.settings().forceInternalMining.get()) {
+ if (!Baritone.settings().forceInternalMining.value) {
return new GoalTwoBlocks(loc);
}
// Here, BlockStateInterface is used because the position may be in a cached chunk (the targeted block is one that is kept track of)
- boolean upwardGoal = locs.contains(loc.up()) || (Baritone.settings().internalMiningAirException.get() && BlockStateInterface.getBlock(ctx, loc.up()) == Blocks.AIR);
- boolean downwardGoal = locs.contains(loc.down()) || (Baritone.settings().internalMiningAirException.get() && BlockStateInterface.getBlock(ctx, loc.down()) == Blocks.AIR);
+ boolean upwardGoal = locs.contains(loc.up()) || (Baritone.settings().internalMiningAirException.value && BlockStateInterface.getBlock(ctx, loc.up()) == Blocks.AIR);
+ boolean downwardGoal = locs.contains(loc.down()) || (Baritone.settings().internalMiningAirException.value && BlockStateInterface.getBlock(ctx, loc.down()) == Blocks.AIR);
return upwardGoal == downwardGoal ? new GoalTwoBlocks(loc) : upwardGoal ? new GoalBlock(loc) : new GoalBlock(loc.down());
}
public static List droppedItemsScan(List mining, World world) {
- if (!Baritone.settings().mineScanDroppedItems.get()) {
+ if (!Baritone.settings().mineScanDroppedItems.value) {
return new ArrayList<>();
}
Set- searchingFor = new HashSet<>();
@@ -211,7 +211,8 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
//long b = System.currentTimeMillis();
for (Block m : mining) {
if (CachedChunk.BLOCKS_TO_KEEP_TRACK_OF.contains(m)) {
- locs.addAll(ctx.worldData.getCachedWorld().getLocationsOf(ChunkPacker.blockToString(m), 1, ctx.getBaritone().getPlayerContext().playerFeet().getX(), ctx.getBaritone().getPlayerContext().playerFeet().getZ(), 2));
+ // maxRegionDistanceSq 2 means adjacent directly or adjacent diagonally; nothing further than that
+ locs.addAll(ctx.worldData.getCachedWorld().getLocationsOf(ChunkPacker.blockToString(m), Baritone.settings().maxCachedWorldScanCount.value, ctx.getBaritone().getPlayerContext().playerFeet().getX(), ctx.getBaritone().getPlayerContext().playerFeet().getZ(), 2));
} else {
uninteresting.add(m);
}
@@ -222,7 +223,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
}
if (!uninteresting.isEmpty()) {
//long before = System.currentTimeMillis();
- locs.addAll(WorldScanner.INSTANCE.scanChunkRadius(ctx.getBaritone().getPlayerContext(), uninteresting, max, 10, 26));
+ locs.addAll(WorldScanner.INSTANCE.scanChunkRadius(ctx.getBaritone().getPlayerContext(), uninteresting, max, 10, 32)); // maxSearchRadius is NOT sq
//System.out.println("Scan of loaded chunks took " + (System.currentTimeMillis() - before) + "ms");
}
locs.addAll(alreadyKnown);
@@ -242,7 +243,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
// is an x-ray and it'll get caught
if (mining.contains(bsi.get0(x, y, z).getBlock())) {
BlockPos pos = new BlockPos(x, y, z);
- if ((Baritone.settings().legitMineIncludeDiagonals.get() && knownOreLocations.stream().anyMatch(ore -> ore.distanceSq(pos) <= 2 /* sq means this is pytha dist <= sqrt(2) */)) || RotationUtils.reachable(ctx.player(), pos, fakedBlockReachDistance).isPresent()) {
+ if ((Baritone.settings().legitMineIncludeDiagonals.value && knownOreLocations.stream().anyMatch(ore -> ore.distanceSq(pos) <= 2 /* sq means this is pytha dist <= sqrt(2) */)) || RotationUtils.reachable(ctx.player(), pos, fakedBlockReachDistance).isPresent()) {
knownOreLocations.add(pos);
}
}
diff --git a/src/main/java/baritone/utils/BlockPlaceHelper.java b/src/main/java/baritone/utils/BlockPlaceHelper.java
index 904417413..b7557abf5 100644
--- a/src/main/java/baritone/utils/BlockPlaceHelper.java
+++ b/src/main/java/baritone/utils/BlockPlaceHelper.java
@@ -21,7 +21,6 @@ import baritone.Baritone;
import baritone.api.utils.IPlayerContext;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
-import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
public class BlockPlaceHelper implements Helper {
@@ -38,13 +37,12 @@ public class BlockPlaceHelper implements Helper {
return;
}
RayTraceResult mouseOver = ctx.objectMouseOver();
- BlockPos pos = mouseOver.getBlockPos();
- if (!rightClickRequested || ctx.player().isRowingBoat() || pos == null || mouseOver.type != RayTraceResult.Type.BLOCK) {
+ if (!rightClickRequested || ctx.player().isRowingBoat() || mouseOver == null || mouseOver.getBlockPos() == null || mouseOver.type != RayTraceResult.Type.BLOCK) {
return;
}
- rightClickTimer = Baritone.settings().rightClickSpeed.get();
+ rightClickTimer = Baritone.settings().rightClickSpeed.value;
for (EnumHand hand : EnumHand.values()) {
- if (ctx.playerController().processRightClickBlock(ctx.player(), ctx.world(), pos, mouseOver.sideHit, mouseOver.hitVec, hand) == EnumActionResult.SUCCESS) {
+ if (ctx.playerController().processRightClickBlock(ctx.player(), ctx.world(), mouseOver.getBlockPos(), mouseOver.sideHit, mouseOver.hitVec, hand) == EnumActionResult.SUCCESS) {
ctx.player().swingArm(hand);
return;
}
diff --git a/src/main/java/baritone/utils/BlockStateInterface.java b/src/main/java/baritone/utils/BlockStateInterface.java
index e49cff757..ebb16809d 100644
--- a/src/main/java/baritone/utils/BlockStateInterface.java
+++ b/src/main/java/baritone/utils/BlockStateInterface.java
@@ -66,7 +66,7 @@ public class BlockStateInterface {
} else {
this.loadedChunks = worldLoaded; // this will only be used on the main thread
}
- this.useTheRealWorld = !Baritone.settings().pathThroughCachedOnly.get();
+ this.useTheRealWorld = !Baritone.settings().pathThroughCachedOnly.value;
if (!Minecraft.getInstance().isCallingFromMinecraftThread()) {
throw new IllegalStateException();
}
diff --git a/src/main/java/baritone/utils/ExampleBaritoneControl.java b/src/main/java/baritone/utils/ExampleBaritoneControl.java
index 6986cca13..4a645520e 100644
--- a/src/main/java/baritone/utils/ExampleBaritoneControl.java
+++ b/src/main/java/baritone/utils/ExampleBaritoneControl.java
@@ -89,14 +89,14 @@ public class ExampleBaritoneControl extends Behavior implements Helper {
@Override
public void onSendChatMessage(ChatEvent event) {
String msg = event.getMessage();
- if (Baritone.settings().prefixControl.get() && msg.startsWith(COMMAND_PREFIX)) {
+ if (Baritone.settings().prefixControl.value && msg.startsWith(COMMAND_PREFIX)) {
if (!runCommand(msg.substring(COMMAND_PREFIX.length()))) {
logDirect("Invalid command");
}
event.cancel(); // always cancel if using prefixControl
return;
}
- if (!Baritone.settings().chatControl.get() && !Baritone.settings().removePrefix.get()) {
+ if (!Baritone.settings().chatControl.value && !Baritone.settings().removePrefix.value) {
return;
}
if (runCommand(msg)) {
@@ -374,9 +374,24 @@ public class ExampleBaritoneControl extends Behavior implements Helper {
logDirect("ok");
return true;
}
+ if (msg.startsWith("explore")) {
+ String rest = msg.substring("explore".length()).trim();
+ int centerX;
+ int centerZ;
+ try {
+ centerX = Integer.parseInt(rest.split(" ")[0]);
+ centerZ = Integer.parseInt(rest.split(" ")[1]);
+ } catch (Exception ex) {
+ centerX = ctx.playerFeet().x;
+ centerZ = ctx.playerFeet().z;
+ }
+ baritone.getExploreProcess().explore(centerX, centerZ);
+ logDirect("Exploring from " + centerX + "," + centerZ);
+ return true;
+ }
if (msg.startsWith("find")) {
String blockType = msg.substring(4).trim();
- LinkedList locs = baritone.getWorldProvider().getCurrentWorld().getCachedWorld().getLocationsOf(blockType, 1, ctx.playerFeet().getX(), ctx.playerFeet().getZ(), 4);
+ ArrayList locs = baritone.getWorldProvider().getCurrentWorld().getCachedWorld().getLocationsOf(blockType, 1, ctx.playerFeet().getX(), ctx.playerFeet().getZ(), 4);
logDirect("Have " + locs.size() + " locations");
for (BlockPos pos : locs) {
Block actually = BlockStateInterface.get(ctx, pos).getBlock();
@@ -407,6 +422,16 @@ public class ExampleBaritoneControl extends Behavior implements Helper {
logDirect("Started mining blocks of type " + Arrays.toString(blockTypes));
return true;
}
+ if (msg.equals("click")) {
+ new Thread(() -> {
+ try {
+ Thread.sleep(100);
+ mc.addScheduledTask(() -> mc.displayGuiScreen(new GuiClickMeme()));
+ } catch (Exception ignored) {}
+ }).start();
+ logDirect("aight dude");
+ return true;
+ }
if (msg.startsWith("thisway") || msg.startsWith("forward")) {
try {
Goal goal = GoalXZ.fromDirection(ctx.playerFeetAsVec(), ctx.player().rotationYaw, Double.parseDouble(msg.substring(7).trim()));
diff --git a/src/main/java/baritone/utils/GuiClickMeme.java b/src/main/java/baritone/utils/GuiClickMeme.java
new file mode 100644
index 000000000..1163b1b0e
--- /dev/null
+++ b/src/main/java/baritone/utils/GuiClickMeme.java
@@ -0,0 +1,100 @@
+/*
+ * 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.utils;
+
+import baritone.api.BaritoneAPI;
+import baritone.api.pathing.goals.GoalBlock;
+import baritone.api.pathing.goals.GoalTwoBlocks;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.entity.Entity;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.math.RayTraceResult;
+import net.minecraft.util.math.Vec3d;
+import org.lwjgl.BufferUtils;
+import org.lwjgl.input.Mouse;
+import org.lwjgl.util.glu.GLU;
+
+import java.awt.*;
+import java.io.IOException;
+import java.nio.FloatBuffer;
+import java.nio.IntBuffer;
+import java.util.Collections;
+
+import static org.lwjgl.opengl.GL11.*;
+
+public class GuiClickMeme extends GuiScreen {
+
+ // My name is Brady and I grant Leijurv permission to use this pasted code
+ private final FloatBuffer MODELVIEW = BufferUtils.createFloatBuffer(16);
+ private final FloatBuffer PROJECTION = BufferUtils.createFloatBuffer(16);
+ private final IntBuffer VIEWPORT = BufferUtils.createIntBuffer(16);
+ private final FloatBuffer TO_WORLD_BUFFER = BufferUtils.createFloatBuffer(3);
+
+ private BlockPos meme;
+
+ @Override
+ public boolean doesGuiPauseGame() {
+ return false;
+ }
+
+ @Override
+ public void drawScreen(int mouseX, int mouseY, float partialTicks) {
+ int mx = Mouse.getX();
+ int my = Mouse.getY();
+ Vec3d near = toWorld(mx, my, 0);
+ Vec3d far = toWorld(mx, my, 1); // "Use 0.945 that's what stack overflow says" - Leijurv
+ if (near != null && far != null) {
+ Vec3d viewerPos = new Vec3d(mc.getRenderManager().viewerPosX, mc.getRenderManager().viewerPosY, mc.getRenderManager().viewerPosZ);
+ RayTraceResult result = mc.world.rayTraceBlocks(near.add(viewerPos), far.add(viewerPos), false, false, true);
+ if (result != null && result.typeOfHit == RayTraceResult.Type.BLOCK) {
+ meme = result.getBlockPos();
+ }
+ }
+ }
+
+ @Override
+ protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
+ super.mouseClicked(mouseX, mouseY, mouseButton);
+ if (mouseButton == 0) {
+ BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalTwoBlocks(meme));
+ } else if (mouseButton == 1) {
+ BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalBlock(meme.up()));
+ }
+ }
+
+ public void onRender(float partialTicks) {
+ GlStateManager.getFloat(GL_MODELVIEW_MATRIX, (FloatBuffer) MODELVIEW.clear());
+ GlStateManager.getFloat(GL_PROJECTION_MATRIX, (FloatBuffer) PROJECTION.clear());
+ GlStateManager.glGetInteger(GL_VIEWPORT, (IntBuffer) VIEWPORT.clear());
+
+ if (meme != null) {
+ Entity e = mc.getRenderViewEntity();
+ // drawSingleSelectionBox WHEN?
+ PathRenderer.drawManySelectionBoxes(e, Collections.singletonList(meme), Color.CYAN);
+ }
+ }
+
+ public Vec3d toWorld(double x, double y, double z) {
+ boolean result = GLU.gluUnProject((float) x, (float) y, (float) z, MODELVIEW, PROJECTION, VIEWPORT, (FloatBuffer) TO_WORLD_BUFFER.clear());
+ if (result) {
+ return new Vec3d(TO_WORLD_BUFFER.get(0), TO_WORLD_BUFFER.get(1), TO_WORLD_BUFFER.get(2));
+ }
+ return null;
+ }
+}
diff --git a/src/main/java/baritone/utils/Helper.java b/src/main/java/baritone/utils/Helper.java
index d960fb629..a4c00d8d7 100755
--- a/src/main/java/baritone/utils/Helper.java
+++ b/src/main/java/baritone/utils/Helper.java
@@ -50,7 +50,7 @@ public interface Helper {
* @param message The message to display in chat
*/
default void logDebug(String message) {
- if (!Baritone.settings().chatDebug.get()) {
+ if (!Baritone.settings().chatDebug.value) {
//System.out.println("Suppressed debug message:");
//System.out.println(message);
return;
@@ -67,6 +67,6 @@ public interface Helper {
ITextComponent component = MESSAGE_PREFIX.shallowCopy();
component.getStyle().setColor(TextFormatting.GRAY);
component.appendSibling(new TextComponentString(" " + message));
- Minecraft.getInstance().addScheduledTask(() -> Baritone.settings().logger.get().accept(component));
+ Minecraft.getInstance().addScheduledTask(() -> Baritone.settings().logger.value.accept(component));
}
}
diff --git a/src/main/java/baritone/utils/PathRenderer.java b/src/main/java/baritone/utils/PathRenderer.java
index a66d3b4d2..5a474ea72 100644
--- a/src/main/java/baritone/utils/PathRenderer.java
+++ b/src/main/java/baritone/utils/PathRenderer.java
@@ -61,6 +61,9 @@ public final class PathRenderer implements Helper {
public static void render(RenderEvent event, PathingBehavior behavior) {
float partialTicks = event.getPartialTicks();
Goal goal = behavior.getGoal();
+ if (mc.currentScreen instanceof GuiClickMeme) {
+ ((GuiClickMeme) mc.currentScreen).onRender(partialTicks);
+ }
int thisPlayerDimension = behavior.baritone.getPlayerContext().world().getDimension().getType().getId();
int currentRenderViewDimension = BaritoneAPI.getProvider().getPrimaryBaritone().getPlayerContext().world().getDimension().getType().getId();
@@ -80,9 +83,9 @@ public final class PathRenderer implements Helper {
}
if (goal != null && Baritone.settings().renderGoal.value) {
- drawDankLitGoalBox(renderView, goal, partialTicks, Baritone.settings().colorGoalBox.get());
+ drawDankLitGoalBox(renderView, goal, partialTicks, Baritone.settings().colorGoalBox.value);
}
- if (!Baritone.settings().renderPath.get()) {
+ if (!Baritone.settings().renderPath.value) {
return;
}
@@ -96,28 +99,28 @@ public final class PathRenderer implements Helper {
// Render the current path, if there is one
if (current != null && current.getPath() != null) {
int renderBegin = Math.max(current.getPosition() - 3, 0);
- drawPath(current.getPath(), renderBegin, renderView, partialTicks, Baritone.settings().colorCurrentPath.get(), Baritone.settings().fadePath.get(), 10, 20);
+ drawPath(current.getPath(), renderBegin, renderView, partialTicks, Baritone.settings().colorCurrentPath.value, Baritone.settings().fadePath.value, 10, 20);
}
if (next != null && next.getPath() != null) {
- drawPath(next.getPath(), 0, renderView, partialTicks, Baritone.settings().colorNextPath.get(), Baritone.settings().fadePath.get(), 10, 20);
+ drawPath(next.getPath(), 0, renderView, partialTicks, Baritone.settings().colorNextPath.value, Baritone.settings().fadePath.value, 10, 20);
}
//long split = System.nanoTime();
if (current != null) {
- drawManySelectionBoxes(renderView, current.toBreak(), partialTicks, Baritone.settings().colorBlocksToBreak.get());
- drawManySelectionBoxes(renderView, current.toPlace(), partialTicks, Baritone.settings().colorBlocksToPlace.get());
- drawManySelectionBoxes(renderView, current.toWalkInto(), partialTicks, Baritone.settings().colorBlocksToWalkInto.get());
+ drawManySelectionBoxes(renderView, current.toBreak(), Baritone.settings().colorBlocksToBreak.value);
+ drawManySelectionBoxes(renderView, current.toPlace(), Baritone.settings().colorBlocksToPlace.value);
+ drawManySelectionBoxes(renderView, current.toWalkInto(), Baritone.settings().colorBlocksToWalkInto.value);
}
// If there is a path calculation currently running, render the path calculation process
behavior.getInProgress().ifPresent(currentlyRunning -> {
currentlyRunning.bestPathSoFar().ifPresent(p -> {
- drawPath(p, 0, renderView, partialTicks, Baritone.settings().colorBestPathSoFar.get(), Baritone.settings().fadePath.get(), 10, 20);
+ drawPath(p, 0, renderView, partialTicks, Baritone.settings().colorBestPathSoFar.value, Baritone.settings().fadePath.value, 10, 20);
});
currentlyRunning.pathToMostRecentNodeConsidered().ifPresent(mr -> {
- drawPath(mr, 0, renderView, partialTicks, Baritone.settings().colorMostRecentConsidered.get(), Baritone.settings().fadePath.get(), 10, 20);
- drawManySelectionBoxes(renderView, Collections.singletonList(mr.getDest()), partialTicks, Baritone.settings().colorMostRecentConsidered.get());
+ drawPath(mr, 0, renderView, partialTicks, Baritone.settings().colorMostRecentConsidered.value, Baritone.settings().fadePath.value, 10, 20);
+ drawManySelectionBoxes(renderView, Collections.singletonList(mr.getDest()), Baritone.settings().colorMostRecentConsidered.value);
});
});
//long end = System.nanoTime();
@@ -134,7 +137,7 @@ public final class PathRenderer implements Helper {
GlStateManager.lineWidth(Baritone.settings().pathRenderLineWidthPixels.get());
GlStateManager.disableTexture2D();
GlStateManager.depthMask(false);
- if (Baritone.settings().renderPathIgnoreDepth.get()) {
+ if (Baritone.settings().renderPathIgnoreDepth.value) {
GlStateManager.disableDepthTest();
}
List positions = path.positions();
@@ -174,10 +177,10 @@ public final class PathRenderer implements Helper {
}
GlStateManager.color4f(color.getColorComponents(null)[0], color.getColorComponents(null)[1], color.getColorComponents(null)[2], alpha);
}
- drawLine(player, x1, y1, z1, x2, y2, z2, partialTicks);
+ drawLine(player, x1, y1, z1, x2, y2, z2);
tessellator.draw();
}
- if (Baritone.settings().renderPathIgnoreDepth.get()) {
+ if (Baritone.settings().renderPathIgnoreDepth.value) {
GlStateManager.enableDepthTest();
}
//GlStateManager.color(0.0f, 0.0f, 0.0f, 0.4f);
@@ -186,10 +189,10 @@ public final class PathRenderer implements Helper {
GlStateManager.disableBlend();
}
- public static void drawLine(Entity player, double bp1x, double bp1y, double bp1z, double bp2x, double bp2y, double bp2z, float partialTicks) {
- double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) partialTicks;
- double d1 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) partialTicks;
- double d2 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) partialTicks;
+ public static void drawLine(Entity player, double bp1x, double bp1y, double bp1z, double bp2x, double bp2y, double bp2z) {
+ double d0 = mc.getRenderManager().viewerPosX;
+ double d1 = mc.getRenderManager().viewerPosY;
+ double d2 = mc.getRenderManager().viewerPosZ;
BUFFER.begin(GL_LINE_STRIP, DefaultVertexFormats.POSITION);
BUFFER.pos(bp1x + 0.5D - d0, bp1y + 0.5D - d1, bp1z + 0.5D - d2).endVertex();
BUFFER.pos(bp2x + 0.5D - d0, bp2y + 0.5D - d1, bp2z + 0.5D - d2).endVertex();
@@ -198,24 +201,20 @@ public final class PathRenderer implements Helper {
BUFFER.pos(bp1x + 0.5D - d0, bp1y + 0.5D - d1, bp1z + 0.5D - d2).endVertex();
}
- public static void drawManySelectionBoxes(Entity player, Collection positions, float partialTicks, Color color) {
+ public static void drawManySelectionBoxes(Entity player, Collection positions, Color color) {
GlStateManager.enableBlend();
GlStateManager.blendFuncSeparate(770, 771, 1, 0);
GlStateManager.color4f(color.getColorComponents(null)[0], color.getColorComponents(null)[1], color.getColorComponents(null)[2], 0.4F);
- GlStateManager.lineWidth(Baritone.settings().pathRenderLineWidthPixels.get());
+ GlStateManager.lineWidth(Baritone.settings().pathRenderLineWidthPixels.value);
GlStateManager.disableTexture2D();
GlStateManager.depthMask(false);
- if (Baritone.settings().renderSelectionBoxesIgnoreDepth.get()) {
+ if (Baritone.settings().renderSelectionBoxesIgnoreDepth.value) {
GlStateManager.disableDepthTest();
}
float expand = 0.002F;
//BlockPos blockpos = movingObjectPositionIn.getBlockPos();
-
- double renderPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) partialTicks;
- double renderPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) partialTicks;
- double renderPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) partialTicks;
BlockStateInterface bsi = new BlockStateInterface(BaritoneAPI.getProvider().getPrimaryBaritone().getPlayerContext()); // TODO this assumes same dimension between primary baritone and render view? is this safe?
positions.forEach(pos -> {
IBlockState state = bsi.get0(pos);
@@ -225,7 +224,7 @@ public final class PathRenderer implements Helper {
} else {
toDraw = state.getShape(player.world, pos).getBoundingBox();
}
- toDraw = toDraw.expand(expand, expand, expand).offset(-renderPosX, -renderPosY, -renderPosZ);
+ toDraw = toDraw.expand(expand, expand, expand).offset(-mc.getRenderManager().viewerPosX, -mc.getRenderManager().viewerPosY, -mc.getRenderManager().viewerPosZ);
BUFFER.begin(GL_LINE_STRIP, DefaultVertexFormats.POSITION);
BUFFER.pos(toDraw.minX, toDraw.minY, toDraw.minZ).endVertex();
BUFFER.pos(toDraw.maxX, toDraw.minY, toDraw.minZ).endVertex();
@@ -252,7 +251,7 @@ public final class PathRenderer implements Helper {
TESSELLATOR.draw();
});
- if (Baritone.settings().renderSelectionBoxesIgnoreDepth.get()) {
+ if (Baritone.settings().renderSelectionBoxesIgnoreDepth.value) {
GlStateManager.enableDepthTest();
}
@@ -262,10 +261,9 @@ public final class PathRenderer implements Helper {
}
public static void drawDankLitGoalBox(Entity player, Goal goal, float partialTicks, Color color) {
- double renderPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) partialTicks;
- double renderPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) partialTicks;
- double renderPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) partialTicks;
-
+ double renderPosX = mc.getRenderManager().viewerPosX;
+ double renderPosY = mc.getRenderManager().viewerPosY;
+ double renderPosZ = mc.getRenderManager().viewerPosZ;
double minX;
double maxX;
double minZ;
@@ -296,12 +294,12 @@ public final class PathRenderer implements Helper {
} else if (goal instanceof GoalXZ) {
GoalXZ goalPos = (GoalXZ) goal;
- if (Baritone.settings().renderGoalXZBeacon.get()) {
+ if (Baritone.settings().renderGoalXZBeacon.value) {
glPushAttrib(GL_LIGHTING_BIT);
mc.getTextureManager().bindTexture(TEXTURE_BEACON_BEAM);
- if (Baritone.settings().renderGoalIgnoreDepth.get()) {
+ if (Baritone.settings().renderGoalIgnoreDepth.value) {
GlStateManager.disableDepthTest();
}
@@ -321,7 +319,7 @@ public final class PathRenderer implements Helper {
0.25D
);
- if (Baritone.settings().renderGoalIgnoreDepth.get()) {
+ if (Baritone.settings().renderGoalIgnoreDepth.value) {
GlStateManager.enableDepthTest();
}
@@ -353,7 +351,7 @@ public final class PathRenderer implements Helper {
GlStateManager.lineWidth(Baritone.settings().goalRenderLineWidthPixels.get());
GlStateManager.disableTexture2D();
GlStateManager.depthMask(false);
- if (Baritone.settings().renderGoalIgnoreDepth.get()) {
+ if (Baritone.settings().renderGoalIgnoreDepth.value) {
GlStateManager.disableDepthTest();
}
@@ -371,7 +369,7 @@ public final class PathRenderer implements Helper {
BUFFER.pos(minX, maxY, maxZ).endVertex();
TESSELLATOR.draw();
- if (Baritone.settings().renderGoalIgnoreDepth.get()) {
+ if (Baritone.settings().renderGoalIgnoreDepth.value) {
GlStateManager.enableDepthTest();
}
GlStateManager.depthMask(true);
diff --git a/src/main/java/baritone/utils/PathingControlManager.java b/src/main/java/baritone/utils/PathingControlManager.java
index 54ed848a8..8d1616c4e 100644
--- a/src/main/java/baritone/utils/PathingControlManager.java
+++ b/src/main/java/baritone/utils/PathingControlManager.java
@@ -136,7 +136,7 @@ public class PathingControlManager implements IPathingControlManager {
p.secretInternalSetGoalAndPath(command.goal);
break;
case REVALIDATE_GOAL_AND_PATH:
- if (Baritone.settings().cancelOnGoalInvalidation.get() && (command.goal == null || revalidateGoal(command.goal))) {
+ if (Baritone.settings().cancelOnGoalInvalidation.value && (command.goal == null || revalidateGoal(command.goal))) {
p.softCancelIfSafe();
}
p.secretInternalSetGoalAndPath(command.goal);
diff --git a/src/main/java/baritone/utils/ToolSet.java b/src/main/java/baritone/utils/ToolSet.java
index 9566f2a64..ca45190c7 100644
--- a/src/main/java/baritone/utils/ToolSet.java
+++ b/src/main/java/baritone/utils/ToolSet.java
@@ -54,7 +54,7 @@ public class ToolSet {
breakStrengthCache = new HashMap<>();
this.player = player;
- if (Baritone.settings().considerPotionEffects.get()) {
+ if (Baritone.settings().considerPotionEffects.value) {
double amplifier = potionAmplifier();
Function amplify = x -> amplifier * x;
backendCalculation = amplify.compose(this::getBestDestructionTime);
diff --git a/src/main/java/baritone/utils/pathing/Avoidance.java b/src/main/java/baritone/utils/pathing/Avoidance.java
index 1f61dc57a..9b32b1dfd 100644
--- a/src/main/java/baritone/utils/pathing/Avoidance.java
+++ b/src/main/java/baritone/utils/pathing/Avoidance.java
@@ -57,17 +57,17 @@ public class Avoidance {
}
public static List create(IPlayerContext ctx) {
- if (!Baritone.settings().avoidance.get()) {
+ if (!Baritone.settings().avoidance.value) {
return Collections.emptyList();
}
List res = new ArrayList<>();
- double mobSpawnerCoeff = Baritone.settings().mobSpawnerAvoidanceCoefficient.get();
- double mobCoeff = Baritone.settings().mobAvoidanceCoefficient.get();
+ double mobSpawnerCoeff = Baritone.settings().mobSpawnerAvoidanceCoefficient.value;
+ double mobCoeff = Baritone.settings().mobAvoidanceCoefficient.value;
if (mobSpawnerCoeff != 1.0D) {
- ctx.worldData().getCachedWorld().getLocationsOf("mob_spawner", 1, ctx.playerFeet().x, ctx.playerFeet().z, 2).forEach(mobspawner -> res.add(new Avoidance(mobspawner, mobSpawnerCoeff, Baritone.settings().mobSpawnerAvoidanceRadius.get())));
+ ctx.worldData().getCachedWorld().getLocationsOf("mob_spawner", 1, ctx.playerFeet().x, ctx.playerFeet().z, 2).forEach(mobspawner -> res.add(new Avoidance(mobspawner, mobSpawnerCoeff, Baritone.settings().mobSpawnerAvoidanceRadius.value)));
}
if (mobCoeff != 1.0D) {
- ctx.world().loadedEntityList.stream().filter(entity -> entity instanceof EntityMob).forEach(entity -> res.add(new Avoidance(new BlockPos(entity), mobCoeff, Baritone.settings().mobAvoidanceRadius.get())));
+ ctx.world().loadedEntityList.stream().filter(entity -> entity instanceof EntityMob).forEach(entity -> res.add(new Avoidance(new BlockPos(entity), mobCoeff, Baritone.settings().mobAvoidanceRadius.value)));
}
return res;
}
diff --git a/src/main/java/baritone/utils/pathing/Favoring.java b/src/main/java/baritone/utils/pathing/Favoring.java
index 7ffe49ffd..45bb8a09e 100644
--- a/src/main/java/baritone/utils/pathing/Favoring.java
+++ b/src/main/java/baritone/utils/pathing/Favoring.java
@@ -37,7 +37,7 @@ public final class Favoring {
public Favoring(IPath previous) { // create one just from previous path, no mob avoidances
favorings = new Long2DoubleOpenHashMap();
favorings.defaultReturnValue(1.0D);
- double coeff = Baritone.settings().backtrackCostFavoringCoefficient.get();
+ double coeff = Baritone.settings().backtrackCostFavoringCoefficient.value;
if (coeff != 1D && previous != null) {
previous.positions().forEach(pos -> favorings.put(BetterBlockPos.longHash(pos), coeff));
}
diff --git a/src/main/java/baritone/utils/pathing/PathBase.java b/src/main/java/baritone/utils/pathing/PathBase.java
index 3acf80b4e..8bac2dc77 100644
--- a/src/main/java/baritone/utils/pathing/PathBase.java
+++ b/src/main/java/baritone/utils/pathing/PathBase.java
@@ -28,7 +28,7 @@ import net.minecraft.util.math.BlockPos;
public abstract class PathBase implements IPath {
@Override
public PathBase cutoffAtLoadedChunks(Object bsi0) { // <-- cursed cursed cursed
- if (!Baritone.settings().cutoffAtLoadBoundary.get()) {
+ if (!Baritone.settings().cutoffAtLoadBoundary.value) {
return this;
}
BlockStateInterface bsi = (BlockStateInterface) bsi0;
@@ -43,14 +43,14 @@ public abstract class PathBase implements IPath {
@Override
public PathBase staticCutoff(Goal destination) {
- int min = BaritoneAPI.getSettings().pathCutoffMinimumLength.get();
+ int min = BaritoneAPI.getSettings().pathCutoffMinimumLength.value;
if (length() < min) {
return this;
}
if (destination == null || destination.isInGoal(getDest())) {
return this;
}
- double factor = BaritoneAPI.getSettings().pathCutoffFactor.get();
+ double factor = BaritoneAPI.getSettings().pathCutoffFactor.value;
int newLength = (int) ((length() - min) * factor) + min - 1;
return new CutoffPath(this, newLength);
}
diff --git a/src/main/java/baritone/utils/pathing/SegmentedCalculator.java b/src/main/java/baritone/utils/pathing/SegmentedCalculator.java
index e1d6dd106..489d560d8 100644
--- a/src/main/java/baritone/utils/pathing/SegmentedCalculator.java
+++ b/src/main/java/baritone/utils/pathing/SegmentedCalculator.java
@@ -88,7 +88,7 @@ public class SegmentedCalculator {
private PathCalculationResult segment(Optional previous) {
BetterBlockPos segmentStart = previous.map(IPath::getDest).orElse(start); // <-- e p i c
AbstractNodeCostSearch search = new AStarPathFinder(segmentStart.x, segmentStart.y, segmentStart.z, goal, new Favoring(previous.orElse(null)), context); // this is on another thread, so cannot include mob avoidances.
- return search.calculate(Baritone.settings().primaryTimeoutMS.get(), Baritone.settings().failureTimeoutMS.get()); // use normal time settings, not the plan ahead settings, so as to not overwhelm the computer
+ return search.calculate(Baritone.settings().primaryTimeoutMS.value, Baritone.settings().failureTimeoutMS.value); // use normal time settings, not the plan ahead settings, so as to not overwhelm the computer
}
public static void calculateSegmentsThreaded(BetterBlockPos start, Goal goal, CalculationContext context, Consumer onCompletion, Runnable onFailure) {