Skip to content

Commit 8775c56

Browse files
committed
tabs over spaces
1 parent 6a41f80 commit 8775c56

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+4865
-4865
lines changed

src/main/kotlin/com/lambda/config/groups/ActionConfig.kt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@ import com.lambda.util.Describable
2222
import com.lambda.util.NamedEnum
2323

2424
interface ActionConfig {
25-
val sorter: SortMode
26-
val tickStageMask: Collection<TickEvent>
25+
val sorter: SortMode
26+
val tickStageMask: Collection<TickEvent>
2727

28-
enum class SortMode(
29-
override val displayName: String,
30-
override val description: String
31-
) : NamedEnum, Describable {
32-
Closest("Closest", "Breaks blocks closest to the player eye position"),
33-
Farthest("Farthest", "Breaks blocks farthest from the player eye position"),
34-
Tool("Tool", "Breaks blocks with priority given to those with tools matching the current selected"),
35-
Rotation("Rotation", "Breaks blocks closest to the player rotation"),
36-
Random("Random", "Breaks blocks in a random order")
37-
}
28+
enum class SortMode(
29+
override val displayName: String,
30+
override val description: String
31+
) : NamedEnum, Describable {
32+
Closest("Closest", "Breaks blocks closest to the player eye position"),
33+
Farthest("Farthest", "Breaks blocks farthest from the player eye position"),
34+
Tool("Tool", "Breaks blocks with priority given to those with tools matching the current selected"),
35+
Rotation("Rotation", "Breaks blocks closest to the player rotation"),
36+
Random("Random", "Breaks blocks in a random order")
37+
}
3838
}

src/main/kotlin/com/lambda/config/groups/BreakSettings.kt

Lines changed: 82 additions & 82 deletions
Large diffs are not rendered by default.

src/main/kotlin/com/lambda/context/Automated.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ import com.lambda.interaction.managers.inventory.InventoryConfig
2626
import com.lambda.interaction.managers.rotating.RotationConfig
2727

2828
interface Automated {
29-
val buildConfig: BuildConfig
30-
val breakConfig: BreakConfig
31-
val interactConfig: InteractConfig
32-
val rotationConfig: RotationConfig
33-
val inventoryConfig: InventoryConfig
34-
val hotbarConfig: HotbarConfig
35-
val eatConfig: EatConfig
29+
val buildConfig: BuildConfig
30+
val breakConfig: BreakConfig
31+
val interactConfig: InteractConfig
32+
val rotationConfig: RotationConfig
33+
val inventoryConfig: InventoryConfig
34+
val hotbarConfig: HotbarConfig
35+
val eatConfig: EatConfig
3636
}

src/main/kotlin/com/lambda/context/AutomatedSafeContext.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818
package com.lambda.context
1919

2020
class AutomatedSafeContext(
21-
safeContext: SafeContext,
22-
automated: Automated
21+
safeContext: SafeContext,
22+
automated: Automated
2323
) : IAutomatedSafeContext, SafeContext by safeContext, Automated by automated

src/main/kotlin/com/lambda/context/AutomationConfig.kt

Whitespace-only changes.

src/main/kotlin/com/lambda/context/SafeContext.kt

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -49,25 +49,25 @@ import net.minecraft.client.world.ClientWorld
4949
* @property connection The network handler for the player.
5050
**/
5151
interface SafeContext {
52-
val mc: MinecraftClient
53-
val world: ClientWorld
54-
val player: ClientPlayerEntity
55-
val interaction: ClientPlayerInteractionManager
56-
val connection: ClientPlayNetworkHandler
52+
val mc: MinecraftClient
53+
val world: ClientWorld
54+
val player: ClientPlayerEntity
55+
val interaction: ClientPlayerInteractionManager
56+
val connection: ClientPlayNetworkHandler
5757

58-
companion object {
59-
fun create(): SafeContext? {
60-
val world = mc.world ?: return null
61-
val player = mc.player ?: return null
62-
val interaction = mc.interactionManager ?: return null
63-
val connection = mc.networkHandler ?: return null
64-
return object : SafeContext {
65-
override val mc = Lambda.mc
66-
override val world = world
67-
override val player = player
68-
override val interaction = interaction
69-
override val connection = connection
70-
}
71-
}
72-
}
58+
companion object {
59+
fun create(): SafeContext? {
60+
val world = mc.world ?: return null
61+
val player = mc.player ?: return null
62+
val interaction = mc.interactionManager ?: return null
63+
val connection = mc.networkHandler ?: return null
64+
return object : SafeContext {
65+
override val mc = Lambda.mc
66+
override val world = world
67+
override val player = player
68+
override val interaction = interaction
69+
override val connection = connection
70+
}
71+
}
72+
}
7373
}

src/main/kotlin/com/lambda/interaction/construction/simulation/BuildSimulator.kt

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -33,37 +33,37 @@ import kotlinx.coroutines.supervisorScope
3333
import net.minecraft.util.math.Vec3d
3434

