no more .get 😎
This commit is contained in:
parent
459720c348
commit
8050b69f2f
@ -721,9 +721,9 @@ public final class Settings {
|
|||||||
this.klass = (Class<T>) value.getClass();
|
this.klass = (Class<T>) value.getClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@Deprecated
|
||||||
public final <K extends T> K get() {
|
public final T get() {
|
||||||
return (K) value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final String getName() {
|
public final String getName() {
|
||||||
|
@ -25,7 +25,7 @@ public class GoalAxis implements Goal {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isInGoal(int x, int y, int z) {
|
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
|
@Override
|
||||||
@ -39,7 +39,7 @@ public class GoalAxis implements Goal {
|
|||||||
|
|
||||||
double flatAxisDistance = Math.min(x, Math.min(z, diff * SQRT_2_OVER_2));
|
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
|
@Override
|
||||||
|
@ -80,7 +80,7 @@ public class GoalXZ implements Goal {
|
|||||||
diagonal = z;
|
diagonal = z;
|
||||||
}
|
}
|
||||||
diagonal *= SQRT_2;
|
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) {
|
public static GoalXZ fromDirection(Vec3d origin, float yaw, double distance) {
|
||||||
|
@ -99,7 +99,7 @@ public class SettingsUtil {
|
|||||||
public static List<Settings.Setting> modifiedSettings(Settings settings) {
|
public static List<Settings.Setting> modifiedSettings(Settings settings) {
|
||||||
List<Settings.Setting> modified = new ArrayList<>();
|
List<Settings.Setting> modified = new ArrayList<>();
|
||||||
for (Settings.Setting setting : settings.allSettings) {
|
for (Settings.Setting setting : settings.allSettings) {
|
||||||
if (setting.get() == null) {
|
if (setting.value == null) {
|
||||||
System.out.println("NULL SETTING?" + setting.getName());
|
System.out.println("NULL SETTING?" + setting.getName());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -122,7 +122,7 @@ public class SettingsUtil {
|
|||||||
if (io == null) {
|
if (io == null) {
|
||||||
throw new IllegalStateException("Missing " + setting.getValueClass() + " " + setting.getName());
|
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 {
|
public static void parseAndApply(Settings settings, String settingName, String settingValue) throws IllegalStateException, NumberFormatException {
|
||||||
|
@ -41,10 +41,10 @@ public class MixinChunkRenderContainer {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
private BlockPos getPosition(RenderChunk renderChunkIn) {
|
private BlockPos getPosition(RenderChunk renderChunkIn) {
|
||||||
if (Baritone.settings().renderCachedChunks.get() && Minecraft.getMinecraft().getIntegratedServer() == null && Minecraft.getMinecraft().world.getChunk(renderChunkIn.getPosition()).isEmpty()) {
|
if (Baritone.settings().renderCachedChunks.value && Minecraft.getMinecraft().getIntegratedServer() == null && Minecraft.getMinecraft().world.getChunk(renderChunkIn.getPosition()).isEmpty()) {
|
||||||
GlStateManager.enableAlpha();
|
GlStateManager.enableAlpha();
|
||||||
GlStateManager.enableBlend();
|
GlStateManager.enableBlend();
|
||||||
GL14.glBlendColor(0, 0, 0, Baritone.settings().cachedChunksOpacity.get());
|
GL14.glBlendColor(0, 0, 0, Baritone.settings().cachedChunksOpacity.value);
|
||||||
GlStateManager.tryBlendFuncSeparate(GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA, GL_ONE, GL_ZERO);
|
GlStateManager.tryBlendFuncSeparate(GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA, GL_ONE, GL_ZERO);
|
||||||
}
|
}
|
||||||
return renderChunkIn.getPosition();
|
return renderChunkIn.getPosition();
|
||||||
|
@ -43,7 +43,7 @@ public abstract class MixinChunkRenderWorker {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
private boolean isChunkExisting(ChunkRenderWorker worker, BlockPos pos, World world) {
|
private boolean isChunkExisting(ChunkRenderWorker worker, BlockPos pos, World world) {
|
||||||
if (Baritone.settings().renderCachedChunks.get() && Minecraft.getMinecraft().getIntegratedServer() == null) {
|
if (Baritone.settings().renderCachedChunks.value && Minecraft.getMinecraft().getIntegratedServer() == null) {
|
||||||
Baritone baritone = (Baritone) BaritoneAPI.getProvider().getPrimaryBaritone();
|
Baritone baritone = (Baritone) BaritoneAPI.getProvider().getPrimaryBaritone();
|
||||||
IPlayerContext ctx = baritone.getPlayerContext();
|
IPlayerContext ctx = baritone.getPlayerContext();
|
||||||
if (ctx.player() != null && ctx.world() != null && baritone.bsi != null) {
|
if (ctx.player() != null && ctx.world() != null && baritone.bsi != null) {
|
||||||
|
@ -47,7 +47,7 @@ public class MixinRenderChunk {
|
|||||||
if (!chunkCache.isEmpty()) {
|
if (!chunkCache.isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (Baritone.settings().renderCachedChunks.get() && Minecraft.getMinecraft().getIntegratedServer() == null) {
|
if (Baritone.settings().renderCachedChunks.value && Minecraft.getMinecraft().getIntegratedServer() == null) {
|
||||||
Baritone baritone = (Baritone) BaritoneAPI.getProvider().getPrimaryBaritone();
|
Baritone baritone = (Baritone) BaritoneAPI.getProvider().getPrimaryBaritone();
|
||||||
IPlayerContext ctx = baritone.getPlayerContext();
|
IPlayerContext ctx = baritone.getPlayerContext();
|
||||||
if (ctx.player() != null && ctx.world() != null && baritone.bsi != null) {
|
if (ctx.player() != null && ctx.world() != null && baritone.bsi != null) {
|
||||||
@ -76,7 +76,7 @@ public class MixinRenderChunk {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
private IBlockState getBlockState(ChunkCache chunkCache, BlockPos pos) {
|
private IBlockState getBlockState(ChunkCache chunkCache, BlockPos pos) {
|
||||||
if (Baritone.settings().renderCachedChunks.get() && Minecraft.getMinecraft().getIntegratedServer() == null) {
|
if (Baritone.settings().renderCachedChunks.value && Minecraft.getMinecraft().getIntegratedServer() == null) {
|
||||||
Baritone baritone = (Baritone) BaritoneAPI.getProvider().getPrimaryBaritone();
|
Baritone baritone = (Baritone) BaritoneAPI.getProvider().getPrimaryBaritone();
|
||||||
IPlayerContext ctx = baritone.getPlayerContext();
|
IPlayerContext ctx = baritone.getPlayerContext();
|
||||||
if (ctx.player() != null && ctx.world() != null && baritone.bsi != null) {
|
if (ctx.player() != null && ctx.world() != null && baritone.bsi != null) {
|
||||||
|
@ -38,7 +38,7 @@ public class MixinRenderList {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
private void popMatrix() {
|
private void popMatrix() {
|
||||||
if (Baritone.settings().renderCachedChunks.get() && Minecraft.getMinecraft().getIntegratedServer() == null) {
|
if (Baritone.settings().renderCachedChunks.value && Minecraft.getMinecraft().getIntegratedServer() == null) {
|
||||||
// reset the blend func to normal (not dependent on constant alpha)
|
// reset the blend func to normal (not dependent on constant alpha)
|
||||||
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
|
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ public class MixinVboRenderList {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
private void popMatrix() {
|
private void popMatrix() {
|
||||||
if (Baritone.settings().renderCachedChunks.get() && Minecraft.getMinecraft().getIntegratedServer() == null) {
|
if (Baritone.settings().renderCachedChunks.value && Minecraft.getMinecraft().getIntegratedServer() == null) {
|
||||||
// reset the blend func to normal (not dependent on constant alpha)
|
// reset the blend func to normal (not dependent on constant alpha)
|
||||||
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
|
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ public class InventoryBehavior extends Behavior {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTick(TickEvent event) {
|
public void onTick(TickEvent event) {
|
||||||
if (!Baritone.settings().allowInventory.get()) {
|
if (!Baritone.settings().allowInventory.value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event.getType() == TickEvent.Type.OUT) {
|
if (event.getType() == TickEvent.Type.OUT) {
|
||||||
@ -61,7 +61,7 @@ public class InventoryBehavior extends Behavior {
|
|||||||
private int firstValidThrowaway() { // TODO offhand idk
|
private int firstValidThrowaway() { // TODO offhand idk
|
||||||
NonNullList<ItemStack> invy = ctx.player().inventory.mainInventory;
|
NonNullList<ItemStack> invy = ctx.player().inventory.mainInventory;
|
||||||
for (int i = 0; i < invy.size(); i++) {
|
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;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ public final class LookBehavior extends Behavior implements ILookBehavior {
|
|||||||
@Override
|
@Override
|
||||||
public void updateTarget(Rotation target, boolean force) {
|
public void updateTarget(Rotation target, boolean force) {
|
||||||
this.target = target;
|
this.target = target;
|
||||||
this.force = force || !Baritone.settings().freeLook.get();
|
this.force = force || !Baritone.settings().freeLook.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -63,7 +63,7 @@ public final class LookBehavior extends Behavior implements ILookBehavior {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Whether or not we're going to silently set our angles
|
// 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()) {
|
switch (event.getState()) {
|
||||||
case PRE: {
|
case PRE: {
|
||||||
@ -109,7 +109,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()
|
// 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
|
// 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;
|
this.target = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ public final class MemoryBehavior extends Behavior {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void onTick(TickEvent event) {
|
public synchronized void onTick(TickEvent event) {
|
||||||
if (!Baritone.settings().containerMemory.get()) {
|
if (!Baritone.settings().containerMemory.value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event.getType() == TickEvent.Type.OUT) {
|
if (event.getType() == TickEvent.Type.OUT) {
|
||||||
@ -83,7 +83,7 @@ public final class MemoryBehavior extends Behavior {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void onSendPacket(PacketEvent event) {
|
public synchronized void onSendPacket(PacketEvent event) {
|
||||||
if (!Baritone.settings().containerMemory.get()) {
|
if (!Baritone.settings().containerMemory.value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Packet p = event.getPacket();
|
Packet p = event.getPacket();
|
||||||
@ -122,7 +122,7 @@ public final class MemoryBehavior extends Behavior {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void onReceivePacket(PacketEvent event) {
|
public synchronized void onReceivePacket(PacketEvent event) {
|
||||||
if (!Baritone.settings().containerMemory.get()) {
|
if (!Baritone.settings().containerMemory.value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Packet p = event.getPacket();
|
Packet p = event.getPacket();
|
||||||
@ -171,7 +171,7 @@ public final class MemoryBehavior extends Behavior {
|
|||||||
|
|
||||||
|
|
||||||
private void updateInventory() {
|
private void updateInventory() {
|
||||||
if (!Baritone.settings().containerMemory.get()) {
|
if (!Baritone.settings().containerMemory.value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int windowId = ctx.player().openContainer.windowId;
|
int windowId = ctx.player().openContainer.windowId;
|
||||||
|
@ -201,7 +201,7 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
|
|||||||
// and this path doesn't get us all the way there
|
// and this path doesn't get us all the way there
|
||||||
return;
|
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
|
// 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
|
// 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
|
// 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 +426,11 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
|
|||||||
long primaryTimeout;
|
long primaryTimeout;
|
||||||
long failureTimeout;
|
long failureTimeout;
|
||||||
if (current == null) {
|
if (current == null) {
|
||||||
primaryTimeout = Baritone.settings().primaryTimeoutMS.get();
|
primaryTimeout = Baritone.settings().primaryTimeoutMS.value;
|
||||||
failureTimeout = Baritone.settings().failureTimeoutMS.get();
|
failureTimeout = Baritone.settings().failureTimeoutMS.value;
|
||||||
} else {
|
} else {
|
||||||
primaryTimeout = Baritone.settings().planAheadPrimaryTimeoutMS.get();
|
primaryTimeout = Baritone.settings().planAheadPrimaryTimeoutMS.value;
|
||||||
failureTimeout = Baritone.settings().planAheadFailureTimeoutMS.get();
|
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
|
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);
|
AbstractNodeCostSearch pathfinder = createPathfinder(start, goal, current == null ? null : current.getPath(), context);
|
||||||
@ -494,7 +494,7 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
|
|||||||
|
|
||||||
public static AbstractNodeCostSearch createPathfinder(BlockPos start, Goal goal, IPath previous, CalculationContext context) {
|
public static AbstractNodeCostSearch createPathfinder(BlockPos start, Goal goal, IPath previous, CalculationContext context) {
|
||||||
Goal transformed = goal;
|
Goal transformed = goal;
|
||||||
if (Baritone.settings().simplifyUnloadedYCoord.get() && goal instanceof IGoalRenderPos) {
|
if (Baritone.settings().simplifyUnloadedYCoord.value && goal instanceof IGoalRenderPos) {
|
||||||
BlockPos pos = ((IGoalRenderPos) goal).getGoalPos();
|
BlockPos pos = ((IGoalRenderPos) goal).getGoalPos();
|
||||||
if (!context.bsi.worldContainsLoadedChunk(pos.getX(), pos.getZ())) {
|
if (!context.bsi.worldContainsLoadedChunk(pos.getX(), pos.getZ())) {
|
||||||
transformed = new GoalXZ(pos.getX(), pos.getZ());
|
transformed = new GoalXZ(pos.getX(), pos.getZ());
|
||||||
|
@ -303,7 +303,7 @@ public final class CachedRegion implements ICachedRegion {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public synchronized final void removeExpired() {
|
public synchronized final void removeExpired() {
|
||||||
long expiry = Baritone.settings().cachedChunksExpirySeconds.get();
|
long expiry = Baritone.settings().cachedChunksExpirySeconds.value;
|
||||||
if (expiry < 0) {
|
if (expiry < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ public final class CachedWorld implements ICachedWorld, Helper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void save() {
|
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.");
|
System.out.println("Not saving to disk; chunk caching is disabled.");
|
||||||
allRegions().forEach(region -> {
|
allRegions().forEach(region -> {
|
||||||
if (region != null) {
|
if (region != null) {
|
||||||
@ -170,7 +170,7 @@ public final class CachedWorld implements ICachedWorld, Helper {
|
|||||||
* Delete regions that are too far from the player
|
* Delete regions that are too far from the player
|
||||||
*/
|
*/
|
||||||
private synchronized void prune() {
|
private synchronized void prune() {
|
||||||
if (!Baritone.settings().pruneRegionsFromRAM.get()) {
|
if (!Baritone.settings().pruneRegionsFromRAM.value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
BlockPos pruneCenter = guessPosition();
|
BlockPos pruneCenter = guessPosition();
|
||||||
|
@ -70,7 +70,7 @@ public class ContainerMemory implements IContainerMemory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void save() throws IOException {
|
public synchronized void save() throws IOException {
|
||||||
if (!Baritone.settings().containerMemory.get()) {
|
if (!Baritone.settings().containerMemory.value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ByteBuf buf = Unpooled.buffer(0, Integer.MAX_VALUE);
|
ByteBuf buf = Unpooled.buffer(0, Integer.MAX_VALUE);
|
||||||
|
@ -62,20 +62,20 @@ public final class AStarPathFinder extends AbstractNodeCostSearch {
|
|||||||
MutableMoveResult res = new MutableMoveResult();
|
MutableMoveResult res = new MutableMoveResult();
|
||||||
BetterWorldBorder worldBorder = new BetterWorldBorder(calcContext.world.getWorldBorder());
|
BetterWorldBorder worldBorder = new BetterWorldBorder(calcContext.world.getWorldBorder());
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
boolean slowPath = Baritone.settings().slowPath.get();
|
boolean slowPath = Baritone.settings().slowPath.value;
|
||||||
if (slowPath) {
|
if (slowPath) {
|
||||||
logDebug("slowPath is on, path timeout will be " + Baritone.settings().slowPathTimeoutMS.<Long>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.<Long>get() : primaryTimeout);
|
long primaryTimeoutTime = startTime + (slowPath ? Baritone.settings().slowPathTimeoutMS.value : primaryTimeout);
|
||||||
long failureTimeoutTime = startTime + (slowPath ? Baritone.settings().slowPathTimeoutMS.<Long>get() : failureTimeout);
|
long failureTimeoutTime = startTime + (slowPath ? Baritone.settings().slowPathTimeoutMS.value : failureTimeout);
|
||||||
boolean failing = true;
|
boolean failing = true;
|
||||||
int numNodes = 0;
|
int numNodes = 0;
|
||||||
int numMovementsConsidered = 0;
|
int numMovementsConsidered = 0;
|
||||||
int numEmptyChunk = 0;
|
int numEmptyChunk = 0;
|
||||||
boolean isFavoring = !favoring.isEmpty();
|
boolean isFavoring = !favoring.isEmpty();
|
||||||
int timeCheckInterval = 1 << 6;
|
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
|
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.get() ? MIN_IMPROVEMENT : 0;
|
double minimumImprovement = Baritone.settings().minimumImprovementRepropagation.value ? MIN_IMPROVEMENT : 0;
|
||||||
while (!openSet.isEmpty() && numEmptyChunk < pathingMaxChunkBorderFetch && !cancelRequested) {
|
while (!openSet.isEmpty() && numEmptyChunk < pathingMaxChunkBorderFetch && !cancelRequested) {
|
||||||
if ((numNodes & (timeCheckInterval - 1)) == 0) { // only call this once every 64 nodes (about half a millisecond)
|
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)
|
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) {
|
if (slowPath) {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(Baritone.settings().slowPathTimeDelayMS.<Long>get());
|
Thread.sleep(Baritone.settings().slowPathTimeDelayMS.value);
|
||||||
} catch (InterruptedException ex) {
|
} catch (InterruptedException ex) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ public abstract class AbstractNodeCostSearch implements IPathFinder, Helper {
|
|||||||
this.startZ = startZ;
|
this.startZ = startZ;
|
||||||
this.goal = goal;
|
this.goal = goal;
|
||||||
this.context = context;
|
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() {
|
public void cancel() {
|
||||||
|
@ -76,27 +76,27 @@ public class CalculationContext {
|
|||||||
this.worldData = (WorldData) baritone.getWorldProvider().getCurrentWorld();
|
this.worldData = (WorldData) baritone.getWorldProvider().getCurrentWorld();
|
||||||
this.bsi = new BlockStateInterface(world, worldData, forUseOnAnotherThread); // TODO TODO TODO
|
this.bsi = new BlockStateInterface(world, worldData, forUseOnAnotherThread); // TODO TODO TODO
|
||||||
this.toolSet = new ToolSet(player);
|
this.toolSet = new ToolSet(player);
|
||||||
this.hasThrowaway = Baritone.settings().allowPlace.get() && MovementHelper.throwaway(baritone.getPlayerContext(), false);
|
this.hasThrowaway = Baritone.settings().allowPlace.value && MovementHelper.throwaway(baritone.getPlayerContext(), false);
|
||||||
this.hasWaterBucket = Baritone.settings().allowWaterBucketFall.get() && InventoryPlayer.isHotbar(player.inventory.getSlotFor(STACK_BUCKET_WATER)) && !world.provider.isNether();
|
this.hasWaterBucket = Baritone.settings().allowWaterBucketFall.value && InventoryPlayer.isHotbar(player.inventory.getSlotFor(STACK_BUCKET_WATER)) && !world.provider.isNether();
|
||||||
this.canSprint = Baritone.settings().allowSprint.get() && player.getFoodStats().getFoodLevel() > 6;
|
this.canSprint = Baritone.settings().allowSprint.value && player.getFoodStats().getFoodLevel() > 6;
|
||||||
this.placeBlockCost = Baritone.settings().blockPlacementPenalty.get();
|
this.placeBlockCost = Baritone.settings().blockPlacementPenalty.value;
|
||||||
this.allowBreak = Baritone.settings().allowBreak.get();
|
this.allowBreak = Baritone.settings().allowBreak.value;
|
||||||
this.allowParkour = Baritone.settings().allowParkour.get();
|
this.allowParkour = Baritone.settings().allowParkour.value;
|
||||||
this.allowParkourPlace = Baritone.settings().allowParkourPlace.get();
|
this.allowParkourPlace = Baritone.settings().allowParkourPlace.value;
|
||||||
this.allowJumpAt256 = Baritone.settings().allowJumpAt256.get();
|
this.allowJumpAt256 = Baritone.settings().allowJumpAt256.value;
|
||||||
this.assumeWalkOnWater = Baritone.settings().assumeWalkOnWater.get();
|
this.assumeWalkOnWater = Baritone.settings().assumeWalkOnWater.value;
|
||||||
this.allowDiagonalDescend = Baritone.settings().allowDiagonalDescend.get();
|
this.allowDiagonalDescend = Baritone.settings().allowDiagonalDescend.value;
|
||||||
this.maxFallHeightNoWater = Baritone.settings().maxFallHeightNoWater.get();
|
this.maxFallHeightNoWater = Baritone.settings().maxFallHeightNoWater.value;
|
||||||
this.maxFallHeightBucket = Baritone.settings().maxFallHeightBucket.get();
|
this.maxFallHeightBucket = Baritone.settings().maxFallHeightBucket.value;
|
||||||
int depth = EnchantmentHelper.getDepthStriderModifier(player);
|
int depth = EnchantmentHelper.getDepthStriderModifier(player);
|
||||||
if (depth > 3) {
|
if (depth > 3) {
|
||||||
depth = 3;
|
depth = 3;
|
||||||
}
|
}
|
||||||
float mult = depth / 3.0F;
|
float mult = depth / 3.0F;
|
||||||
this.waterWalkSpeed = ActionCosts.WALK_ONE_IN_WATER_COST * (1 - mult) + ActionCosts.WALK_ONE_BLOCK_COST * mult;
|
this.waterWalkSpeed = ActionCosts.WALK_ONE_IN_WATER_COST * (1 - mult) + ActionCosts.WALK_ONE_BLOCK_COST * mult;
|
||||||
this.breakBlockAdditionalCost = Baritone.settings().blockBreakAdditionalPenalty.get();
|
this.breakBlockAdditionalCost = Baritone.settings().blockBreakAdditionalPenalty.value;
|
||||||
this.jumpPenalty = Baritone.settings().jumpPenalty.get();
|
this.jumpPenalty = Baritone.settings().jumpPenalty.value;
|
||||||
this.walkOnWaterOnePenalty = Baritone.settings().walkOnWaterOnePenalty.get();
|
this.walkOnWaterOnePenalty = Baritone.settings().walkOnWaterOnePenalty.value;
|
||||||
// why cache these things here, why not let the movements just get directly from settings?
|
// 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,
|
// 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.
|
// then you get a wildly inconsistent path that isn't optimal for either scenario.
|
||||||
|
@ -113,7 +113,7 @@ public interface MovementHelper extends ActionCosts, Helper {
|
|||||||
return false; // Don't walk through flowing liquids
|
return false; // Don't walk through flowing liquids
|
||||||
}
|
}
|
||||||
if (block instanceof BlockLiquid) {
|
if (block instanceof BlockLiquid) {
|
||||||
if (Baritone.settings().assumeWalkOnWater.get()) {
|
if (Baritone.settings().assumeWalkOnWater.value) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
IBlockState up = bsi.get0(x, y + 1, z);
|
IBlockState up = bsi.get0(x, y + 1, z);
|
||||||
@ -275,7 +275,7 @@ public interface MovementHelper extends ActionCosts, Helper {
|
|||||||
if (state.isBlockNormalCube()) {
|
if (state.isBlockNormalCube()) {
|
||||||
return true;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
if (block == Blocks.FARMLAND || block == Blocks.GRASS_PATH) {
|
if (block == Blocks.FARMLAND || block == Blocks.GRASS_PATH) {
|
||||||
@ -293,17 +293,17 @@ public interface MovementHelper extends ActionCosts, Helper {
|
|||||||
}
|
}
|
||||||
if (isFlowing(x, y, z, state, bsi) || block == Blocks.FLOWING_WATER) {
|
if (isFlowing(x, y, z, state, bsi) || block == Blocks.FLOWING_WATER) {
|
||||||
// the only scenario in which we can walk on flowing water is if it's under still water with jesus off
|
// the only scenario in which we can walk on flowing water is if it's under still water with jesus off
|
||||||
return isWater(up) && !Baritone.settings().assumeWalkOnWater.get();
|
return isWater(up) && !Baritone.settings().assumeWalkOnWater.value;
|
||||||
}
|
}
|
||||||
// if assumeWalkOnWater is on, we can only walk on water if there isn't water above it
|
// 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
|
// if assumeWalkOnWater is off, we can only walk on water if there is water above it
|
||||||
return isWater(up) ^ Baritone.settings().assumeWalkOnWater.get();
|
return isWater(up) ^ Baritone.settings().assumeWalkOnWater.value;
|
||||||
}
|
}
|
||||||
if (block == Blocks.GLASS || block == Blocks.STAINED_GLASS) {
|
if (block == Blocks.GLASS || block == Blocks.STAINED_GLASS) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (block instanceof BlockSlab) {
|
if (block instanceof BlockSlab) {
|
||||||
if (!Baritone.settings().allowWalkOnBottomSlab.get()) {
|
if (!Baritone.settings().allowWalkOnBottomSlab.value) {
|
||||||
if (((BlockSlab) block).isDouble()) {
|
if (((BlockSlab) block).isDouble()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -415,14 +415,14 @@ public interface MovementHelper extends ActionCosts, Helper {
|
|||||||
// and then it's called during execution
|
// and then it's called during execution
|
||||||
// since this function is never called during cost calculation, we don't need to migrate
|
// since this function is never called during cost calculation, we don't need to migrate
|
||||||
// acceptableThrowawayItems to the CalculationContext
|
// acceptableThrowawayItems to the CalculationContext
|
||||||
if (Baritone.settings().acceptableThrowawayItems.get().contains(item.getItem())) {
|
if (Baritone.settings().acceptableThrowawayItems.value.contains(item.getItem())) {
|
||||||
if (select) {
|
if (select) {
|
||||||
p.inventory.currentItem = i;
|
p.inventory.currentItem = i;
|
||||||
}
|
}
|
||||||
return true;
|
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
|
// 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
|
// 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
|
// we've already checked above ^ and the main hand can't possible have an acceptablethrowawayitem
|
||||||
|
@ -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
|
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
|
// no need to hit space if we're already jumping
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ public class MovementDiagonal extends Movement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean sprint() {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
|
@ -152,7 +152,7 @@ public class MovementTraverse extends Movement {
|
|||||||
super.updateState(state);
|
super.updateState(state);
|
||||||
if (state.getStatus() != MovementStatus.RUNNING) {
|
if (state.getStatus() != MovementStatus.RUNNING) {
|
||||||
// if the setting is enabled
|
// if the setting is enabled
|
||||||
if (!Baritone.settings().walkWhileBreaking.get()) {
|
if (!Baritone.settings().walkWhileBreaking.value) {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
// and if we're prepping (aka mining the block in front)
|
// and if we're prepping (aka mining the block in front)
|
||||||
@ -241,7 +241,7 @@ public class MovementTraverse extends Movement {
|
|||||||
BlockPos into = dest.subtract(src).add(dest);
|
BlockPos into = dest.subtract(src).add(dest);
|
||||||
Block intoBelow = BlockStateInterface.get(ctx, into).getBlock();
|
Block intoBelow = BlockStateInterface.get(ctx, into).getBlock();
|
||||||
Block intoAbove = BlockStateInterface.get(ctx, into.up()).getBlock();
|
Block intoAbove = BlockStateInterface.get(ctx, into.up()).getBlock();
|
||||||
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);
|
state.setInput(Input.SPRINT, true);
|
||||||
}
|
}
|
||||||
Block destDown = BlockStateInterface.get(ctx, dest.down()).getBlock();
|
Block destDown = BlockStateInterface.get(ctx, dest.down()).getBlock();
|
||||||
@ -264,12 +264,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)));
|
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);
|
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);
|
state.setInput(Input.SNEAK, true);
|
||||||
}
|
}
|
||||||
switch (p) {
|
switch (p) {
|
||||||
case READY_TO_PLACE: {
|
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);
|
state.setInput(Input.CLICK_RIGHT, true);
|
||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
@ -343,4 +343,4 @@ public class MovementTraverse extends Movement {
|
|||||||
}
|
}
|
||||||
return super.prepared(state);
|
return super.prepared(state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -229,7 +229,7 @@ public class PathExecutor implements IPathExecutor, Helper {
|
|||||||
costEstimateIndex = pathPosition;
|
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
|
// 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();
|
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) {
|
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.");
|
logDebug("Something has changed in the world and a future movement has become impossible. Cancelling.");
|
||||||
cancel();
|
cancel();
|
||||||
@ -243,7 +243,7 @@ public class PathExecutor implements IPathExecutor, Helper {
|
|||||||
cancel();
|
cancel();
|
||||||
return true;
|
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
|
// 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
|
// 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.");
|
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
|
ctx.player().setSprinting(false); // letting go of control doesn't make you stop sprinting actually
|
||||||
}
|
}
|
||||||
ticksOnCurrent++;
|
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
|
// 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
|
// as you break the blocks required, the remaining cost goes down, to the point where
|
||||||
// ticksOnCurrent is greater than recalculateCost + 100
|
// 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) {
|
private static boolean sprintableAscend(IPlayerContext ctx, MovementTraverse current, MovementAscend next, IMovement nextnext) {
|
||||||
if (!Baritone.settings().sprintAscends.get()) {
|
if (!Baritone.settings().sprintAscends.value) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!current.getDirection().equals(next.getDirection().down())) {
|
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())) {
|
if (next instanceof MovementTraverse && next.getDirection().down().equals(current.getDirection()) && MovementHelper.canWalkOn(ctx, next.getDest().down())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return next instanceof MovementDiagonal && Baritone.settings().allowOvershootDiagonalDescend.get();
|
return next instanceof MovementDiagonal && Baritone.settings().allowOvershootDiagonalDescend.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onChangeInPathPosition() {
|
private void onChangeInPathPosition() {
|
||||||
@ -612,8 +612,8 @@ public class PathExecutor implements IPathExecutor, Helper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private PathExecutor cutIfTooLong() {
|
private PathExecutor cutIfTooLong() {
|
||||||
if (pathPosition > Baritone.settings().maxPathHistoryLength.get()) {
|
if (pathPosition > Baritone.settings().maxPathHistoryLength.value) {
|
||||||
int cutoffAmt = Baritone.settings().pathHistoryCutoffAmount.get();
|
int cutoffAmt = Baritone.settings().pathHistoryCutoffAmount.value;
|
||||||
CutoffPath newPath = new CutoffPath(path, cutoffAmt, path.length() - 1);
|
CutoffPath newPath = new CutoffPath(path, cutoffAmt, path.length() - 1);
|
||||||
if (!newPath.getDest().equals(path.getDest())) {
|
if (!newPath.getDest().equals(path.getDest())) {
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
|
@ -58,13 +58,13 @@ public final class FollowProcess extends BaritoneProcessHelper implements IFollo
|
|||||||
|
|
||||||
private Goal towards(Entity following) {
|
private Goal towards(Entity following) {
|
||||||
BlockPos pos;
|
BlockPos pos;
|
||||||
if (Baritone.settings().followOffsetDistance.get() == 0) {
|
if (Baritone.settings().followOffsetDistance.value == 0) {
|
||||||
pos = new BlockPos(following);
|
pos = new BlockPos(following);
|
||||||
} else {
|
} 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());
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ public class GetToBlockProcess extends BaritoneProcessHelper implements IGetToBl
|
|||||||
rescan(new ArrayList<>(), new CalculationContext(baritone));
|
rescan(new ArrayList<>(), new CalculationContext(baritone));
|
||||||
}
|
}
|
||||||
if (knownLocations.isEmpty()) {
|
if (knownLocations.isEmpty()) {
|
||||||
if (Baritone.settings().exploreForBlocks.get() && !calcFailed) {
|
if (Baritone.settings().exploreForBlocks.value && !calcFailed) {
|
||||||
return new PathingCommand(new GoalRunAway(1, start) {
|
return new PathingCommand(new GoalRunAway(1, start) {
|
||||||
@Override
|
@Override
|
||||||
public boolean isInGoal(int x, int y, int z) {
|
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));
|
Goal goal = new GoalComposite(knownLocations.stream().map(this::createGoal).toArray(Goal[]::new));
|
||||||
if (calcFailed) {
|
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");
|
logDirect("Unable to find any path to " + gettingTo + ", blacklisting presumably unreachable closest instances");
|
||||||
blacklistClosest();
|
blacklistClosest();
|
||||||
return onTick(false, isSafeToCancel); // gamer moment
|
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);
|
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
|
if (mineGoalUpdateInterval != 0 && tickCount++ % mineGoalUpdateInterval == 0) { // big brain
|
||||||
List<BlockPos> current = new ArrayList<>(knownLocations);
|
List<BlockPos> current = new ArrayList<>(knownLocations);
|
||||||
CalculationContext context = new CalculationContext(baritone, true);
|
CalculationContext context = new CalculationContext(baritone, true);
|
||||||
@ -200,14 +200,14 @@ public class GetToBlockProcess extends BaritoneProcessHelper implements IGetToBl
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean walkIntoInsteadOfAdjacent(Block block) {
|
private boolean walkIntoInsteadOfAdjacent(Block block) {
|
||||||
if (!Baritone.settings().enterPortal.get()) {
|
if (!Baritone.settings().enterPortal.value) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return block == Blocks.PORTAL;
|
return block == Blocks.PORTAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean rightClickOnArrival(Block block) {
|
private boolean rightClickOnArrival(Block block) {
|
||||||
if (!Baritone.settings().rightClickContainerOnArrival.get()) {
|
if (!Baritone.settings().rightClickContainerOnArrival.value) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return block == Blocks.CRAFTING_TABLE || block == Blocks.FURNACE || block == Blocks.ENDER_CHEST || block == Blocks.CHEST || block == Blocks.TRAPPED_CHEST;
|
return block == Blocks.CRAFTING_TABLE || block == Blocks.FURNACE || block == Blocks.ENDER_CHEST || block == Blocks.CHEST || block == Blocks.TRAPPED_CHEST;
|
||||||
|
@ -85,13 +85,13 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
|
|||||||
cancel();
|
cancel();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
int mineGoalUpdateInterval = Baritone.settings().mineGoalUpdateInterval.get();
|
int mineGoalUpdateInterval = Baritone.settings().mineGoalUpdateInterval.value;
|
||||||
if (mineGoalUpdateInterval != 0 && tickCount++ % mineGoalUpdateInterval == 0) { // big brain
|
if (mineGoalUpdateInterval != 0 && tickCount++ % mineGoalUpdateInterval == 0) { // big brain
|
||||||
List<BlockPos> curr = new ArrayList<>(knownOreLocations);
|
List<BlockPos> curr = new ArrayList<>(knownOreLocations);
|
||||||
CalculationContext context = new CalculationContext(baritone, true);
|
CalculationContext context = new CalculationContext(baritone, true);
|
||||||
Baritone.getExecutor().execute(() -> rescan(curr, context));
|
Baritone.getExecutor().execute(() -> rescan(curr, context));
|
||||||
}
|
}
|
||||||
if (Baritone.settings().legitMine.get()) {
|
if (Baritone.settings().legitMine.value) {
|
||||||
addNearby();
|
addNearby();
|
||||||
}
|
}
|
||||||
PathingCommand command = updateGoal();
|
PathingCommand command = updateGoal();
|
||||||
@ -115,7 +115,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
|
|||||||
}
|
}
|
||||||
|
|
||||||
private PathingCommand updateGoal() {
|
private PathingCommand updateGoal() {
|
||||||
boolean legit = Baritone.settings().legitMine.get();
|
boolean legit = Baritone.settings().legitMine.value;
|
||||||
List<BlockPos> locs = knownOreLocations;
|
List<BlockPos> locs = knownOreLocations;
|
||||||
if (!locs.isEmpty()) {
|
if (!locs.isEmpty()) {
|
||||||
List<BlockPos> locs2 = prune(new CalculationContext(baritone), new ArrayList<>(locs), mining, ORE_LOCATIONS_COUNT);
|
List<BlockPos> locs2 = prune(new CalculationContext(baritone), new ArrayList<>(locs), mining, ORE_LOCATIONS_COUNT);
|
||||||
@ -129,7 +129,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// only in non-Xray mode (aka legit mode) do we do this
|
// 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 (branchPoint == null) {
|
||||||
/*if (!baritone.getPathingBehavior().isPathing() && playerFeet().y == y) {
|
/*if (!baritone.getPathingBehavior().isPathing() && playerFeet().y == y) {
|
||||||
// cool, path is over and we are at desired y
|
// cool, path is over and we are at desired y
|
||||||
@ -157,7 +157,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
|
|||||||
if (mining == null) {
|
if (mining == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Baritone.settings().legitMine.get()) {
|
if (Baritone.settings().legitMine.value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<BlockPos> locs = searchWorld(context, mining, ORE_LOCATIONS_COUNT, already);
|
List<BlockPos> locs = searchWorld(context, mining, ORE_LOCATIONS_COUNT, already);
|
||||||
@ -171,18 +171,18 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Goal coalesce(IPlayerContext ctx, BlockPos loc, List<BlockPos> locs) {
|
private static Goal coalesce(IPlayerContext ctx, BlockPos loc, List<BlockPos> locs) {
|
||||||
if (!Baritone.settings().forceInternalMining.get()) {
|
if (!Baritone.settings().forceInternalMining.value) {
|
||||||
return new GoalTwoBlocks(loc);
|
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)
|
// 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 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.get() && BlockStateInterface.getBlock(ctx, loc.down()) == 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());
|
return upwardGoal == downwardGoal ? new GoalTwoBlocks(loc) : upwardGoal ? new GoalBlock(loc) : new GoalBlock(loc.down());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<BlockPos> droppedItemsScan(List<Block> mining, World world) {
|
public static List<BlockPos> droppedItemsScan(List<Block> mining, World world) {
|
||||||
if (!Baritone.settings().mineScanDroppedItems.get()) {
|
if (!Baritone.settings().mineScanDroppedItems.value) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
Set<Item> searchingFor = new HashSet<>();
|
Set<Item> searchingFor = new HashSet<>();
|
||||||
@ -211,7 +211,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
|
|||||||
for (Block m : mining) {
|
for (Block m : mining) {
|
||||||
if (CachedChunk.BLOCKS_TO_KEEP_TRACK_OF.contains(m)) {
|
if (CachedChunk.BLOCKS_TO_KEEP_TRACK_OF.contains(m)) {
|
||||||
// maxRegionDistanceSq 2 means adjacent directly or adjacent diagonally; nothing further than that
|
// maxRegionDistanceSq 2 means adjacent directly or adjacent diagonally; nothing further than that
|
||||||
locs.addAll(ctx.worldData.getCachedWorld().getLocationsOf(ChunkPacker.blockToString(m), Baritone.settings().maxCachedWorldScanCount.get(), ctx.getBaritone().getPlayerContext().playerFeet().getX(), ctx.getBaritone().getPlayerContext().playerFeet().getZ(), 2));
|
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 {
|
} else {
|
||||||
uninteresting.add(m);
|
uninteresting.add(m);
|
||||||
}
|
}
|
||||||
@ -242,7 +242,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
|
|||||||
// is an x-ray and it'll get caught
|
// is an x-ray and it'll get caught
|
||||||
if (mining.contains(bsi.get0(x, y, z).getBlock())) {
|
if (mining.contains(bsi.get0(x, y, z).getBlock())) {
|
||||||
BlockPos pos = new BlockPos(x, y, z);
|
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);
|
knownOreLocations.add(pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ public class BlockPlaceHelper implements Helper {
|
|||||||
if (!rightClickRequested || ctx.player().isRowingBoat() || mouseOver == null || mouseOver.getBlockPos() == null || mouseOver.typeOfHit != RayTraceResult.Type.BLOCK) {
|
if (!rightClickRequested || ctx.player().isRowingBoat() || mouseOver == null || mouseOver.getBlockPos() == null || mouseOver.typeOfHit != RayTraceResult.Type.BLOCK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
rightClickTimer = Baritone.settings().rightClickSpeed.get();
|
rightClickTimer = Baritone.settings().rightClickSpeed.value;
|
||||||
for (EnumHand hand : EnumHand.values()) {
|
for (EnumHand hand : EnumHand.values()) {
|
||||||
if (ctx.playerController().processRightClickBlock(ctx.player(), ctx.world(), mouseOver.getBlockPos(), 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);
|
ctx.player().swingArm(hand);
|
||||||
|
@ -66,7 +66,7 @@ public class BlockStateInterface {
|
|||||||
} else {
|
} else {
|
||||||
this.loadedChunks = worldLoaded; // this will only be used on the main thread
|
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.getMinecraft().isCallingFromMinecraftThread()) {
|
if (!Minecraft.getMinecraft().isCallingFromMinecraftThread()) {
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
|
@ -89,14 +89,14 @@ public class ExampleBaritoneControl extends Behavior implements Helper {
|
|||||||
@Override
|
@Override
|
||||||
public void onSendChatMessage(ChatEvent event) {
|
public void onSendChatMessage(ChatEvent event) {
|
||||||
String msg = event.getMessage();
|
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()))) {
|
if (!runCommand(msg.substring(COMMAND_PREFIX.length()))) {
|
||||||
logDirect("Invalid command");
|
logDirect("Invalid command");
|
||||||
}
|
}
|
||||||
event.cancel(); // always cancel if using prefixControl
|
event.cancel(); // always cancel if using prefixControl
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!Baritone.settings().chatControl.get() && !Baritone.settings().removePrefix.get()) {
|
if (!Baritone.settings().chatControl.value && !Baritone.settings().removePrefix.value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (runCommand(msg)) {
|
if (runCommand(msg)) {
|
||||||
|
@ -50,7 +50,7 @@ public interface Helper {
|
|||||||
* @param message The message to display in chat
|
* @param message The message to display in chat
|
||||||
*/
|
*/
|
||||||
default void logDebug(String message) {
|
default void logDebug(String message) {
|
||||||
if (!Baritone.settings().chatDebug.get()) {
|
if (!Baritone.settings().chatDebug.value) {
|
||||||
//System.out.println("Suppressed debug message:");
|
//System.out.println("Suppressed debug message:");
|
||||||
//System.out.println(message);
|
//System.out.println(message);
|
||||||
return;
|
return;
|
||||||
@ -67,6 +67,6 @@ public interface Helper {
|
|||||||
ITextComponent component = MESSAGE_PREFIX.createCopy();
|
ITextComponent component = MESSAGE_PREFIX.createCopy();
|
||||||
component.getStyle().setColor(TextFormatting.GRAY);
|
component.getStyle().setColor(TextFormatting.GRAY);
|
||||||
component.appendSibling(new TextComponentString(" " + message));
|
component.appendSibling(new TextComponentString(" " + message));
|
||||||
Minecraft.getMinecraft().addScheduledTask(() -> Baritone.settings().logger.get().accept(component));
|
Minecraft.getMinecraft().addScheduledTask(() -> Baritone.settings().logger.value.accept(component));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,9 +81,9 @@ public final class PathRenderer implements Helper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (goal != null && Baritone.settings().renderGoal.value) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,28 +97,28 @@ public final class PathRenderer implements Helper {
|
|||||||
// Render the current path, if there is one
|
// Render the current path, if there is one
|
||||||
if (current != null && current.getPath() != null) {
|
if (current != null && current.getPath() != null) {
|
||||||
int renderBegin = Math.max(current.getPosition() - 3, 0);
|
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) {
|
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();
|
//long split = System.nanoTime();
|
||||||
if (current != null) {
|
if (current != null) {
|
||||||
drawManySelectionBoxes(renderView, current.toBreak(), Baritone.settings().colorBlocksToBreak.get());
|
drawManySelectionBoxes(renderView, current.toBreak(), Baritone.settings().colorBlocksToBreak.value);
|
||||||
drawManySelectionBoxes(renderView, current.toPlace(), Baritone.settings().colorBlocksToPlace.get());
|
drawManySelectionBoxes(renderView, current.toPlace(), Baritone.settings().colorBlocksToPlace.value);
|
||||||
drawManySelectionBoxes(renderView, current.toWalkInto(), Baritone.settings().colorBlocksToWalkInto.get());
|
drawManySelectionBoxes(renderView, current.toWalkInto(), Baritone.settings().colorBlocksToWalkInto.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there is a path calculation currently running, render the path calculation process
|
// If there is a path calculation currently running, render the path calculation process
|
||||||
behavior.getInProgress().ifPresent(currentlyRunning -> {
|
behavior.getInProgress().ifPresent(currentlyRunning -> {
|
||||||
currentlyRunning.bestPathSoFar().ifPresent(p -> {
|
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 -> {
|
currentlyRunning.pathToMostRecentNodeConsidered().ifPresent(mr -> {
|
||||||
|
|
||||||
drawPath(mr, 0, renderView, partialTicks, Baritone.settings().colorMostRecentConsidered.get(), Baritone.settings().fadePath.get(), 10, 20);
|
drawPath(mr, 0, renderView, partialTicks, Baritone.settings().colorMostRecentConsidered.value, Baritone.settings().fadePath.value, 10, 20);
|
||||||
drawManySelectionBoxes(renderView, Collections.singletonList(mr.getDest()), Baritone.settings().colorMostRecentConsidered.get());
|
drawManySelectionBoxes(renderView, Collections.singletonList(mr.getDest()), Baritone.settings().colorMostRecentConsidered.value);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
//long end = System.nanoTime();
|
//long end = System.nanoTime();
|
||||||
@ -132,10 +132,10 @@ public final class PathRenderer implements Helper {
|
|||||||
GlStateManager.enableBlend();
|
GlStateManager.enableBlend();
|
||||||
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
|
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
|
||||||
GlStateManager.color(color.getColorComponents(null)[0], color.getColorComponents(null)[1], color.getColorComponents(null)[2], 0.4F);
|
GlStateManager.color(color.getColorComponents(null)[0], color.getColorComponents(null)[1], color.getColorComponents(null)[2], 0.4F);
|
||||||
GlStateManager.glLineWidth(Baritone.settings().pathRenderLineWidthPixels.get());
|
GlStateManager.glLineWidth(Baritone.settings().pathRenderLineWidthPixels.value);
|
||||||
GlStateManager.disableTexture2D();
|
GlStateManager.disableTexture2D();
|
||||||
GlStateManager.depthMask(false);
|
GlStateManager.depthMask(false);
|
||||||
if (Baritone.settings().renderPathIgnoreDepth.get()) {
|
if (Baritone.settings().renderPathIgnoreDepth.value) {
|
||||||
GlStateManager.disableDepth();
|
GlStateManager.disableDepth();
|
||||||
}
|
}
|
||||||
List<BetterBlockPos> positions = path.positions();
|
List<BetterBlockPos> positions = path.positions();
|
||||||
@ -178,7 +178,7 @@ public final class PathRenderer implements Helper {
|
|||||||
drawLine(player, x1, y1, z1, x2, y2, z2);
|
drawLine(player, x1, y1, z1, x2, y2, z2);
|
||||||
tessellator.draw();
|
tessellator.draw();
|
||||||
}
|
}
|
||||||
if (Baritone.settings().renderPathIgnoreDepth.get()) {
|
if (Baritone.settings().renderPathIgnoreDepth.value) {
|
||||||
GlStateManager.enableDepth();
|
GlStateManager.enableDepth();
|
||||||
}
|
}
|
||||||
//GlStateManager.color(0.0f, 0.0f, 0.0f, 0.4f);
|
//GlStateManager.color(0.0f, 0.0f, 0.0f, 0.4f);
|
||||||
@ -203,11 +203,11 @@ public final class PathRenderer implements Helper {
|
|||||||
GlStateManager.enableBlend();
|
GlStateManager.enableBlend();
|
||||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||||
GlStateManager.color(color.getColorComponents(null)[0], color.getColorComponents(null)[1], color.getColorComponents(null)[2], 0.4F);
|
GlStateManager.color(color.getColorComponents(null)[0], color.getColorComponents(null)[1], color.getColorComponents(null)[2], 0.4F);
|
||||||
GlStateManager.glLineWidth(Baritone.settings().pathRenderLineWidthPixels.get());
|
GlStateManager.glLineWidth(Baritone.settings().pathRenderLineWidthPixels.value);
|
||||||
GlStateManager.disableTexture2D();
|
GlStateManager.disableTexture2D();
|
||||||
GlStateManager.depthMask(false);
|
GlStateManager.depthMask(false);
|
||||||
|
|
||||||
if (Baritone.settings().renderSelectionBoxesIgnoreDepth.get()) {
|
if (Baritone.settings().renderSelectionBoxesIgnoreDepth.value) {
|
||||||
GlStateManager.disableDepth();
|
GlStateManager.disableDepth();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,7 +249,7 @@ public final class PathRenderer implements Helper {
|
|||||||
TESSELLATOR.draw();
|
TESSELLATOR.draw();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (Baritone.settings().renderSelectionBoxesIgnoreDepth.get()) {
|
if (Baritone.settings().renderSelectionBoxesIgnoreDepth.value) {
|
||||||
GlStateManager.enableDepth();
|
GlStateManager.enableDepth();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -292,12 +292,12 @@ public final class PathRenderer implements Helper {
|
|||||||
} else if (goal instanceof GoalXZ) {
|
} else if (goal instanceof GoalXZ) {
|
||||||
GoalXZ goalPos = (GoalXZ) goal;
|
GoalXZ goalPos = (GoalXZ) goal;
|
||||||
|
|
||||||
if (Baritone.settings().renderGoalXZBeacon.get()) {
|
if (Baritone.settings().renderGoalXZBeacon.value) {
|
||||||
glPushAttrib(GL_LIGHTING_BIT);
|
glPushAttrib(GL_LIGHTING_BIT);
|
||||||
|
|
||||||
mc.getTextureManager().bindTexture(TileEntityBeaconRenderer.TEXTURE_BEACON_BEAM);
|
mc.getTextureManager().bindTexture(TileEntityBeaconRenderer.TEXTURE_BEACON_BEAM);
|
||||||
|
|
||||||
if (Baritone.settings().renderGoalIgnoreDepth.get()) {
|
if (Baritone.settings().renderGoalIgnoreDepth.value) {
|
||||||
GlStateManager.disableDepth();
|
GlStateManager.disableDepth();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,7 +313,7 @@ public final class PathRenderer implements Helper {
|
|||||||
color.getColorComponents(null)
|
color.getColorComponents(null)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (Baritone.settings().renderGoalIgnoreDepth.get()) {
|
if (Baritone.settings().renderGoalIgnoreDepth.value) {
|
||||||
GlStateManager.enableDepth();
|
GlStateManager.enableDepth();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -342,10 +342,10 @@ public final class PathRenderer implements Helper {
|
|||||||
GlStateManager.enableBlend();
|
GlStateManager.enableBlend();
|
||||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||||
GlStateManager.color(color.getColorComponents(null)[0], color.getColorComponents(null)[1], color.getColorComponents(null)[2], 0.6F);
|
GlStateManager.color(color.getColorComponents(null)[0], color.getColorComponents(null)[1], color.getColorComponents(null)[2], 0.6F);
|
||||||
GlStateManager.glLineWidth(Baritone.settings().goalRenderLineWidthPixels.get());
|
GlStateManager.glLineWidth(Baritone.settings().goalRenderLineWidthPixels.value);
|
||||||
GlStateManager.disableTexture2D();
|
GlStateManager.disableTexture2D();
|
||||||
GlStateManager.depthMask(false);
|
GlStateManager.depthMask(false);
|
||||||
if (Baritone.settings().renderGoalIgnoreDepth.get()) {
|
if (Baritone.settings().renderGoalIgnoreDepth.value) {
|
||||||
GlStateManager.disableDepth();
|
GlStateManager.disableDepth();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -363,7 +363,7 @@ public final class PathRenderer implements Helper {
|
|||||||
BUFFER.pos(minX, maxY, maxZ).endVertex();
|
BUFFER.pos(minX, maxY, maxZ).endVertex();
|
||||||
TESSELLATOR.draw();
|
TESSELLATOR.draw();
|
||||||
|
|
||||||
if (Baritone.settings().renderGoalIgnoreDepth.get()) {
|
if (Baritone.settings().renderGoalIgnoreDepth.value) {
|
||||||
GlStateManager.enableDepth();
|
GlStateManager.enableDepth();
|
||||||
}
|
}
|
||||||
GlStateManager.depthMask(true);
|
GlStateManager.depthMask(true);
|
||||||
|
@ -136,7 +136,7 @@ public class PathingControlManager implements IPathingControlManager {
|
|||||||
p.secretInternalSetGoalAndPath(command.goal);
|
p.secretInternalSetGoalAndPath(command.goal);
|
||||||
break;
|
break;
|
||||||
case REVALIDATE_GOAL_AND_PATH:
|
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.softCancelIfSafe();
|
||||||
}
|
}
|
||||||
p.secretInternalSetGoalAndPath(command.goal);
|
p.secretInternalSetGoalAndPath(command.goal);
|
||||||
|
@ -55,7 +55,7 @@ public class ToolSet {
|
|||||||
breakStrengthCache = new HashMap<>();
|
breakStrengthCache = new HashMap<>();
|
||||||
this.player = player;
|
this.player = player;
|
||||||
|
|
||||||
if (Baritone.settings().considerPotionEffects.get()) {
|
if (Baritone.settings().considerPotionEffects.value) {
|
||||||
double amplifier = potionAmplifier();
|
double amplifier = potionAmplifier();
|
||||||
Function<Double, Double> amplify = x -> amplifier * x;
|
Function<Double, Double> amplify = x -> amplifier * x;
|
||||||
backendCalculation = amplify.compose(this::getBestDestructionTime);
|
backendCalculation = amplify.compose(this::getBestDestructionTime);
|
||||||
|
@ -57,17 +57,17 @@ public class Avoidance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static List<Avoidance> create(IPlayerContext ctx) {
|
public static List<Avoidance> create(IPlayerContext ctx) {
|
||||||
if (!Baritone.settings().avoidance.get()) {
|
if (!Baritone.settings().avoidance.value) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
List<Avoidance> res = new ArrayList<>();
|
List<Avoidance> res = new ArrayList<>();
|
||||||
double mobSpawnerCoeff = Baritone.settings().mobSpawnerAvoidanceCoefficient.get();
|
double mobSpawnerCoeff = Baritone.settings().mobSpawnerAvoidanceCoefficient.value;
|
||||||
double mobCoeff = Baritone.settings().mobAvoidanceCoefficient.get();
|
double mobCoeff = Baritone.settings().mobAvoidanceCoefficient.value;
|
||||||
if (mobSpawnerCoeff != 1.0D) {
|
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) {
|
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;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ public final class Favoring {
|
|||||||
public Favoring(IPath previous) { // create one just from previous path, no mob avoidances
|
public Favoring(IPath previous) { // create one just from previous path, no mob avoidances
|
||||||
favorings = new Long2DoubleOpenHashMap();
|
favorings = new Long2DoubleOpenHashMap();
|
||||||
favorings.defaultReturnValue(1.0D);
|
favorings.defaultReturnValue(1.0D);
|
||||||
double coeff = Baritone.settings().backtrackCostFavoringCoefficient.get();
|
double coeff = Baritone.settings().backtrackCostFavoringCoefficient.value;
|
||||||
if (coeff != 1D && previous != null) {
|
if (coeff != 1D && previous != null) {
|
||||||
previous.positions().forEach(pos -> favorings.put(BetterBlockPos.longHash(pos), coeff));
|
previous.positions().forEach(pos -> favorings.put(BetterBlockPos.longHash(pos), coeff));
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ import net.minecraft.util.math.BlockPos;
|
|||||||
public abstract class PathBase implements IPath {
|
public abstract class PathBase implements IPath {
|
||||||
@Override
|
@Override
|
||||||
public PathBase cutoffAtLoadedChunks(Object bsi0) { // <-- cursed cursed cursed
|
public PathBase cutoffAtLoadedChunks(Object bsi0) { // <-- cursed cursed cursed
|
||||||
if (!Baritone.settings().cutoffAtLoadBoundary.get()) {
|
if (!Baritone.settings().cutoffAtLoadBoundary.value) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
BlockStateInterface bsi = (BlockStateInterface) bsi0;
|
BlockStateInterface bsi = (BlockStateInterface) bsi0;
|
||||||
@ -43,14 +43,14 @@ public abstract class PathBase implements IPath {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PathBase staticCutoff(Goal destination) {
|
public PathBase staticCutoff(Goal destination) {
|
||||||
int min = BaritoneAPI.getSettings().pathCutoffMinimumLength.get();
|
int min = BaritoneAPI.getSettings().pathCutoffMinimumLength.value;
|
||||||
if (length() < min) {
|
if (length() < min) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
if (destination == null || destination.isInGoal(getDest())) {
|
if (destination == null || destination.isInGoal(getDest())) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
double factor = BaritoneAPI.getSettings().pathCutoffFactor.get();
|
double factor = BaritoneAPI.getSettings().pathCutoffFactor.value;
|
||||||
int newLength = (int) ((length() - min) * factor) + min - 1;
|
int newLength = (int) ((length() - min) * factor) + min - 1;
|
||||||
return new CutoffPath(this, newLength);
|
return new CutoffPath(this, newLength);
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ public class SegmentedCalculator {
|
|||||||
private PathCalculationResult segment(Optional<IPath> previous) {
|
private PathCalculationResult segment(Optional<IPath> previous) {
|
||||||
BetterBlockPos segmentStart = previous.map(IPath::getDest).orElse(start); // <-- e p i c
|
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.
|
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<IPath> onCompletion, Runnable onFailure) {
|
public static void calculateSegmentsThreaded(BetterBlockPos start, Goal goal, CalculationContext context, Consumer<IPath> onCompletion, Runnable onFailure) {
|
||||||
|
Loading…
Reference in New Issue
Block a user