001/* 002 * This file is part of Baritone. 003 * 004 * Baritone is free software: you can redistribute it and/or modify 005 * it under the terms of the GNU Lesser General Public License as published by 006 * the Free Software Foundation, either version 3 of the License, or 007 * (at your option) any later version. 008 * 009 * Baritone is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 012 * GNU Lesser General Public License for more details. 013 * 014 * You should have received a copy of the GNU Lesser General Public License 015 * along with Baritone. If not, see <https://www.gnu.org/licenses/>. 016 */ 017 018package baritone.api; 019 020import baritone.api.utils.Helper; 021import baritone.api.utils.NotificationHelper; 022import baritone.api.utils.SettingsUtil; 023import baritone.api.utils.TypeUtils; 024import baritone.api.utils.gui.BaritoneToast; 025import net.minecraft.client.GuiMessageTag; 026import net.minecraft.client.Minecraft; 027import net.minecraft.core.Vec3i; 028import net.minecraft.network.chat.Component; 029import net.minecraft.world.item.Item; 030import net.minecraft.world.level.block.Block; 031import net.minecraft.world.level.block.Blocks; 032import net.minecraft.world.level.block.Mirror; 033import net.minecraft.world.level.block.Rotation; 034 035import org.slf4j.Logger; 036import org.slf4j.LoggerFactory; 037 038import java.awt.*; 039import java.lang.annotation.ElementType; 040import java.lang.annotation.Retention; 041import java.lang.annotation.RetentionPolicy; 042import java.lang.annotation.Target; 043import java.lang.reflect.Field; 044import java.lang.reflect.ParameterizedType; 045import java.lang.reflect.Type; 046import java.util.List; 047import java.util.*; 048import java.util.concurrent.TimeUnit; 049import java.util.function.BiConsumer; 050import java.util.function.Consumer; 051 052/** 053 * Baritone's settings. Settings apply to all Baritone instances. 054 * 055 * @author leijurv 056 */ 057public final class Settings { 058 private static final Logger LOGGER = LoggerFactory.getLogger("Baritone"); 059 060 /** 061 * Allow Baritone to break blocks 062 */ 063 public final Setting<Boolean> allowBreak = new Setting<>(true); 064 065 /** 066 * Blocks that baritone will be allowed to break even with allowBreak set to false 067 */ 068 public final Setting<List<Block>> allowBreakAnyway = new Setting<>(new ArrayList<>()); 069 070 /** 071 * Allow Baritone to sprint 072 */ 073 public final Setting<Boolean> allowSprint = new Setting<>(true); 074 075 /** 076 * Allow Baritone to place blocks 077 */ 078 public final Setting<Boolean> allowPlace = new Setting<>(true); 079 080 /** 081 * Allow Baritone to place blocks in fluid source blocks 082 */ 083 public final Setting<Boolean> allowPlaceInFluidsSource = new Setting<>(true); 084 085 /** 086 * Allow Baritone to place blocks in flowing fluid 087 */ 088 public final Setting<Boolean> allowPlaceInFluidsFlow = new Setting<>(true); 089 090 /** 091 * Allow Baritone to move items in your inventory to your hotbar 092 */ 093 public final Setting<Boolean> allowInventory = new Setting<>(false); 094 095 /** 096 * Wait this many ticks between InventoryBehavior moving inventory items 097 */ 098 public final Setting<Integer> ticksBetweenInventoryMoves = new Setting<>(1); 099 100 /** 101 * Come to a halt before doing any inventory moves. Intended for anticheat such as 2b2t 102 */ 103 public final Setting<Boolean> inventoryMoveOnlyIfStationary = new Setting<>(false); 104 105 /** 106 * Disable baritone's auto-tool at runtime, but still assume that another mod will provide auto tool functionality 107 * <p> 108 * Specifically, path calculation will still assume that an auto tool will run at execution time, even though 109 * Baritone itself will not do that. 110 */ 111 public final Setting<Boolean> assumeExternalAutoTool = new Setting<>(false); 112 113 /** 114 * Automatically select the best available tool 115 */ 116 public final Setting<Boolean> autoTool = new Setting<>(true); 117 118 /** 119 * It doesn't actually take twenty ticks to place a block, this cost is so high 120 * because we want to generally conserve blocks which might be limited. 121 * <p> 122 * Decrease to make Baritone more often consider paths that would require placing blocks 123 */ 124 public final Setting<Double> blockPlacementPenalty = new Setting<>(20D); 125 126 /** 127 * This is just a tiebreaker to make it less likely to break blocks if it can avoid it. 128 * For example, fire has a break cost of 0, this makes it nonzero, so all else being equal 129 * it will take an otherwise equivalent route that doesn't require it to put out fire. 130 */ 131 public final Setting<Double> blockBreakAdditionalPenalty = new Setting<>(2D); 132 133 /** 134 * Additional penalty for hitting the space bar (ascend, pillar, or parkour) because it uses hunger 135 */ 136 public final Setting<Double> jumpPenalty = new Setting<>(2D); 137 138 /** 139 * Walking on water uses up hunger really quick, so penalize it 140 */ 141 public final Setting<Double> walkOnWaterOnePenalty = new Setting<>(3D); 142 143 /** 144 * Don't allow breaking blocks next to liquids. 145 * <p> 146 * Enable if you have mods adding custom fluid physics. 147 */ 148 public final Setting<Boolean> strictLiquidCheck = new Setting<>(false); 149 150 /** 151 * Allow Baritone to fall arbitrary distances and place a water bucket beneath it. 152 * Reliability: questionable. 153 */ 154 public final Setting<Boolean> allowWaterBucketFall = new Setting<>(true); 155 156 /** 157 * Allow Baritone to assume it can walk on still water just like any other block. 158 * This functionality is assumed to be provided by a separate library that might have imported Baritone. 159 * <p> 160 * Note: This will prevent some usage of the frostwalker enchantment, like pillaring up from water. 161 */ 162 public final Setting<Boolean> assumeWalkOnWater = new Setting<>(false); 163 164 /** 165 * If you have Fire Resistance and Jesus then I guess you could turn this on lol 166 */ 167 public final Setting<Boolean> assumeWalkOnLava = new Setting<>(false); 168 169 /** 170 * Assume step functionality; don't jump on an Ascend. 171 */ 172 public final Setting<Boolean> assumeStep = new Setting<>(false); 173 174 /** 175 * Assume safe walk functionality; don't sneak on a backplace traverse. 176 * <p> 177 * Warning: if you do something janky like sneak-backplace from an ender chest, if this is true 178 * it won't sneak right click, it'll just right click, which means it'll open the chest instead of placing 179 * against it. That's why this defaults to off. 180 */ 181 public final Setting<Boolean> assumeSafeWalk = new Setting<>(false); 182 183 /** 184 * If true, parkour is allowed to make jumps when standing on blocks at the maximum height, so player feet is y=256 185 * <p> 186 * Defaults to false because this fails on constantiam. Please let me know if this is ever disabled. Please. 187 */ 188 public final Setting<Boolean> allowJumpAtBuildLimit = new Setting<>(false); 189 190 /** 191 * Just here so mods that use the API don't break. Does nothing. 192 */ 193 @Deprecated 194 @JavaOnly 195 public final Setting<Boolean> allowJumpAt256 = new Setting<>(false); 196 197 /** 198 * This should be monetized it's so good 199 * <p> 200 * Defaults to true, but only actually takes effect if allowParkour is also true 201 */ 202 public final Setting<Boolean> allowParkourAscend = new Setting<>(true); 203 204 /** 205 * Allow descending diagonally 206 * <p> 207 * Safer than allowParkour yet still slightly unsafe, can make contact with unchecked adjacent blocks, so it's unsafe in the nether. 208 * <p> 209 * For a generic "take some risks" mode I'd turn on this one, parkour, and parkour place. 210 */ 211 public final Setting<Boolean> allowDiagonalDescend = new Setting<>(false); 212 213 /** 214 * Allow diagonal ascending 215 * <p> 216 * Actually pretty safe, much safer than diagonal descend tbh 217 */ 218 public final Setting<Boolean> allowDiagonalAscend = new Setting<>(false); 219 220 /** 221 * Allow mining the block directly beneath its feet 222 * <p> 223 * Turn this off to force it to make more staircases and less shafts 224 */ 225 public final Setting<Boolean> allowDownward = new Setting<>(true); 226 227 /** 228 * Blocks that Baritone is allowed to place (as throwaway, for sneak bridging, pillaring, etc.) 229 */ 230 public final Setting<List<Item>> acceptableThrowawayItems = new Setting<>(new ArrayList<>(Arrays.asList( 231 Blocks.DIRT.asItem(), 232 Blocks.COBBLESTONE.asItem(), 233 Blocks.NETHERRACK.asItem(), 234 Blocks.STONE.asItem() 235 ))); 236 237 /** 238 * Blocks that Baritone will attempt to avoid (Used in avoidance) 239 */ 240 public final Setting<List<Block>> blocksToAvoid = new Setting<>(new ArrayList<>( 241 // Leave Empty by Default 242 )); 243 244 /** 245 * Blocks that Baritone is not allowed to break 246 */ 247 public final Setting<List<Block>> blocksToDisallowBreaking = new Setting<>(new ArrayList<>( 248 // Leave Empty by Default 249 )); 250 251 /** 252 * blocks that baritone shouldn't break, but can if it needs to. 253 */ 254 public final Setting<List<Block>> blocksToAvoidBreaking = new Setting<>(new ArrayList<>(Arrays.asList( // TODO can this be a HashSet or ImmutableSet? 255 Blocks.CRAFTING_TABLE, 256 Blocks.FURNACE, 257 Blocks.CHEST, 258 Blocks.TRAPPED_CHEST 259 ))); 260 261 /** 262 * this multiplies the break speed, if set above 1 it's "encourage breaking" instead 263 */ 264 public final Setting<Double> avoidBreakingMultiplier = new Setting<>(.1); 265 266 /** 267 * A list of blocks to be treated as if they're air. 268 * <p> 269 * If a schematic asks for air at a certain position, and that position currently contains a block on this list, it will be treated as correct. 270 */ 271 public final Setting<List<Block>> buildIgnoreBlocks = new Setting<>(new ArrayList<>(Arrays.asList( 272 273 ))); 274 275 /** 276 * A list of blocks to be treated as correct. 277 * <p> 278 * If a schematic asks for any block on this list at a certain position, it will be treated as correct, regardless of what it currently is. 279 */ 280 public final Setting<List<Block>> buildSkipBlocks = new Setting<>(new ArrayList<>(Arrays.asList( 281 282 ))); 283 284 /** 285 * A mapping of blocks to blocks treated as correct in their position 286 * <p> 287 * If a schematic asks for a block on this mapping, all blocks on the mapped list will be accepted at that location as well 288 * <p> 289 * Syntax same as <a href="https://baritone.leijurv.com/baritone/api/Settings.html#buildSubstitutes">buildSubstitutes</a> 290 */ 291 public final Setting<Map<Block, List<Block>>> buildValidSubstitutes = new Setting<>(new HashMap<>()); 292 293 /** 294 * A mapping of blocks to blocks to be built instead 295 * <p> 296 * If a schematic asks for a block on this mapping, Baritone will place the first placeable block in the mapped list 297 * <p> 298 * Usage Syntax: 299 * <pre> 300 * sourceblockA->blockToSubstituteA1,blockToSubstituteA2,...blockToSubstituteAN,sourceBlockB->blockToSubstituteB1,blockToSubstituteB2,...blockToSubstituteBN,...sourceBlockX->blockToSubstituteX1,blockToSubstituteX2...blockToSubstituteXN 301 * </pre> 302 * Example: 303 * <pre> 304 * stone->cobblestone,andesite,oak_planks->birch_planks,acacia_planks,glass 305 * </pre> 306 */ 307 public final Setting<Map<Block, List<Block>>> buildSubstitutes = new Setting<>(new HashMap<>()); 308 309 /** 310 * A list of blocks to become air 311 * <p> 312 * If a schematic asks for a block on this list, only air will be accepted at that location (and nothing on buildIgnoreBlocks) 313 */ 314 public final Setting<List<Block>> okIfAir = new Setting<>(new ArrayList<>(Arrays.asList( 315 316 ))); 317 318 /** 319 * If this is true, the builder will treat all non-air blocks as correct. It will only place new blocks. 320 */ 321 public final Setting<Boolean> buildIgnoreExisting = new Setting<>(false); 322 323 /** 324 * If this is true, the builder will ignore directionality of certain blocks like glazed terracotta. 325 */ 326 public final Setting<Boolean> buildIgnoreDirection = new Setting<>(false); 327 328 /** 329 * A list of names of block properties the builder will ignore. 330 */ 331 public final Setting<List<String>> buildIgnoreProperties = new Setting<>(new ArrayList<>(Arrays.asList( 332 ))); 333 334 /** 335 * If this setting is true, Baritone will never break a block that is adjacent to an unsupported falling block. 336 * <p> 337 * I.E. it will never trigger cascading sand / gravel falls 338 */ 339 public final Setting<Boolean> avoidUpdatingFallingBlocks = new Setting<>(true); 340 341 /** 342 * Enables some more advanced vine features. They're honestly just gimmicks and won't ever be needed in real 343 * pathing scenarios. And they can cause Baritone to get trapped indefinitely in a strange scenario. 344 * <p> 345 * Almost never turn this on lol 346 */ 347 public final Setting<Boolean> allowVines = new Setting<>(false); 348 349 /** 350 * Slab behavior is complicated, disable this for higher path reliability. Leave enabled if you have bottom slabs 351 * everywhere in your base. 352 */ 353 public final Setting<Boolean> allowWalkOnBottomSlab = new Setting<>(true); 354 355 /** 356 * You know what it is 357 * <p> 358 * But it's very unreliable and falls off when cornering like all the time so. 359 * <p> 360 * It also overshoots the landing pretty much always (making contact with the next block over), so be careful 361 */ 362 public final Setting<Boolean> allowParkour = new Setting<>(false); 363 364 /** 365 * Actually pretty reliable. 366 * <p> 367 * Doesn't make it any more dangerous compared to just normal allowParkour th 368 */ 369 public final Setting<Boolean> allowParkourPlace = new Setting<>(false); 370 371 /** 372 * For example, if you have Mining Fatigue or Haste, adjust the costs of breaking blocks accordingly. 373 */ 374 public final Setting<Boolean> considerPotionEffects = new Setting<>(true); 375 376 /** 377 * Sprint and jump a block early on ascends wherever possible 378 */ 379 public final Setting<Boolean> sprintAscends = new Setting<>(true); 380 381 /** 382 * If we overshoot a traverse and end up one block beyond the destination, mark it as successful anyway. 383 * <p> 384 * This helps with speed exceeding 20m/s 385 */ 386 public final Setting<Boolean> overshootTraverse = new Setting<>(true); 387 388 /** 389 * When breaking blocks for a movement, wait until all falling blocks have settled before continuing 390 */ 391 public final Setting<Boolean> pauseMiningForFallingBlocks = new Setting<>(true); 392 393 /** 394 * How many ticks between right clicks are allowed. Default in game is 4 395 */ 396 public final Setting<Integer> rightClickSpeed = new Setting<>(4); 397 398 /** 399 * How many degrees to randomize the yaw every tick. Set to 0 to disable 400 */ 401 public final Setting<Double> randomLooking113 = new Setting<>(2d); 402 403 /** 404 * Block reach distance 405 */ 406 public final Setting<Float> blockReachDistance = new Setting<>(4.5f); 407 408 /** 409 * How many ticks between breaking a block and starting to break the next block. Default in game is 6 ticks. 410 * Values under 1 will be clamped. The delay only applies to non-instant (1-tick) breaks. 411 */ 412 public final Setting<Integer> blockBreakSpeed = new Setting<>(6); 413 414 /** 415 * How many degrees to randomize the pitch and yaw every tick. Set to 0 to disable 416 */ 417 public final Setting<Double> randomLooking = new Setting<>(0.01d); 418 419 /** 420 * This is the big A* setting. 421 * As long as your cost heuristic is an *underestimate*, it's guaranteed to find you the best path. 422 * 3.5 is always an underestimate, even if you are sprinting. 423 * If you're walking only (with allowSprint off) 4.6 is safe. 424 * Any value below 3.5 is never worth it. It's just more computation to find the same path, guaranteed. 425 * (specifically, it needs to be strictly slightly less than ActionCosts.WALK_ONE_BLOCK_COST, which is about 3.56) 426 * <p> 427 * Setting it at 3.57 or above with sprinting, or to 4.64 or above without sprinting, will result in 428 * faster computation, at the cost of a suboptimal path. Any value above the walk / sprint cost will result 429 * in it going straight at its goal, and not investigating alternatives, because the combined cost / heuristic 430 * metric gets better and better with each block, instead of slightly worse. 431 * <p> 432 * Finding the optimal path is worth it, so it's the default. 433 */ 434 public final Setting<Double> costHeuristic = new Setting<>(3.563); 435 436 // a bunch of obscure internal A* settings that you probably don't want to change 437 /** 438 * The maximum number of times it will fetch outside loaded or cached chunks before assuming that 439 * pathing has reached the end of the known area, and should therefore stop. 440 */ 441 public final Setting<Integer> pathingMaxChunkBorderFetch = new Setting<>(50); 442 443 /** 444 * Set to 1.0 to effectively disable this feature 445 * 446 * @see <a href="https://github.com/cabaletta/baritone/issues/18">Issue #18</a> 447 */ 448 public final Setting<Double> backtrackCostFavoringCoefficient = new Setting<>(0.5); 449 450 /** 451 * Toggle the following 4 settings 452 * <p> 453 * They have a noticeable performance impact, so they default off 454 * <p> 455 * Specifically, building up the avoidance map on the main thread before pathing starts actually takes a noticeable 456 * amount of time, especially when there are a lot of mobs around, and your game jitters for like 200ms while doing so 457 */ 458 public final Setting<Boolean> avoidance = new Setting<>(false); 459 460 /** 461 * Set to 1.0 to effectively disable this feature 462 * <p> 463 * Set below 1.0 to go out of your way to walk near mob spawners 464 */ 465 public final Setting<Double> mobSpawnerAvoidanceCoefficient = new Setting<>(2.0); 466 467 /** 468 * Distance to avoid mob spawners. 469 */ 470 public final Setting<Integer> mobSpawnerAvoidanceRadius = new Setting<>(16); 471 472 /** 473 * Set to 1.0 to effectively disable this feature 474 * <p> 475 * Set below 1.0 to go out of your way to walk near mobs 476 */ 477 public final Setting<Double> mobAvoidanceCoefficient = new Setting<>(1.5); 478 479 /** 480 * Distance to avoid mobs. 481 */ 482 public final Setting<Integer> mobAvoidanceRadius = new Setting<>(8); 483 484 /** 485 * When running a goto towards a container block (chest, ender chest, furnace, etc), 486 * right click and open it once you arrive. 487 */ 488 public final Setting<Boolean> rightClickContainerOnArrival = new Setting<>(true); 489 490 /** 491 * When running a goto towards a nether portal block, walk all the way into the portal 492 * instead of stopping one block before. 493 */ 494 public final Setting<Boolean> enterPortal = new Setting<>(true); 495 496 /** 497 * Don't repropagate cost improvements below 0.01 ticks. They're all just floating point inaccuracies, 498 * and there's no point. 499 */ 500 public final Setting<Boolean> minimumImprovementRepropagation = new Setting<>(true); 501 502 /** 503 * After calculating a path (potentially through cached chunks), artificially cut it off to just the part that is 504 * entirely within currently loaded chunks. Improves path safety because cached chunks are heavily simplified. 505 * <p> 506 * This is much safer to leave off now, and makes pathing more efficient. More explanation in the issue. 507 * 508 * @see <a href="https://github.com/cabaletta/baritone/issues/114">Issue #114</a> 509 */ 510 public final Setting<Boolean> cutoffAtLoadBoundary = new Setting<>(false); 511 512 /** 513 * If a movement's cost increases by more than this amount between calculation and execution (due to changes 514 * in the environment / world), cancel and recalculate 515 */ 516 public final Setting<Double> maxCostIncrease = new Setting<>(10D); 517 518 /** 519 * Stop 5 movements before anything that made the path COST_INF. 520 * For example, if lava has spread across the path, don't walk right up to it then recalculate, it might 521 * still be spreading lol 522 */ 523 public final Setting<Integer> costVerificationLookahead = new Setting<>(5); 524 525 /** 526 * Static cutoff factor. 0.9 means cut off the last 10% of all paths, regardless of chunk load state 527 */ 528 public final Setting<Double> pathCutoffFactor = new Setting<>(0.9); 529 530 /** 531 * Only apply static cutoff for paths of at least this length (in terms of number of movements) 532 */ 533 public final Setting<Integer> pathCutoffMinimumLength = new Setting<>(30); 534 535 /** 536 * Start planning the next path once the remaining movements tick estimates sum up to less than this value 537 */ 538 public final Setting<Integer> planningTickLookahead = new Setting<>(150); 539 540 /** 541 * Default size of the Long2ObjectOpenHashMap used in pathing 542 */ 543 public final Setting<Integer> pathingMapDefaultSize = new Setting<>(1024); 544 545 /** 546 * Load factor coefficient for the Long2ObjectOpenHashMap used in pathing 547 * <p> 548 * Decrease for faster map operations, but higher memory usage 549 */ 550 public final Setting<Float> pathingMapLoadFactor = new Setting<>(0.75f); 551 552 /** 553 * How far are you allowed to fall onto solid ground (without a water bucket)? 554 * 3 won't deal any damage. But if you just want to get down the mountain quickly and you have 555 * Feather Falling IV, you might set it a bit higher, like 4 or 5. 556 */ 557 public final Setting<Integer> maxFallHeightNoWater = new Setting<>(3); 558 559 /** 560 * How far are you allowed to fall onto solid ground (with a water bucket)? 561 * It's not that reliable, so I've set it below what would kill an unarmored player (23) 562 */ 563 public final Setting<Integer> maxFallHeightBucket = new Setting<>(20); 564 565 /** 566 * Is it okay to sprint through a descend followed by a diagonal? 567 * The player overshoots the landing, but not enough to fall off. And the diagonal ensures that there isn't 568 * lava or anything that's !canWalkInto in that space, so it's technically safe, just a little sketchy. 569 * <p> 570 * Note: this is *not* related to the allowDiagonalDescend setting, that is a completely different thing. 571 */ 572 public final Setting<Boolean> allowOvershootDiagonalDescend = new Setting<>(true); 573 574 /** 575 * If your goal is a GoalBlock in an unloaded chunk, assume it's far enough away that the Y coord 576 * doesn't matter yet, and replace it with a GoalXZ to the same place before calculating a path. 577 * Once a segment ends within chunk load range of the GoalBlock, it will go back to normal behavior 578 * of considering the Y coord. The reasoning is that if your X and Z are 10,000 blocks away, 579 * your Y coordinate's accuracy doesn't matter at all until you get much much closer. 580 */ 581 public final Setting<Boolean> simplifyUnloadedYCoord = new Setting<>(true); 582 583 /** 584 * Whenever a block changes, repack the whole chunk that it's in 585 */ 586 public final Setting<Boolean> repackOnAnyBlockChange = new Setting<>(true); 587 588 /** 589 * If a movement takes this many ticks more than its initial cost estimate, cancel it 590 */ 591 public final Setting<Integer> movementTimeoutTicks = new Setting<>(100); 592 593 /** 594 * Pathing ends after this amount of time, but only if a path has been found 595 * <p> 596 * If no valid path (length above the minimum) has been found, pathing continues up until the failure timeout 597 */ 598 public final Setting<Long> primaryTimeoutMS = new Setting<>(500L); 599 600 /** 601 * Pathing can never take longer than this, even if that means failing to find any path at all 602 */ 603 public final Setting<Long> failureTimeoutMS = new Setting<>(2000L); 604 605 /** 606 * Planning ahead while executing a segment ends after this amount of time, but only if a path has been found 607 * <p> 608 * If no valid path (length above the minimum) has been found, pathing continues up until the failure timeout 609 */ 610 public final Setting<Long> planAheadPrimaryTimeoutMS = new Setting<>(4000L); 611 612 /** 613 * Planning ahead while executing a segment can never take longer than this, even if that means failing to find any path at all 614 */ 615 public final Setting<Long> planAheadFailureTimeoutMS = new Setting<>(5000L); 616 617 /** 618 * For debugging, consider nodes much much slower 619 */ 620 public final Setting<Boolean> slowPath = new Setting<>(false); 621 622 /** 623 * Milliseconds between each node 624 */ 625 public final Setting<Long> slowPathTimeDelayMS = new Setting<>(100L); 626 627 /** 628 * The alternative timeout number when slowPath is on 629 */ 630 public final Setting<Long> slowPathTimeoutMS = new Setting<>(40000L); 631 632 633 /** 634 * allows baritone to save bed waypoints when interacting with beds 635 */ 636 public final Setting<Boolean> doBedWaypoints = new Setting<>(true); 637 638 /** 639 * allows baritone to save death waypoints 640 */ 641 public final Setting<Boolean> doDeathWaypoints = new Setting<>(true); 642 643 /** 644 * The big one. Download all chunks in simplified 2-bit format and save them for better very-long-distance pathing. 645 */ 646 public final Setting<Boolean> chunkCaching = new Setting<>(true); 647 648 /** 649 * On save, delete from RAM any cached regions that are more than 1024 blocks away from the player 650 * <p> 651 * Temporarily disabled 652 * <p> 653 * Temporarily reenabled 654 * 655 * @see <a href="https://github.com/cabaletta/baritone/issues/248">Issue #248</a> 656 */ 657 public final Setting<Boolean> pruneRegionsFromRAM = new Setting<>(true); 658 659 /** 660 * The chunk packer queue can never grow to larger than this, if it does, the oldest chunks are discarded 661 * <p> 662 * The newest chunks are kept, so that if you're moving in a straight line quickly then stop, your immediate render distance is still included 663 */ 664 public final Setting<Integer> chunkPackerQueueMaxSize = new Setting<>(2000); 665 666 /** 667 * Fill in blocks behind you 668 */ 669 public final Setting<Boolean> backfill = new Setting<>(false); 670 671 /** 672 * Shows popup message in the upper right corner, similarly to when you make an advancement 673 */ 674 public final Setting<Boolean> logAsToast = new Setting<>(false); 675 676 /** 677 * Print all the debug messages to chat 678 */ 679 public final Setting<Boolean> chatDebug = new Setting<>(false); 680 681 /** 682 * Allow chat based control of Baritone. Most likely should be disabled when Baritone is imported for use in 683 * something else 684 */ 685 public final Setting<Boolean> chatControl = new Setting<>(true); 686 687 /** 688 * Some clients like Impact try to force chatControl to off, so here's a second setting to do it anyway 689 */ 690 public final Setting<Boolean> chatControlAnyway = new Setting<>(false); 691 692 /** 693 * Render the path 694 */ 695 public final Setting<Boolean> renderPath = new Setting<>(true); 696 697 /** 698 * Render the path as a line instead of a frickin thingy 699 */ 700 public final Setting<Boolean> renderPathAsLine = new Setting<>(false); 701 702 /** 703 * Render the goal 704 */ 705 public final Setting<Boolean> renderGoal = new Setting<>(true); 706 707 /** 708 * Render the goal as a sick animated thingy instead of just a box 709 * (also controls animation of GoalXZ if {@link #renderGoalXZBeacon} is enabled) 710 */ 711 public final Setting<Boolean> renderGoalAnimated = new Setting<>(true); 712 713 /** 714 * Render selection boxes 715 */ 716 public final Setting<Boolean> renderSelectionBoxes = new Setting<>(true); 717 718 /** 719 * Ignore depth when rendering the goal 720 */ 721 public final Setting<Boolean> renderGoalIgnoreDepth = new Setting<>(true); 722 723 /** 724 * Renders X/Z type Goals with the vanilla beacon beam effect. Combining this with 725 * {@link #renderGoalIgnoreDepth} will cause strange render clipping. 726 */ 727 public final Setting<Boolean> renderGoalXZBeacon = new Setting<>(false); 728 729 /** 730 * Ignore depth when rendering the selection boxes (to break, to place, to walk into) 731 */ 732 public final Setting<Boolean> renderSelectionBoxesIgnoreDepth = new Setting<>(true); 733 734 /** 735 * Ignore depth when rendering the path 736 */ 737 public final Setting<Boolean> renderPathIgnoreDepth = new Setting<>(true); 738 739 /** 740 * Line width of the path when rendered, in pixels 741 */ 742 public final Setting<Float> pathRenderLineWidthPixels = new Setting<>(5F); 743 744 /** 745 * Line width of the goal when rendered, in pixels 746 */ 747 public final Setting<Float> goalRenderLineWidthPixels = new Setting<>(3F); 748 749 /** 750 * Start fading out the path at 20 movements ahead, and stop rendering it entirely 30 movements ahead. 751 * Improves FPS. 752 */ 753 public final Setting<Boolean> fadePath = new Setting<>(false); 754 755 /** 756 * Move without having to force the client-sided rotations 757 */ 758 public final Setting<Boolean> freeLook = new Setting<>(true); 759 760 /** 761 * Break and place blocks without having to force the client-sided rotations. Requires {@link #freeLook}. 762 */ 763 public final Setting<Boolean> blockFreeLook = new Setting<>(false); 764 765 /** 766 * Automatically elytra fly without having to force the client-sided rotations. 767 */ 768 public final Setting<Boolean> elytraFreeLook = new Setting<>(true); 769 770 /** 771 * Forces the client-sided yaw rotation to an average of the last {@link #smoothLookTicks} of server-sided rotations. 772 */ 773 public final Setting<Boolean> smoothLook = new Setting<>(false); 774 775 /** 776 * Same as {@link #smoothLook} but for elytra flying. 777 */ 778 public final Setting<Boolean> elytraSmoothLook = new Setting<>(false); 779 780 /** 781 * The number of ticks to average across for {@link #smoothLook}; 782 */ 783 public final Setting<Integer> smoothLookTicks = new Setting<>(5); 784 785 /** 786 * When true, the player will remain with its existing look direction as often as possible. 787 * Although, in some cases this can get it stuck, hence this setting to disable that behavior. 788 */ 789 public final Setting<Boolean> remainWithExistingLookDirection = new Setting<>(true); 790 791 /** 792 * Will cause some minor behavioral differences to ensure that Baritone works on anticheats. 793 * <p> 794 * At the moment this will silently set the player's rotations when using freeLook so you're not sprinting in 795 * directions other than forward, which is picken up by more "advanced" anticheats like AAC, but not NCP. 796 */ 797 public final Setting<Boolean> antiCheatCompatibility = new Setting<>(true); 798 799 /** 800 * Exclusively use cached chunks for pathing 801 * <p> 802 * Never turn this on 803 */ 804 public final Setting<Boolean> pathThroughCachedOnly = new Setting<>(false); 805 806 /** 807 * Continue sprinting while in water 808 */ 809 public final Setting<Boolean> sprintInWater = new Setting<>(true); 810 811 /** 812 * When GetToBlockProcess or MineProcess fails to calculate a path, instead of just giving up, mark the closest instance 813 * of that block as "unreachable" and go towards the next closest. GetToBlock expands this search to the whole "vein"; MineProcess does not. 814 * This is because MineProcess finds individual impossible blocks (like one block in a vein that has gravel on top then lava, so it can't break) 815 * Whereas GetToBlock should blacklist the whole "vein" if it can't get to any of them. 816 */ 817 public final Setting<Boolean> blacklistClosestOnFailure = new Setting<>(true); 818 819 /** 820 * 😎 Render cached chunks as semitransparent. Doesn't work with OptiFine 😭 Rarely randomly crashes, see <a href="https://github.com/cabaletta/baritone/issues/327">this issue</a>. 821 * <p> 822 * Can be very useful on servers with low render distance. After enabling, you may need to reload the world in order for it to have an effect 823 * (e.g. disconnect and reconnect, enter then exit the nether, die and respawn, etc). This may literally kill your FPS and CPU because 824 * every chunk gets recompiled twice as much as normal, since the cached version comes into range, then the normal one comes from the server for real. 825 * <p> 826 * Note that flowing water is cached as AVOID, which is rendered as lava. As you get closer, you may therefore see lava falls being replaced with water falls. 827 * <p> 828 * SOLID is rendered as stone in the overworld, netherrack in the nether, and end stone in the end 829 */ 830 public final Setting<Boolean> renderCachedChunks = new Setting<>(false); 831 832 /** 833 * 0.0f = not visible, fully transparent (instead of setting this to 0, turn off renderCachedChunks) 834 * 1.0f = fully opaque 835 */ 836 public final Setting<Float> cachedChunksOpacity = new Setting<>(0.5f); 837 838 /** 839 * Whether or not to allow you to run Baritone commands with the prefix 840 */ 841 public final Setting<Boolean> prefixControl = new Setting<>(true); 842 843 /** 844 * The command prefix for chat control 845 */ 846 public final Setting<String> prefix = new Setting<>("#"); 847 848 /** 849 * Use a short Baritone prefix [B] instead of [Baritone] when logging to chat 850 */ 851 public final Setting<Boolean> shortBaritonePrefix = new Setting<>(false); 852 853 /** 854 * Use a modern message tag instead of a prefix when logging to chat 855 */ 856 public final Setting<Boolean> useMessageTag = new Setting<>(false); 857 858 /** 859 * Echo commands to chat when they are run 860 */ 861 public final Setting<Boolean> echoCommands = new Setting<>(true); 862 863 /** 864 * Censor coordinates in goals and block positions 865 */ 866 public final Setting<Boolean> censorCoordinates = new Setting<>(false); 867 868 /** 869 * Censor arguments to ran commands, to hide, for example, coordinates to #goal 870 */ 871 public final Setting<Boolean> censorRanCommands = new Setting<>(false); 872 873 /** 874 * Stop using tools just before they are going to break. 875 */ 876 public final Setting<Boolean> itemSaver = new Setting<>(false); 877 878 /** 879 * Durability to leave on the tool when using itemSaver 880 */ 881 public final Setting<Integer> itemSaverThreshold = new Setting<>(10); 882 883 /** 884 * Always prefer silk touch tools over regular tools. This will not sacrifice speed, but it will always prefer silk 885 * touch tools over other tools of the same speed. This includes always choosing ANY silk touch tool over your hand. 886 */ 887 public final Setting<Boolean> preferSilkTouch = new Setting<>(false); 888 889 /** 890 * Don't stop walking forward when you need to break blocks in your way 891 */ 892 public final Setting<Boolean> walkWhileBreaking = new Setting<>(true); 893 894 /** 895 * When a new segment is calculated that doesn't overlap with the current one, but simply begins where the current segment ends, 896 * splice it on and make a longer combined path. If this setting is off, any planned segment will not be spliced and will instead 897 * be the "next path" in PathingBehavior, and will only start after this one ends. Turning this off hurts planning ahead, 898 * because the next segment will exist even if it's very short. 899 * 900 * @see #planningTickLookahead 901 */ 902 public final Setting<Boolean> splicePath = new Setting<>(true); 903 904 /** 905 * If we are more than 300 movements into the current path, discard the oldest segments, as they are no longer useful 906 */ 907 public final Setting<Integer> maxPathHistoryLength = new Setting<>(300); 908 909 /** 910 * If the current path is too long, cut off this many movements from the beginning. 911 */ 912 public final Setting<Integer> pathHistoryCutoffAmount = new Setting<>(50); 913 914 /** 915 * Rescan for the goal once every 5 ticks. 916 * Set to 0 to disable. 917 */ 918 public final Setting<Integer> mineGoalUpdateInterval = new Setting<>(5); 919 920 /** 921 * After finding this many instances of the target block in the cache, it will stop expanding outward the chunk search. 922 */ 923 public final Setting<Integer> maxCachedWorldScanCount = new Setting<>(10); 924 925 /** 926 * Mine will not scan for or remember more than this many target locations. 927 * Note that the number of locations retrieved from cache is additionaly 928 * limited by {@link #maxCachedWorldScanCount}. 929 */ 930 public final Setting<Integer> mineMaxOreLocationsCount = new Setting<>(64); 931 932 /** 933 * Sets the minimum y level whilst mining - set to 0 to turn off. 934 * if world has negative y values, subtract the min world height to get the value to put here 935 */ 936 public final Setting<Integer> minYLevelWhileMining = new Setting<>(0); 937 938 /** 939 * Sets the maximum y level to mine ores at. 940 */ 941 public final Setting<Integer> maxYLevelWhileMining = new Setting<>(2031); 942 943 /** 944 * This will only allow baritone to mine exposed ores, can be used to stop ore obfuscators on servers that use them. 945 */ 946 public final Setting<Boolean> allowOnlyExposedOres = new Setting<>(false); 947 948 /** 949 * When allowOnlyExposedOres is enabled this is the distance around to search. 950 * <p> 951 * It is recommended to keep this value low, as it dramatically increases calculation times. 952 */ 953 public final Setting<Integer> allowOnlyExposedOresDistance = new Setting<>(1); 954 955 /** 956 * When GetToBlock or non-legit Mine doesn't know any locations for the desired block, explore randomly instead of giving up. 957 */ 958 public final Setting<Boolean> exploreForBlocks = new Setting<>(true); 959 960 /** 961 * While exploring the world, offset the closest unloaded chunk by this much in both axes. 962 * <p> 963 * This can result in more efficient loading, if you set this to the render distance. 964 */ 965 public final Setting<Integer> worldExploringChunkOffset = new Setting<>(0); 966 967 /** 968 * Take the 10 closest chunks, even if they aren't strictly tied for distance metric from origin. 969 */ 970 public final Setting<Integer> exploreChunkSetMinimumSize = new Setting<>(10); 971 972 /** 973 * Attempt to maintain Y coordinate while exploring 974 * <p> 975 * -1 to disable 976 */ 977 public final Setting<Integer> exploreMaintainY = new Setting<>(64); 978 979 /** 980 * Replant normal Crops while farming and leave cactus and sugarcane to regrow 981 */ 982 public final Setting<Boolean> replantCrops = new Setting<>(true); 983 984 /** 985 * Replant nether wart while farming. This setting only has an effect when replantCrops is also enabled 986 */ 987 public final Setting<Boolean> replantNetherWart = new Setting<>(false); 988 989 /** 990 * Farming will scan for at most this many blocks. 991 */ 992 public final Setting<Integer> farmMaxScanSize = new Setting<>(256); 993 994 /** 995 * When the cache scan gives less blocks than the maximum threshold (but still above zero), scan the main world too. 996 * <p> 997 * Only if you have a beefy CPU and automatically mine blocks that are in cache 998 */ 999 public final Setting<Boolean> extendCacheOnThreshold = new Setting<>(false); 1000 1001 /** 1002 * Don't consider the next layer in builder until the current one is done 1003 */ 1004 public final Setting<Boolean> buildInLayers = new Setting<>(false); 1005 1006 /** 1007 * false = build from bottom to top 1008 * <p> 1009 * true = build from top to bottom 1010 */ 1011 public final Setting<Boolean> layerOrder = new Setting<>(false); 1012 1013 /** 1014 * How high should the individual layers be? 1015 */ 1016 public final Setting<Integer> layerHeight = new Setting<>(1); 1017 1018 /** 1019 * Start building the schematic at a specific layer. 1020 * Can help on larger builds when schematic wants to break things its already built 1021 */ 1022 public final Setting<Integer> startAtLayer = new Setting<>(0); 1023 1024 /** 1025 * If a layer is unable to be constructed, just skip it. 1026 */ 1027 public final Setting<Boolean> skipFailedLayers = new Setting<>(false); 1028 1029 /** 1030 * Only build the selected part of schematics 1031 */ 1032 public final Setting<Boolean> buildOnlySelection = new Setting<>(false); 1033 1034 /** 1035 * How far to move before repeating the build. 0 to disable repeating on a certain axis, 0,0,0 to disable entirely 1036 */ 1037 public final Setting<Vec3i> buildRepeat = new Setting<>(new Vec3i(0, 0, 0)); 1038 1039 /** 1040 * How many times to buildrepeat. -1 for infinite. 1041 */ 1042 public final Setting<Integer> buildRepeatCount = new Setting<>(-1); 1043 1044 /** 1045 * Don't notify schematics that they are moved. 1046 * e.g. replacing will replace the same spots for every repetition 1047 * Mainly for backward compatibility. 1048 */ 1049 public final Setting<Boolean> buildRepeatSneaky = new Setting<>(true); 1050 1051 /** 1052 * Allow standing above a block while mining it, in BuilderProcess 1053 * <p> 1054 * Experimental 1055 */ 1056 public final Setting<Boolean> breakFromAbove = new Setting<>(false); 1057 1058 /** 1059 * As well as breaking from above, set a goal to up and to the side of all blocks to break. 1060 * <p> 1061 * Never turn this on without also turning on breakFromAbove. 1062 */ 1063 public final Setting<Boolean> goalBreakFromAbove = new Setting<>(false); 1064 1065 /** 1066 * Build in map art mode, which makes baritone only care about the top block in each column 1067 */ 1068 public final Setting<Boolean> mapArtMode = new Setting<>(false); 1069 1070 /** 1071 * Override builder's behavior to not attempt to correct blocks that are currently water 1072 */ 1073 public final Setting<Boolean> okIfWater = new Setting<>(false); 1074 1075 /** 1076 * The set of incorrect blocks can never grow beyond this size 1077 */ 1078 public final Setting<Integer> incorrectSize = new Setting<>(100); 1079 1080 /** 1081 * Multiply the cost of breaking a block that's correct in the builder's schematic by this coefficient 1082 */ 1083 public final Setting<Double> breakCorrectBlockPenaltyMultiplier = new Setting<>(10d); 1084 1085 /** 1086 * Multiply the cost of placing a block that's incorrect in the builder's schematic by this coefficient 1087 */ 1088 public final Setting<Double> placeIncorrectBlockPenaltyMultiplier = new Setting<>(2d); 1089 1090 /** 1091 * When this setting is true, build a schematic with the highest X coordinate being the origin, instead of the lowest 1092 */ 1093 public final Setting<Boolean> schematicOrientationX = new Setting<>(false); 1094 1095 /** 1096 * When this setting is true, build a schematic with the highest Y coordinate being the origin, instead of the lowest 1097 */ 1098 public final Setting<Boolean> schematicOrientationY = new Setting<>(false); 1099 1100 /** 1101 * When this setting is true, build a schematic with the highest Z coordinate being the origin, instead of the lowest 1102 */ 1103 public final Setting<Boolean> schematicOrientationZ = new Setting<>(false); 1104 1105 /** 1106 * Rotates the schematic before building it. 1107 * Possible values are 1108 * <ul> 1109 * <li> NONE - No rotation </li> 1110 * <li> CLOCKWISE_90 - Rotate 90° clockwise </li> 1111 * <li> CLOCKWISE_180 - Rotate 180° clockwise </li> 1112 * <li> COUNTERCLOCKWISE_90 - Rotate 270° clockwise </li> 1113 * </ul> 1114 */ 1115 public final Setting<Rotation> buildSchematicRotation = new Setting<>(Rotation.NONE); 1116 1117 /** 1118 * Mirrors the schematic before building it. 1119 * Possible values are 1120 * <ul> 1121 * <li> FRONT_BACK - mirror the schematic along its local x axis </li> 1122 * <li> LEFT_RIGHT - mirror the schematic along its local z axis </li> 1123 * </ul> 1124 */ 1125 public final Setting<Mirror> buildSchematicMirror = new Setting<>(Mirror.NONE); 1126 1127 /** 1128 * The fallback used by the build command when no extension is specified. This may be useful if schematics of a 1129 * particular format are used often, and the user does not wish to have to specify the extension with every usage. 1130 */ 1131 public final Setting<String> schematicFallbackExtension = new Setting<>("schematic"); 1132 1133 /** 1134 * Distance to scan every tick for updates. Expanding this beyond player reach distance (i.e. setting it to 6 or above) 1135 * is only necessary in very large schematics where rescanning the whole thing is costly. 1136 */ 1137 public final Setting<Integer> builderTickScanRadius = new Setting<>(5); 1138 1139 /** 1140 * While mining, should it also consider dropped items of the correct type as a pathing destination (as well as ore blocks)? 1141 */ 1142 public final Setting<Boolean> mineScanDroppedItems = new Setting<>(true); 1143 1144 /** 1145 * While mining, wait this number of milliseconds after mining an ore to see if it will drop an item 1146 * instead of immediately going onto the next one 1147 * <p> 1148 * Thanks Louca 1149 */ 1150 public final Setting<Long> mineDropLoiterDurationMSThanksLouca = new Setting<>(250L); 1151 1152 /** 1153 * Trim incorrect positions too far away, helps performance but hurts reliability in very large schematics 1154 */ 1155 public final Setting<Boolean> distanceTrim = new Setting<>(true); 1156 1157 /** 1158 * Cancel the current path if the goal has changed, and the path originally ended in the goal but doesn't anymore. 1159 * <p> 1160 * Currently only runs when either MineBehavior or FollowBehavior is active. 1161 * <p> 1162 * For example, if Baritone is doing "mine iron_ore", the instant it breaks the ore (and it becomes air), that location 1163 * is no longer a goal. This means that if this setting is true, it will stop there. If this setting were off, it would 1164 * continue with its path, and walk into that location. The tradeoff is if this setting is true, it mines ores much faster 1165 * since it doesn't waste any time getting into locations that no longer contain ores, but on the other hand, it misses 1166 * some drops, and continues on without ever picking them up. 1167 * <p> 1168 * Also on cosmic prisons this should be set to true since you don't actually mine the ore it just gets replaced with stone. 1169 */ 1170 public final Setting<Boolean> cancelOnGoalInvalidation = new Setting<>(true); 1171 1172 /** 1173 * The "axis" command (aka GoalAxis) will go to a axis, or diagonal axis, at this Y level. 1174 */ 1175 public final Setting<Integer> axisHeight = new Setting<>(120); 1176 1177 /** 1178 * Disconnect from the server upon arriving at your goal 1179 */ 1180 public final Setting<Boolean> disconnectOnArrival = new Setting<>(false); 1181 1182 /** 1183 * Disallow MineBehavior from using X-Ray to see where the ores are. Turn this option on to force it to mine "legit" 1184 * where it will only mine an ore once it can actually see it, so it won't do or know anything that a normal player 1185 * couldn't. If you don't want it to look like you're X-Raying, turn this on 1186 * This will always explore, regardless of exploreForBlocks 1187 */ 1188 public final Setting<Boolean> legitMine = new Setting<>(false); 1189 1190 /** 1191 * What Y level to go to for legit strip mining 1192 */ 1193 public final Setting<Integer> legitMineYLevel = new Setting<>(-59); 1194 1195 /** 1196 * Magically see ores that are separated diagonally from existing ores. Basically like mining around the ores that it finds 1197 * in case there's one there touching it diagonally, except it checks it un-legit-ly without having the mine blocks to see it. 1198 * You can decide whether this looks plausible or not. 1199 * <p> 1200 * This is disabled because it results in some weird behavior. For example, it can """see""" the top block of a vein of iron_ore 1201 * through a lava lake. This isn't an issue normally since it won't consider anything touching lava, so it just ignores it. 1202 * However, this setting expands that and allows it to see the entire vein so it'll mine under the lava lake to get the iron that 1203 * it can reach without mining blocks adjacent to lava. This really defeats the purpose of legitMine since a player could never 1204 * do that lol, so thats one reason why its disabled 1205 */ 1206 public final Setting<Boolean> legitMineIncludeDiagonals = new Setting<>(false); 1207 1208 /** 1209 * When mining block of a certain type, try to mine two at once instead of one. 1210 * If the block above is also a goal block, set GoalBlock instead of GoalTwoBlocks 1211 * If the block below is also a goal block, set GoalBlock to the position one down instead of GoalTwoBlocks 1212 */ 1213 public final Setting<Boolean> forceInternalMining = new Setting<>(true); 1214 1215 /** 1216 * Modification to the previous setting, only has effect if forceInternalMining is true 1217 * If true, only apply the previous setting if the block adjacent to the goal isn't air. 1218 */ 1219 public final Setting<Boolean> internalMiningAirException = new Setting<>(true); 1220 1221 /** 1222 * The actual GoalNear is set this distance away from the entity you're following 1223 * <p> 1224 * For example, set followOffsetDistance to 5 and followRadius to 0 to always stay precisely 5 blocks north of your follow target. 1225 */ 1226 public final Setting<Double> followOffsetDistance = new Setting<>(0D); 1227 1228 /** 1229 * The actual GoalNear is set in this direction from the entity you're following. This value is in degrees. 1230 */ 1231 public final Setting<Float> followOffsetDirection = new Setting<>(0F); 1232 1233 /** 1234 * The radius (for the GoalNear) of how close to your target position you actually have to be 1235 */ 1236 public final Setting<Integer> followRadius = new Setting<>(3); 1237 1238 /** 1239 * The maximum distance to the entity you're following 1240 */ 1241 public final Setting<Integer> followTargetMaxDistance = new Setting<>(0); 1242 1243 /** 1244 * Turn this on if your exploration filter is enormous, you don't want it to check if it's done, 1245 * and you are just fine with it just hanging on completion 1246 */ 1247 public final Setting<Boolean> disableCompletionCheck = new Setting<>(false); 1248 1249 /** 1250 * Cached chunks (regardless of if they're in RAM or saved to disk) expire and are deleted after this number of seconds 1251 * -1 to disable 1252 * <p> 1253 * I would highly suggest leaving this setting disabled (-1). 1254 * <p> 1255 * The only valid reason I can think of enable this setting is if you are extremely low on disk space and you play on multiplayer, 1256 * and can't take (average) 300kb saved for every 512x512 area. (note that more complicated terrain is less compressible and will take more space) 1257 * <p> 1258 * However, simply discarding old chunks because they are old is inadvisable. Baritone is extremely good at correcting 1259 * itself and its paths as it learns new information, as new chunks load. There is no scenario in which having an 1260 * incorrect cache can cause Baritone to get stuck, take damage, or perform any action it wouldn't otherwise, everything 1261 * is rechecked once the real chunk is in range. 1262 * <p> 1263 * Having a robust cache greatly improves long distance pathfinding, as it's able to go around large scale obstacles 1264 * before they're in render distance. In fact, when the chunkCaching setting is disabled and Baritone starts anew 1265 * every time, or when you enter a completely new and very complicated area, it backtracks far more often because it 1266 * has to build up that cache from scratch. But after it's gone through an area just once, the next time will have zero 1267 * backtracking, since the entire area is now known and cached. 1268 */ 1269 public final Setting<Long> cachedChunksExpirySeconds = new Setting<>(-1L); 1270 1271 /** 1272 * The function that is called when Baritone will log to chat. This function can be added to 1273 * via {@link Consumer#andThen(Consumer)} or it can completely be overriden via setting 1274 * {@link Setting#value}; 1275 */ 1276 @JavaOnly 1277 public final Setting<Consumer<Component>> logger = new Setting<>((msg) -> { 1278 try { 1279 final GuiMessageTag tag = useMessageTag.value ? Helper.MESSAGE_TAG : null; 1280 Minecraft.getInstance().gui.getChat().addMessage(msg, null, tag); 1281 } catch (Throwable t) { 1282 LOGGER.warn("Failed to log message to chat: " + msg.getString(), t); 1283 } 1284 }); 1285 1286 /** 1287 * The function that is called when Baritone will send a desktop notification. This function can be added to 1288 * via {@link Consumer#andThen(Consumer)} or it can completely be overriden via setting 1289 * {@link Setting#value}; 1290 */ 1291 @JavaOnly 1292 public final Setting<BiConsumer<String, Boolean>> notifier = new Setting<>(NotificationHelper::notify); 1293 1294 /** 1295 * The function that is called when Baritone will show a toast. This function can be added to 1296 * via {@link Consumer#andThen(Consumer)} or it can completely be overriden via setting 1297 * {@link Setting#value}; 1298 */ 1299 @JavaOnly 1300 public final Setting<BiConsumer<Component, Component>> toaster = new Setting<>(BaritoneToast::addOrUpdate); 1301 1302 /** 1303 * Print out ALL command exceptions as a stack trace to stdout, even simple syntax errors 1304 */ 1305 public final Setting<Boolean> verboseCommandExceptions = new Setting<>(false); 1306 1307 /** 1308 * The size of the box that is rendered when the current goal is a GoalYLevel 1309 */ 1310 public final Setting<Double> yLevelBoxSize = new Setting<>(15D); 1311 1312 /** 1313 * The color of the current path 1314 */ 1315 public final Setting<Color> colorCurrentPath = new Setting<>(Color.RED); 1316 1317 /** 1318 * The color of the next path 1319 */ 1320 public final Setting<Color> colorNextPath = new Setting<>(Color.MAGENTA); 1321 1322 /** 1323 * The color of the blocks to break 1324 */ 1325 public final Setting<Color> colorBlocksToBreak = new Setting<>(Color.RED); 1326 1327 /** 1328 * The color of the blocks to place 1329 */ 1330 public final Setting<Color> colorBlocksToPlace = new Setting<>(Color.GREEN); 1331 1332 /** 1333 * The color of the blocks to walk into 1334 */ 1335 public final Setting<Color> colorBlocksToWalkInto = new Setting<>(Color.MAGENTA); 1336 1337 /** 1338 * The color of the best path so far 1339 */ 1340 public final Setting<Color> colorBestPathSoFar = new Setting<>(Color.BLUE); 1341 1342 /** 1343 * The color of the path to the most recent considered node 1344 */ 1345 public final Setting<Color> colorMostRecentConsidered = new Setting<>(Color.CYAN); 1346 1347 /** 1348 * The color of the goal box 1349 */ 1350 public final Setting<Color> colorGoalBox = new Setting<>(Color.GREEN); 1351 1352 /** 1353 * The color of the goal box when it's inverted 1354 */ 1355 public final Setting<Color> colorInvertedGoalBox = new Setting<>(Color.RED); 1356 1357 /** 1358 * The color of all selections 1359 */ 1360 public final Setting<Color> colorSelection = new Setting<>(Color.CYAN); 1361 1362 /** 1363 * The color of the selection pos 1 1364 */ 1365 public final Setting<Color> colorSelectionPos1 = new Setting<>(Color.BLACK); 1366 1367 /** 1368 * The color of the selection pos 2 1369 */ 1370 public final Setting<Color> colorSelectionPos2 = new Setting<>(Color.ORANGE); 1371 1372 /** 1373 * The opacity of the selection. 0 is completely transparent, 1 is completely opaque 1374 */ 1375 public final Setting<Float> selectionOpacity = new Setting<>(.5f); 1376 1377 /** 1378 * Line width of the goal when rendered, in pixels 1379 */ 1380 public final Setting<Float> selectionLineWidth = new Setting<>(2F); 1381 1382 /** 1383 * Render selections 1384 */ 1385 public final Setting<Boolean> renderSelection = new Setting<>(true); 1386 1387 /** 1388 * Ignore depth when rendering selections 1389 */ 1390 public final Setting<Boolean> renderSelectionIgnoreDepth = new Setting<>(true); 1391 1392 /** 1393 * Render selection corners 1394 */ 1395 public final Setting<Boolean> renderSelectionCorners = new Setting<>(true); 1396 1397 /** 1398 * Use sword to mine. 1399 */ 1400 public final Setting<Boolean> useSwordToMine = new Setting<>(true); 1401 1402 /** 1403 * Desktop notifications 1404 */ 1405 public final Setting<Boolean> desktopNotifications = new Setting<>(false); 1406 1407 /** 1408 * Desktop notification on path complete 1409 */ 1410 public final Setting<Boolean> notificationOnPathComplete = new Setting<>(true); 1411 1412 /** 1413 * Desktop notification on farm fail 1414 */ 1415 public final Setting<Boolean> notificationOnFarmFail = new Setting<>(true); 1416 1417 /** 1418 * Desktop notification on build finished 1419 */ 1420 public final Setting<Boolean> notificationOnBuildFinished = new Setting<>(true); 1421 1422 /** 1423 * Desktop notification on explore finished 1424 */ 1425 public final Setting<Boolean> notificationOnExploreFinished = new Setting<>(true); 1426 1427 /** 1428 * Desktop notification on mine fail 1429 */ 1430 public final Setting<Boolean> notificationOnMineFail = new Setting<>(true); 1431 1432 /** 1433 * The number of ticks of elytra movement to simulate while firework boost is not active. Higher values are 1434 * computationally more expensive. 1435 */ 1436 public final Setting<Integer> elytraSimulationTicks = new Setting<>(20); 1437 1438 /** 1439 * The maximum allowed deviation in pitch from a direct line-of-sight to the flight target. Higher values are 1440 * computationally more expensive. 1441 */ 1442 public final Setting<Integer> elytraPitchRange = new Setting<>(25); 1443 1444 /** 1445 * The minimum speed that the player can drop to (in blocks/tick) before a firework is automatically deployed. 1446 */ 1447 public final Setting<Double> elytraFireworkSpeed = new Setting<>(1.2); 1448 1449 /** 1450 * The delay after the player's position is set-back by the server that a firework may be automatically deployed. 1451 * Value is in ticks. 1452 */ 1453 public final Setting<Integer> elytraFireworkSetbackUseDelay = new Setting<>(15); 1454 1455 /** 1456 * The minimum padding value that is added to the player's hitbox when considering which point to fly to on the 1457 * path. High values can result in points not being considered which are otherwise safe to fly to. Low values can 1458 * result in flight paths which are extremely tight, and there's the possibility of crashing due to getting too low 1459 * to the ground. 1460 */ 1461 public final Setting<Double> elytraMinimumAvoidance = new Setting<>(0.2); 1462 1463 /** 1464 * If enabled, avoids using fireworks when descending along the flight path. 1465 */ 1466 public final Setting<Boolean> elytraConserveFireworks = new Setting<>(false); 1467 1468 /** 1469 * Renders the raytraces that are performed by the elytra fly calculation. 1470 */ 1471 public final Setting<Boolean> elytraRenderRaytraces = new Setting<>(false); 1472 1473 /** 1474 * Renders the raytraces that are used in the hitbox part of the elytra fly calculation. 1475 * Requires {@link #elytraRenderRaytraces}. 1476 */ 1477 public final Setting<Boolean> elytraRenderHitboxRaytraces = new Setting<>(false); 1478 1479 /** 1480 * Renders the best elytra flight path that was simulated each tick. 1481 */ 1482 public final Setting<Boolean> elytraRenderSimulation = new Setting<>(true); 1483 1484 /** 1485 * Automatically path to and jump off of ledges to initiate elytra flight when grounded. 1486 */ 1487 public final Setting<Boolean> elytraAutoJump = new Setting<>(false); 1488 1489 /** 1490 * The seed used to generate chunks for long distance elytra path-finding in the nether. 1491 * Defaults to 2b2t's nether seed. 1492 */ 1493 public final Setting<Long> elytraNetherSeed = new Setting<>(146008555100680L); 1494 1495 /** 1496 * Whether nether-pathfinder should generate terrain based on {@link #elytraNetherSeed}. 1497 * If false all chunks that haven't been loaded are assumed to be air. 1498 */ 1499 public final Setting<Boolean> elytraPredictTerrain = new Setting<>(false); 1500 1501 /** 1502 * Automatically swap the current elytra with a new one when the durability gets too low 1503 */ 1504 public final Setting<Boolean> elytraAutoSwap = new Setting<>(true); 1505 1506 /** 1507 * The minimum durability an elytra can have before being swapped 1508 */ 1509 public final Setting<Integer> elytraMinimumDurability = new Setting<>(5); 1510 1511 /** 1512 * The minimum fireworks before landing early for safety 1513 */ 1514 public final Setting<Integer> elytraMinFireworksBeforeLanding = new Setting<>(5); 1515 1516 /** 1517 * Automatically land when elytra is almost out of durability, or almost out of fireworks 1518 */ 1519 public final Setting<Boolean> elytraAllowEmergencyLand = new Setting<>(true); 1520 1521 /** 1522 * Time between culling far away chunks from the nether pathfinder chunk cache 1523 */ 1524 public final Setting<Long> elytraTimeBetweenCacheCullSecs = new Setting<>(TimeUnit.MINUTES.toSeconds(3)); 1525 1526 /** 1527 * Maximum distance chunks can be before being culled from the nether pathfinder chunk cache 1528 */ 1529 public final Setting<Integer> elytraCacheCullDistance = new Setting<>(5000); 1530 1531 /** 1532 * Should elytra consider nether brick a valid landing block 1533 */ 1534 public final Setting<Boolean> elytraAllowLandOnNetherFortress = new Setting<>(false); 1535 1536 /** 1537 * Has the user read and understood the elytra terms and conditions 1538 */ 1539 public final Setting<Boolean> elytraTermsAccepted = new Setting<>(false); 1540 1541 /** 1542 * Verbose chat logging in elytra mode 1543 */ 1544 public final Setting<Boolean> elytraChatSpam = new Setting<>(false); 1545 1546 /** 1547 * A map of lowercase setting field names to their respective setting 1548 */ 1549 public final Map<String, Setting<?>> byLowerName; 1550 1551 /** 1552 * A list of all settings 1553 */ 1554 public final List<Setting<?>> allSettings; 1555 1556 public final Map<Setting<?>, Type> settingTypes; 1557 1558 public final class Setting<T> { 1559 1560 public T value; 1561 public final T defaultValue; 1562 private String name; 1563 private boolean javaOnly; 1564 1565 @SuppressWarnings("unchecked") 1566 private Setting(T value) { 1567 if (value == null) { 1568 throw new IllegalArgumentException("Cannot determine value type class from null"); 1569 } 1570 this.value = value; 1571 this.defaultValue = value; 1572 this.javaOnly = false; 1573 } 1574 1575 /** 1576 * Deprecated! Please use .value directly instead 1577 * 1578 * @return the current setting value 1579 */ 1580 @Deprecated 1581 public final T get() { 1582 return value; 1583 } 1584 1585 public final String getName() { 1586 return name; 1587 } 1588 1589 public Class<T> getValueClass() { 1590 // noinspection unchecked 1591 return (Class<T>) TypeUtils.resolveBaseClass(getType()); 1592 } 1593 1594 @Override 1595 public String toString() { 1596 return SettingsUtil.settingToString(this); 1597 } 1598 1599 /** 1600 * Reset this setting to its default value 1601 */ 1602 public void reset() { 1603 value = defaultValue; 1604 } 1605 1606 public final Type getType() { 1607 return settingTypes.get(this); 1608 } 1609 1610 /** 1611 * This should always be the same as whether the setting can be parsed from or serialized to a string; in other 1612 * words, the only way to modify it is by writing to {@link #value} programatically. 1613 * 1614 * @return {@code true} if the setting can not be set or read by the user 1615 */ 1616 public boolean isJavaOnly() { 1617 return javaOnly; 1618 } 1619 } 1620 1621 /** 1622 * Marks a {@link Setting} field as being {@link Setting#isJavaOnly() Java-only} 1623 */ 1624 @Retention(RetentionPolicy.RUNTIME) 1625 @Target(ElementType.FIELD) 1626 private @interface JavaOnly {} 1627 1628 // here be dragons 1629 1630 Settings() { 1631 Field[] temp = getClass().getFields(); 1632 1633 Map<String, Setting<?>> tmpByName = new HashMap<>(); 1634 List<Setting<?>> tmpAll = new ArrayList<>(); 1635 Map<Setting<?>, Type> tmpSettingTypes = new HashMap<>(); 1636 1637 try { 1638 for (Field field : temp) { 1639 if (field.getType().equals(Setting.class)) { 1640 Setting<?> setting = (Setting<?>) field.get(this); 1641 String name = field.getName(); 1642 setting.name = name; 1643 setting.javaOnly = field.isAnnotationPresent(JavaOnly.class); 1644 name = name.toLowerCase(); 1645 if (tmpByName.containsKey(name)) { 1646 throw new IllegalStateException("Duplicate setting name"); 1647 } 1648 tmpByName.put(name, setting); 1649 tmpAll.add(setting); 1650 tmpSettingTypes.put(setting, ((ParameterizedType) field.getGenericType()).getActualTypeArguments()[0]); 1651 } 1652 } 1653 } catch (IllegalAccessException e) { 1654 throw new IllegalStateException(e); 1655 } 1656 byLowerName = Collections.unmodifiableMap(tmpByName); 1657 allSettings = Collections.unmodifiableList(tmpAll); 1658 settingTypes = Collections.unmodifiableMap(tmpSettingTypes); 1659 } 1660 1661 @SuppressWarnings("unchecked") 1662 public <T> List<Setting<T>> getAllValuesByType(Class<T> cla$$) { 1663 List<Setting<T>> result = new ArrayList<>(); 1664 for (Setting<?> setting : allSettings) { 1665 if (setting.getValueClass().equals(cla$$)) { 1666 result.add((Setting<T>) setting); 1667 } 1668 } 1669 return result; 1670 } 1671}