3535
object BuildSimulator : Sim<PostSimResult>() {
36-
/**
37-
* Iterates over the blueprint and performs the best suited simulation. Each simulation adds [BuildResult]s to
38-
* the provided concurrent set. This method uses coroutines to perform the simulations in parallel. The results
39-
* will likely not be returned in the same order they were simulated due to the parallel nature of the simulations.
40-
*
41-
* @see SimInfo.sim
42-
* @see simInteraction
43-
* @see simBreak
44-
*/
45-
context(automatedSafeContext: AutomatedSafeContext)
46-
fun Structure.simulate(
47-
pov: Vec3d = automatedSafeContext.player.eyePos
48-
): Set<BuildResult> = runBlocking(Dispatchers.Default) {
49-
supervisorScope {
50-
val concurrentSet = ConcurrentSet<BuildResult>()
36+
/**
37+
* Iterates over the blueprint and performs the best suited simulation. Each simulation adds [BuildResult]s to
38+
* the provided concurrent set. This method uses coroutines to perform the simulations in parallel. The results
39+
* will likely not be returned in the same order they were simulated due to the parallel nature of the simulations.
40+
*
41+
* @see SimInfo.sim
42+
* @see simInteraction
43+
* @see simBreak
44+
*/
45+
context(automatedSafeContext: AutomatedSafeContext)
46+
fun Structure.simulate(
47+
pov: Vec3d = automatedSafeContext.player.eyePos
48+
): Set<BuildResult> = runBlocking(Dispatchers.Default) {
49+
supervisorScope {
50+
val concurrentSet = ConcurrentSet<BuildResult>()
5151

52-
with(automatedSafeContext) {
53-
forEach { (pos, targetState) ->
54-
launch {
55-
sim(
56-
pos,
57-
blockState(pos),
58-
targetState,
59-
pov,
60-
concurrentSet
52+
with(automatedSafeContext) {
53+
forEach { (pos, targetState) ->
54+
launch {
55+
sim(
56+
pos,
57+
blockState(pos),
58+
targetState,
59+
pov,
60+
concurrentSet
6161
)
62-
}
63-
}
64-
}
62+
}
63+
}
64+
}
6565

66-
concurrentSet
67-
}
68-
}
66+
concurrentSet
67+
}
68+
}
6969
}

src/main/kotlin/com/lambda/interaction/construction/simulation/SimInfo.kt

Lines changed: 84 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -38,105 +38,105 @@ import java.util.*
3838
* as an extension of the [SimInfo] class to allow easy access through the DSL style sim builder.
3939
*/
4040
interface SimInfo : Automated {
41-
val pos: BlockPos
42-
val state: BlockState
41+
val pos: BlockPos
42+
val state: BlockState
4343
val targetState: TargetState
44-
val pov: Vec3d
44+
val pov: Vec3d
4545
val dependencyStack: Stack<Sim<*>>
46-
val concurrentResults: MutableSet<BuildResult>
46+
val concurrentResults: MutableSet<BuildResult>
4747

4848
@SimDsl
4949
context(_: AutomatedSafeContext, _: Sim<*>)
5050
suspend fun sim()
5151

52-
companion object {
53-
/**
54-
* Creates a [SimInfo], checks its basic requirements, and runs the [simBuilder] block.
55-
*/
56-
@SimDsl
57-
context(_: BuildSimulator)
58-
suspend fun AutomatedSafeContext.sim(
59-
pos: BlockPos,
60-
state: BlockState,
61-
targetState: TargetState,
62-
pov: Vec3d,
63-
concurrentResults: MutableSet<BuildResult>
64-
) = getTypedInfo(
65-
pos,
66-
state,
67-
targetState,
68-
pov,
69-
Stack(),
70-
concurrentResults
52+
companion object {
53+
/**
54+
* Creates a [SimInfo], checks its basic requirements, and runs the [simBuilder] block.
55+
*/
56+
@SimDsl
57+
context(_: BuildSimulator)
58+
suspend fun AutomatedSafeContext.sim(
59+
pos: BlockPos,
60+
state: BlockState,
61+
targetState: TargetState,
62+
pov: Vec3d,
63+
concurrentResults: MutableSet<BuildResult>
64+
) = getTypedInfo(
65+
pos,
66+
state,
67+
targetState,
68+
pov,
69+
Stack(),
70+
concurrentResults
7171
).takeIf { it?.hasBasicRequirements() == true }?.sim()
7272

73-
/**
74-
* Creates a new [SimInfo] using the current [SimInfo]'s [dependencyStack] and [concurrentResults],
75-
* checks its basic requirements, and runs the [simBuilder] block. As simulations tend to make use of
76-
* concurrency, a new stack is created and the dependencies from the previous stack are added.
77-
*/
78-
@SimDsl
79-
context(automatedSafeContext: AutomatedSafeContext, _: Sim<*>)
80-
suspend fun SimInfo.sim(
81-
pos: BlockPos = this.pos,
82-
state: BlockState = this.state,
83-
targetState: TargetState = this.targetState,
84-
pov: Vec3d = this.pov
85-
) = automatedSafeContext.getTypedInfo(
86-
pos,
87-
state,
88-
targetState,
89-
pov,
90-
Stack<Sim<*>>().apply { addAll(dependencyStack) },
91-
concurrentResults
73+
/**
74+
* Creates a new [SimInfo] using the current [SimInfo]'s [dependencyStack] and [concurrentResults],
75+
* checks its basic requirements, and runs the [simBuilder] block. As simulations tend to make use of
76+
* concurrency, a new stack is created and the dependencies from the previous stack are added.
77+
*/
78+
@SimDsl
79+
context(automatedSafeContext: AutomatedSafeContext, _: Sim<*>)
80+
suspend fun SimInfo.sim(
81+
pos: BlockPos = this.pos,
82+
state: BlockState = this.state,
83+
targetState: TargetState = this.targetState,
84+
pov: Vec3d = this.pov
85+
) = automatedSafeContext.getTypedInfo(
86+
pos,
87+
state,
88+
targetState,
89+
pov,
90+
Stack<Sim<*>>().apply { addAll(dependencyStack) },
91+
concurrentResults
9292
).takeIf { it?.hasBasicRequirements() == true }?.sim()
9393

94-
@SimDsl
95-
private fun AutomatedSafeContext.getTypedInfo(
96-
pos: BlockPos,
97-
state: BlockState,
98-
targetState: TargetState,
99-
pov: Vec3d,
100-
dependencyStack: Stack<Sim<*>>,
101-
concurrentResults: MutableSet<BuildResult>
102-
): SimInfo? {
103-
if (!targetState.isEmpty()) {
104-
getProcessingInfo(state, targetState, pos)?.let { preProcessing ->
105-
return if (preProcessing.info.omitInteraction) null
106-
else object : InteractSimInfo, Automated by this {
107-
override val pos = pos
108-
override val state = state
109-
override val targetState = targetState
110-
override val pov = pov
111-
override val dependencyStack = dependencyStack
112-
override val concurrentResults = concurrentResults
113-
override val preProcessing = preProcessing
114-
override val expectedState = preProcessing.info.expectedState
115-
override val item = preProcessing.info.item
116-
override val placing = preProcessing.info.placing
94+
@SimDsl
95+
private fun AutomatedSafeContext.getTypedInfo(
96+
pos: BlockPos,
97+
state: BlockState,
98+
targetState: TargetState,
99+
pov: Vec3d,
100+
dependencyStack: Stack<Sim<*>>,
101+
concurrentResults: MutableSet<BuildResult>
102+
): SimInfo? {
103+
if (!targetState.isEmpty()) {
104+
getProcessingInfo(state, targetState, pos)?.let { preProcessing ->
105+
return if (preProcessing.info.omitInteraction) null
106+
else object : InteractSimInfo, Automated by this {
107+
override val pos = pos
108+
override val state = state
109+
override val targetState = targetState
110+
override val pov = pov
111+
override val dependencyStack = dependencyStack
112+
override val concurrentResults = concurrentResults
113+
override val preProcessing = preProcessing
114+
override val expectedState = preProcessing.info.expectedState
115+
override val item = preProcessing.info.item
116+
override val placing = preProcessing.info.placing
117117

118-
context(_: AutomatedSafeContext, _: Sim<*>)
119-
override suspend fun sim() = simInteraction()
118+
context(_: AutomatedSafeContext, _: Sim<*>)
119+
override suspend fun sim() = simInteraction()
120120

121-
override fun AutomatedSafeContext.matchesTarget(state: BlockState, completely: Boolean) =
122-
expectedState.matches(state, if (!completely) preProcessing.info.ignore else emptySet())
123-
}
124-
}
125-
}
121+
override fun AutomatedSafeContext.matchesTarget(state: BlockState, completely: Boolean) =
122+
expectedState.matches(state, if (!completely) preProcessing.info.ignore else emptySet())
123+
}
124+
}
125+
}
126126

127-
return object : BreakSimInfo, Automated by this {
128-
override val pos = pos
129-
override val state = state
130-
override val targetState = targetState
131-
override val pov = pov
132-
override val dependencyStack = dependencyStack
133-
override val concurrentResults = concurrentResults
127+
return object : BreakSimInfo, Automated by this {
128+
override val pos = pos
129+
override val state = state
130+
override val targetState = targetState
131+
override val pov = pov
132+
override val dependencyStack = dependencyStack
133+
override val concurrentResults = concurrentResults
134134

135-
context(_: AutomatedSafeContext, _: Sim<*>)
136-
override suspend fun sim() = simBreak()
137-
}
138-
}
139-
}
135+
context(_: AutomatedSafeContext, _: Sim<*>)
136+
override suspend fun sim() = simBreak()
137+
}
138+
}
139+
}
140140
}
141141

142142
interface InteractSimInfo : SimInfo {

0 commit comments

Comments
 (0)