Skip to content

Commit 8b2554b

Browse files
Baritone.kt rewrite (#399)
* Baritone.kt Darft * Update baritone.kt * Compile fix All of the original stuff and more works. * New Baritone controls * Baritone.kt complete * Fix typos Co-authored-by: Constructor <fractalminds@protonmail.com>
1 parent d6cbd97 commit 8b2554b

File tree

1 file changed

+72
-22
lines changed
  • src/main/kotlin/com/lambda/client/module/modules/client

1 file changed

+72
-22
lines changed

src/main/kotlin/com/lambda/client/module/modules/client/Baritone.kt

+72-22
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,54 @@ object Baritone : Module(
1919
showOnArray = false,
2020
alwaysEnabled = true
2121
) {
22-
private val showOnRadar by setting("Show Path on Radar", true, description = "Show the current path on radar.")
23-
private val color by setting("Path Color", ColorHolder(32, 250, 32), visibility = { showOnRadar })
24-
private val allowBreak by setting("Allow Break", true)
25-
private val allowSprint by setting("Allow Sprint", true)
26-
private val allowPlace by setting("Allow Place", true)
27-
private val allowInventory by setting("Allow Inventory", false)
28-
private val freeLook by setting("Free Look", true)
29-
private val allowWaterBucketFall by setting("Water bucket clutch", true, description = "Uses a water bucket to get down quickly.")
30-
private val maxFallHeightBucket by setting("Max bucket height", 20, 5..255, 5, { allowWaterBucketFall }, description = "Max height that baritone can use a water bucket.")
31-
private val allowDownwardTunneling by setting("Downward Tunneling", true)
32-
private val allowParkour by setting("Allow Parkour", true)
33-
private val allowParkourPlace by setting("Allow Parkour Place", true)
34-
private val avoidPortals by setting("Avoid Portals", false)
35-
private val renderGoal by setting("Render Goals", true)
36-
private val failureTimeout by setting("Fail Timeout", 2, 1..20, 1, unit = "s")
37-
private val blockReachDistance by setting("Reach Distance", 4.5f, 1.0f..10.0f, 0.5f)
22+
/*
23+
* Baritone variables can be found here.
24+
* https://github.com/cabaletta/baritone/blob/master/src/api/java/baritone/api/Settings.java
25+
*/
26+
27+
private val page by setting("Page", Page.BASIC)
28+
29+
/* Basic */
30+
private val allowBreak by setting("Allow Break", true, { page == Page.BASIC }, description = "Allow Baritone to break blocks.")
31+
private val allowPlace by setting("Allow Place", true, { page == Page.BASIC }, description = "Allow Baritone to place blocks.")
32+
private val allowSprint by setting("Allow Sprint", true, { page == Page.BASIC }, description = "Allow Baritone to sprint.")
33+
private val allowInventory by setting("Allow Inventory", false, { page == Page.BASIC }, description = "Allow Baritone to move items in your inventory to your hotbar.")
34+
private val allowDownwardTunneling by setting("Downward Tunneling", true, { page == Page.BASIC }, description = "Allow mining blocks directly beneath you.")
35+
private val allowParkour by setting("Allow Parkour", true, { page == Page.BASIC })
36+
private val allowParkourPlace by setting("Allow Parkour Place", true, { allowParkour && page == Page.BASIC })
37+
private val buildInLayers by setting("Build In Layers", false, { page == Page.BASIC }, description = "Build/mine one layer at a time in schematics and selections.")
38+
private val layerOrder by setting("Top To Bottom", false, { buildInLayers && page == Page.BASIC }, description = "Build/mine from top to bottom in schematics and selections.")
39+
40+
/* Visual */
41+
private val freeLook by setting("Free Look", true, { page == Page.VISUAL }, description = "Move without having to force the client-sided rotations.")
42+
private val renderGoal by setting("Render Goals", true, { page == Page.VISUAL }, description = "Render the goal.")
43+
private val censorCoordinates by setting("Censor Coordinates", false, { page == Page.VISUAL }, description = "Censor coordinates in goals and block positions.")
44+
private val censorRanCommands by setting("Censor RanCommands", false, { page == Page.VISUAL }, description = "Censor arguments to ran commands, to hide, for example, coordinates to #goal.")
45+
private val showOnRadar by setting("Show Path on Radar", true, { page == Page.VISUAL }, description = "Show the current path on radar.")
46+
private val color by setting("Path Color", ColorHolder(32, 250, 32), visibility = { showOnRadar && page == Page.VISUAL }, description = "Path color for the radar.")
47+
48+
/* Fall */
49+
private val maxFallHeightNoWater by setting("Max Fall Height", 3, 3..5, 1, { page == Page.FALL }, description = "Distance baritone can fall without water.")
50+
private val allowWaterBucketFall by setting("Water Bucket Clutch", true, { page == Page.FALL }, description = "Uses a water bucket to get down quickly.")
51+
private val maxFallHeightBucket by setting("Max Bucket Height", 20, 10..250, 10, { allowWaterBucketFall && page == Page.FALL }, description = "Max height that baritone can use a water bucket.")
52+
53+
/* Advanced */
54+
private val blockReachDistance by setting("Reach Distance", 4.5f, 1.0f..10.0f, 0.5f, { page == Page.ADVANCED }, description = "Max distance baritone can place blocks.")
55+
private val enterPortals by setting("Enter Portals", true, { page == Page.ADVANCED }, description = "Baritone will walk all the way into the portal, instead of stopping one block before.")
56+
private val blockPlacementPenalty by setting("Block Placement Penalty", 20, 0..40, 5, { page == Page.ADVANCED }, description = "Decrease to make Baritone more often consider paths that would require placing blocks.")
57+
private val blockBreakAdditionalPenalty by setting("Block Break Additional Penalty", 2, 0..10, 1, { page == Page.ADVANCED }, description = "Lower chance to break blocks. This is a tiebreaker.")
58+
private val jumpPenalty by setting("Jump Penalty", 2, 0..10, 1, { page == Page.ADVANCED }, description = "Additional penalty for hitting the space bar (ascend, pillar, or parkour) because it uses hunger.")
59+
private val assumeWalkOnWater by setting("Assume Walk On Water", false, { page == Page.ADVANCED }, description = "Allow Baritone to assume it can walk on still water just like any other block. Requires jesus to be enabled.")
60+
private val failureTimeout by setting("Fail Timeout", 2, 1..20, 1, { page == Page.ADVANCED }, unit = "s")
61+
private val avoidance by setting("Avoidance", false, { page == Page.ADVANCED }, description = "Enables the 4 avoidance settings. It's disabled by default because of the noticeable performance impact.")
62+
private val mobAvoidanceRadius by setting("Mob Avoidance Radius", 15, 0..65, 5, visibility = { avoidance && page == Page.ADVANCED }, description = "Distance to avoid mobs.")
63+
private val mobAvoidanceCoefficient by setting("Mob Avoidance Coefficient", 1.5f, 0f..5f, 0.5f, visibility = { avoidance && page == Page.ADVANCED }, description = "Set to 1.0 to effectively disable this feature. Set below 1.0 to go out of your way to walk near mobs.")
64+
private val mobSpawnerAvoidanceRadius by setting("Mob Spawner Avoidance Radius", 10, 0..60, 10, visibility = { avoidance && page == Page.ADVANCED }, description = "Distance to avoid mob spawners.")
65+
private val mobSpawnerAvoidanceCoefficient by setting("Mob Spawner Avoidance Coefficient", 1.5f, 0f..5f, 0.5f, visibility = { avoidance && page == Page.ADVANCED }, description = "Set to 1.0 to effectively disable this feature. Set below 1.0 to go out of your way to walk near mob spawners.")
66+
67+
private enum class Page {
68+
BASIC, VISUAL, FALL, ADVANCED
69+
}
3870

3971
init {
4072
settingList.forEach {
@@ -72,20 +104,38 @@ object Baritone : Module(
72104
private fun sync() {
73105
BaritoneUtils.settings?.let {
74106
it.chatControl.value = false // enable chatControlAnyway if you want to use it
107+
/* Basic */
75108
it.allowBreak.value = allowBreak
76-
it.allowSprint.value = allowSprint
77109
it.allowPlace.value = allowPlace
110+
it.allowSprint.value = allowSprint
78111
it.allowInventory.value = allowInventory
79-
it.freeLook.value = freeLook
80-
it.allowWaterBucketFall.value = allowWaterBucketFall
81-
it.maxFallHeightBucket.value = maxFallHeightBucket
82112
it.allowDownward.value = allowDownwardTunneling
83113
it.allowParkour.value = allowParkour
84114
it.allowParkourPlace.value = allowParkourPlace
85-
it.enterPortal.value = !avoidPortals
115+
it.buildInLayers.value = buildInLayers
116+
it.layerOrder.value = layerOrder
117+
/* Visual */
118+
it.freeLook.value = freeLook
86119
it.renderGoal.value = renderGoal
87-
it.failureTimeoutMS.value = failureTimeout * 1000L
120+
it.censorCoordinates.value = censorCoordinates
121+
it.censorRanCommands.value = censorRanCommands
122+
/* Fall */
123+
it.maxFallHeightNoWater.value = maxFallHeightNoWater
124+
it.allowWaterBucketFall.value = allowWaterBucketFall
125+
it.maxFallHeightBucket.value = maxFallHeightBucket
126+
/* Advanced */
88127
it.blockReachDistance.value = blockReachDistance
128+
it.enterPortal.value = enterPortals
129+
it.blockPlacementPenalty.value = blockPlacementPenalty.toDouble()
130+
it.blockBreakAdditionalPenalty.value = blockBreakAdditionalPenalty.toDouble()
131+
it.jumpPenalty.value = jumpPenalty.toDouble()
132+
it.assumeWalkOnWater.value = assumeWalkOnWater
133+
it.failureTimeoutMS.value = failureTimeout * 1000L
134+
it.avoidance.value = avoidance
135+
it.mobAvoidanceRadius.value = mobAvoidanceRadius
136+
it.mobAvoidanceCoefficient.value = mobAvoidanceCoefficient.toDouble()
137+
it.mobSpawnerAvoidanceRadius.value = mobSpawnerAvoidanceRadius
138+
it.mobSpawnerAvoidanceCoefficient.value = mobSpawnerAvoidanceCoefficient.toDouble()
89139
}
90140
}
91141
}

0 commit comments

Comments
 (0)